summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 6fac1b8)
raw | patch | inline | side by side (parent: 6fac1b8)
author | Johannes Sixt <j6t@kdbg.org> | |
Tue, 30 Jun 2009 13:33:57 +0000 (15:33 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Tue, 30 Jun 2009 18:23:21 +0000 (11:23 -0700) |
The following invocations did not work as expected on Windows:
git mv foo\bar dest
git mv foo\ dest
The first command was interpreted as
git mv foo/bar dest/foo/bar
because the Windows style directory separator was not obeyed when the
basename of 'foo\bar' was computed.
The second command failed because the Windows style directory separator was
not removed from the source directory, whereupon the lookup of the
directory in the index failed.
This fixes both issues by using is_dir_sep() and basename().
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git mv foo\bar dest
git mv foo\ dest
The first command was interpreted as
git mv foo/bar dest/foo/bar
because the Windows style directory separator was not obeyed when the
basename of 'foo\bar' was computed.
The second command failed because the Windows style directory separator was
not removed from the source directory, whereupon the lookup of the
directory in the index failed.
This fixes both issues by using is_dir_sep() and basename().
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-mv.c | patch | blob | history |
diff --git a/builtin-mv.c b/builtin-mv.c
index 8b81d4b51d78bb2aa49430102ab585afce9cccdf..68f47384dc1cc6404d4db73b6dbea8bceab38df9 100644 (file)
--- a/builtin-mv.c
+++ b/builtin-mv.c
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);
}