mirror of
https://github.com/git/git
synced 2024-08-27 11:39:22 +00:00
Merge branch 'maint-1.6.0' into maint
* maint-1.6.0: builtin-mv.c: check for unversionned files before looking at the destination. Add a testcase for "git mv -f" on untracked files. Missing && in t/t7001.sh.
This commit is contained in:
commit
745bc77604
|
@ -162,7 +162,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
|
|||
}
|
||||
argc += last - first;
|
||||
}
|
||||
} else if (lstat(dst, &st) == 0) {
|
||||
} else if (cache_name_pos(src, length) < 0)
|
||||
bad = "not under version control";
|
||||
else if (lstat(dst, &st) == 0) {
|
||||
bad = "destination exists";
|
||||
if (force) {
|
||||
/*
|
||||
|
@ -177,9 +179,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
|
|||
} else
|
||||
bad = "Cannot overwrite";
|
||||
}
|
||||
} else if (cache_name_pos(src, length) < 0)
|
||||
bad = "not under version control";
|
||||
else if (string_list_has_string(&src_for_dst, dst))
|
||||
} else if (string_list_has_string(&src_for_dst, dst))
|
||||
bad = "multiple sources for the same target";
|
||||
else
|
||||
string_list_insert(dst, &src_for_dst);
|
||||
|
|
|
@ -55,9 +55,17 @@ test_expect_success \
|
|||
git mv -k untracked1 untracked2 path0 &&
|
||||
test -f untracked1 &&
|
||||
test -f untracked2 &&
|
||||
test ! -f path0/untracked1
|
||||
test ! -f path0/untracked1 &&
|
||||
test ! -f path0/untracked2'
|
||||
|
||||
test_expect_success \
|
||||
'checking -f on untracked file with existing target' \
|
||||
'touch path0/untracked1 &&
|
||||
git mv -f untracked1 path0
|
||||
test ! -f .git/index.lock &&
|
||||
test -f untracked1 &&
|
||||
test -f path0/untracked1'
|
||||
|
||||
# clean up the mess in case bad things happen
|
||||
rm -f idontexist untracked1 untracked2 \
|
||||
path0/idontexist path0/untracked1 path0/untracked2 \
|
||||
|
|
Loading…
Reference in a new issue