提交 745bc776 编写于 作者: J Junio C Hamano

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.
......@@ -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 \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册