summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2008-03-06 23:29:40 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2008-03-07 00:14:43 -0800
commit971dfa19598324f49bd3a010ca629c91d6a0f758 (patch)
treee021a725c00b820ac1ab1167b7813abe0ccc9508
parentget_pathspec(): die when an out-of-tree path is given (diff)
downloadtgif-971dfa19598324f49bd3a010ca629c91d6a0f758.tar.xz
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>
-rw-r--r--builtin-mv.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/builtin-mv.c b/builtin-mv.c
index 68aa2a68bb..94f6dd2aad 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -19,7 +19,6 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
int count, int base_name)
{
int i;
- int len = prefix ? strlen(prefix) : 0;
const char **result = xmalloc((count + 1) * sizeof(const char *));
memcpy(result, pathspec, count * sizeof(const char *));
result[count] = NULL;
@@ -33,11 +32,8 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec,
if (last_slash)
result[i] = last_slash + 1;
}
- result[i] = prefix_path(prefix, len, result[i]);
- if (!result[i])
- exit(1); /* error already given */
}
- return result;
+ return get_pathspec(prefix, result);
}
static void show_list(const char *label, struct path_list *list)