Skip to content

Commit fc001b5

Browse files
pcloudsgitster
authored andcommitted
checkout,merge: loosen overwriting untracked file check based on info/exclude
Back in 1127148 (Loosen "working file will be lost" check in Porcelain-ish - 2006-12-04), git-checkout.sh learned to quietly overwrite ignored files. Howver the code only took .gitignore files into account. Standard ignored files include all specified in .gitignore files in working directory _and_ $GIT_DIR/info/exclude. This patch makes sure ignored files in info/exclude can also be overwritten automatically in the spirit of the original patch. Signed-off-by: Nguyễn Thái Ngọc Duy <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 87b5054 commit fc001b5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static int merge_working_tree(struct checkout_opts *opts,
401401
topts.fn = twoway_merge;
402402
topts.dir = xcalloc(1, sizeof(*topts.dir));
403403
topts.dir->flags |= DIR_SHOW_IGNORED;
404-
topts.dir->exclude_per_dir = ".gitignore";
404+
setup_standard_excludes(topts.dir);
405405
tree = parse_tree_indirect(old->commit ?
406406
old->commit->object.sha1 :
407407
(unsigned char *)EMPTY_TREE_SHA1_BIN);

builtin/merge.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ int checkout_fast_forward(const unsigned char *head, const unsigned char *remote
708708
memset(&t, 0, sizeof(t));
709709
memset(&dir, 0, sizeof(dir));
710710
dir.flags |= DIR_SHOW_IGNORED;
711-
dir.exclude_per_dir = ".gitignore";
711+
setup_standard_excludes(&dir);
712712
opts.dir = &dir;
713713

714714
opts.head_idx = 1;

0 commit comments

Comments
 (0)