X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=builtin-mv.c;h=fb8ffb41aaba5f6e2a8cc13207a2f2c407d6c91d;hb=a24d287fb305949d9eb534bf3216c0c6a7b4392f;hp=68aa2a68bb8f4232732829ba7d9459bbef3c7ad5;hpb=d2c425aa2bb8543ea08ca44b04ffacc972a7ad61;p=git.git diff --git a/builtin-mv.c b/builtin-mv.c index 68aa2a68b..fb8ffb41a 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) @@ -260,7 +256,8 @@ int cmd_mv(int argc, const char **argv, const char *prefix) for (i = 0; i < added.nr; i++) { const char *path = added.items[i].path; - add_file_to_cache(path, verbose); + if (add_file_to_cache(path, verbose)) + die("updating index entries failed"); } for (i = 0; i < deleted.nr; i++)