summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-07-29 20:50:31 +0700
committerJunio C Hamano <gitster@pobox.com>2014-07-29 13:42:14 -0700
commit548b04d597f9d1f3e221dfdcf18bb844c1e990e9 (patch)
treeaa71830b5e94601442aa3f47d524d7af2337d5f3
parentd7388a77baf2aacd6ac8c1f329e1f81fb7a138ea (diff)
downloadgit-nd/multiple-work-trees-1.tar.gz
checkout --to: do not touch existing target directorynd/multiple-work-trees-1
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--builtin/checkout.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 4fbb9c13a1..3dc416c1e8 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -861,6 +861,8 @@ static int prepare_linked_checkout(const struct checkout_opts *opts,
if (!new->commit)
die(_("no branch specified"));
+ if (file_exists(path))
+ die(_("%s already exists"), path);
len = strlen(path);
while (len && is_dir_sep(path[len - 1]))