summaryrefslogtreecommitdiff
path: root/builtin-mv.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <junkio@cox.net>2006-12-12 21:52:19 -0800
committerLibravatar Junio C Hamano <junkio@cox.net>2006-12-12 21:52:19 -0800
commit8042ed1cebd37419ff38f540482355c0f1d30936 (patch)
tree8cc29ba2b6f5eac2d46f5222e8ff1dc1e7f6a7bd /builtin-mv.c
parentGet rid of the dependency on RCS' merge program (diff)
parentgit-svn: correctly handle packed-refs in refs/remotes/ (diff)
downloadtgif-8042ed1cebd37419ff38f540482355c0f1d30936.tar.xz
Merge branch 'master' into js/merge
* master: (42 commits) git-svn: correctly handle packed-refs in refs/remotes/ add test case for recursive merge git-svn: correctly display fatal() error messages git-svn: allow dcommit to take an alternate head git-svn: enable logging of information not supported by git Clarify fetch error for missing objects. Move Fink and Ports check to after config file shortlog: fix segfault on empty authorname shortlog: remove "[PATCH]" prefix from shortlog output Make sure the empty tree exists when needed in merge-recursive. Don't use memcpy when source and dest. buffers may overlap no need to install manpages as executable Documentation: simpler shared repository creation shortlog: fix segfault on empty authorname Add branch.*.merge warning and documentation update Fix perl/ build. git-svn: use do_switch for --follow-parent if the SVN library supports it Fix documentation copy&paste typo git-svn: extra error check to ensure we open a file correctly Documentation: update git-clone man page with new behavior ...
Diffstat (limited to 'builtin-mv.c')
-rw-r--r--builtin-mv.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/builtin-mv.c b/builtin-mv.c
index 54dd3bfe8a..d14a4a7f5c 100644
--- a/builtin-mv.c
+++ b/builtin-mv.c
@@ -146,21 +146,24 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
&& lstat(dst, &st) == 0)
bad = "cannot move directory over file";
else if (src_is_dir) {
+ const char *src_w_slash = add_slash(src);
+ int len_w_slash = length + 1;
int first, last;
modes[i] = WORKING_DIRECTORY;
- first = cache_name_pos(src, length);
+ first = cache_name_pos(src_w_slash, len_w_slash);
if (first >= 0)
- die ("Huh? %s/ is in index?", src);
+ die ("Huh? %.*s is in index?",
+ len_w_slash, src_w_slash);
first = -1 - first;
for (last = first; last < active_nr; last++) {
const char *path = active_cache[last]->name;
- if (strncmp(path, src, length)
- || path[length] != '/')
+ if (strncmp(path, src_w_slash, len_w_slash))
break;
}
+ free((char *)src_w_slash);
if (last - first < 1)
bad = "source directory is empty";