X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=builtin-mv.c;h=68f47384dc1cc6404d4db73b6dbea8bceab38df9;hb=4197195bee15f120e99d797b22108fd274235fd7;hp=8b81d4b51d78bb2aa49430102ab585afce9cccdf;hpb=3b91202150fef842f210668cd84fd52142dffd5c;p=git.git diff --git a/builtin-mv.c b/builtin-mv.c index 8b81d4b51..68f47384d 100644 --- a/builtin-mv.c +++ b/builtin-mv.c @@ -24,14 +24,10 @@ static const char **copy_pathspec(const char *prefix, const char **pathspec, result[count] = NULL; for (i = 0; i < count; i++) { int length = strlen(result[i]); - if (length > 0 && result[i][length - 1] == '/') { + if (length > 0 && is_dir_sep(result[i][length - 1])) result[i] = xmemdupz(result[i], length - 1); - } - if (base_name) { - const char *last_slash = strrchr(result[i], '/'); - if (last_slash) - result[i] = last_slash + 1; - } + if (base_name) + result[i] = basename((char *)result[i]); } return get_pathspec(prefix, result); }