Skip to content

Commit 971dfa1

Browse files
committed
Revert part of 744dacd (builtin-mv: minimum fix to avoid losing files)
When get_pathspec() was originally made absolute-path capable, we botched the interface to it, without dying inside the function when given a path that is outside the work tree, and made it the responsibility of callers to check the condition in a roundabout way. This is made unnecessary with the previous patch. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 3296766 commit 971dfa1

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

builtin-mv.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
1919
int count, int base_name)
2020
{
2121
int i;
22-
int len = prefix ? strlen(prefix) : 0;
2322
const char **result = xmalloc((count + 1) * sizeof(const char *));
2423
memcpy(result, pathspec, count * sizeof(const char *));
2524
result[count] = NULL;
@@ -33,11 +32,8 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
3332
if (last_slash)
3433
result[i] = last_slash + 1;
3534
}
36-
result[i] = prefix_path(prefix, len, result[i]);
37-
if (!result[i])
38-
exit(1); /* error already given */
3935
}
40-
return result;
36+
return get_pathspec(prefix, result);
4137
}
4238

4339
static void show_list(const char *label, struct path_list *list)

0 commit comments

Comments
 (0)