@matheusbsbs / matheus-bagliano / commits / 971dfa1959
Fork 0

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>

Junio C Hamano committed Mar 6, 2008 at 23:29 UTC 971dfa19598324f49bd3a010ca629c91d6a0f758
1 file changed +1 -5
builtin-mv.c
+1 -5
@@ -19,7 +19,6 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
19 int count, int base_name)
20 {
21 int i;
22 - int len = prefix ? strlen(prefix) : 0;
22 const char **result = xmalloc((count + 1) * sizeof(const char *));
23 memcpy(result, pathspec, count * sizeof(const char *));
24 result[count] = NULL;
@@ -33,11 +32,8 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
32 if (last_slash)
33 result[i] = last_slash + 1;
34 }
36 - result[i] = prefix_path(prefix, len, result[i]);
37 - if (!result[i])
38 - exit(1); /* error already given */
35 }
40 - return result;
36 + return get_pathspec(prefix, result);
37 }
38
39 static void show_list(const char *label, struct path_list *list)