aboutsummaryrefslogtreecommitdiff
path: root/path.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2014-11-30 15:24:55 +0700
committerJunio C Hamano <gitster@pobox.com>2014-12-01 11:00:18 -0800
commit6cfbdcb2ab70b238fca9b3811f5b58368fd077c6 (patch)
tree103b13703ff6f02ea1dcbfd8d38b4f4672c99932 /path.c
parent77a6d84045c8b558d1e08ff2ffe70347b19be6ef (diff)
downloadgit-6cfbdcb2ab70b238fca9b3811f5b58368fd077c6.tar.gz
git-6cfbdcb2ab70b238fca9b3811f5b58368fd077c6.tar.xz
git_path(): keep "info/sparse-checkout" per work-tree
Currently git_path("info/sparse-checkout") resolves to $GIT_COMMON_DIR/info/sparse-checkout in multiple worktree mode. It makes more sense for the sparse checkout patterns to be per worktree, so you can have multiple checkouts with different parts of the tree. With this, "git checkout --to <new>" on a sparse checkout will create <new> as a full checkout. Which is expected, it's how a new checkout is made. The user can reshape the worktree afterwards. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'path.c')
-rw-r--r--path.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/path.c b/path.c
index cd8e2d6e6..35d498e9b 100644
--- a/path.c
+++ b/path.c
@@ -103,7 +103,8 @@ static void update_common_dir(struct strbuf *buf, int git_dir_len)
char *base = buf->buf + git_dir_len;
const char **p;
- if (is_dir_file(base, "logs", "HEAD"))
+ if (is_dir_file(base, "logs", "HEAD") ||
+ is_dir_file(base, "info", "sparse-checkout"))
return; /* keep this in $GIT_DIR */
for (p = common_list; *p; p++) {
const char *path = *p;