Skip to content

Commit 1b5f373

Browse files
newrengitster
authored andcommitted
Remove ignored files by default when they are in the way
Change several commands to remove ignored files by default when they are in the way. Since some commands (checkout, merge) take a --no-overwrite-ignore option to allow the user to configure this, and it may make sense to add that option to more commands (and in the case of merge, actually plumb that configuration option through to more of the backends than just the fast-forwarding special case), add little comments about where such flags would be used. Incidentally, this fixes a test failure in t7112. Signed-off-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c42e0b6 commit 1b5f373

File tree

9 files changed

+8
-16
lines changed

9 files changed

+8
-16
lines changed

builtin/am.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1920,8 +1920,7 @@ static int fast_forward_to(struct tree *head, struct tree *remote, int reset)
19201920
opts.merge = 1;
19211921
opts.reset = reset;
19221922
if (!reset)
1923-
/* FIXME: Default should be to remove ignored files */
1924-
opts.preserve_ignored = 1;
1923+
opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
19251924
opts.fn = twoway_merge;
19261925
init_tree_desc(&t[0], head->buffer, head->size);
19271926
init_tree_desc(&t[1], remote->buffer, remote->size);

builtin/clone.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -803,8 +803,7 @@ static int checkout(int submodule_progress)
803803
opts.update = 1;
804804
opts.merge = 1;
805805
opts.clone = 1;
806-
/* FIXME: Default should be to remove ignored files */
807-
opts.preserve_ignored = 1;
806+
opts.preserve_ignored = 0;
808807
opts.fn = oneway_merge;
809808
opts.verbose_update = (option_verbosity >= 0);
810809
opts.src_index = &the_index;

builtin/merge.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -681,8 +681,7 @@ static int read_tree_trivial(struct object_id *common, struct object_id *head,
681681
opts.verbose_update = 1;
682682
opts.trivial_merges_only = 1;
683683
opts.merge = 1;
684-
/* FIXME: Default should be to remove ignored files */
685-
opts.preserve_ignored = 1;
684+
opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
686685
trees[nr_trees] = parse_tree_indirect(common);
687686
if (!trees[nr_trees++])
688687
return -1;

builtin/reset.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,7 @@ static int reset_index(const char *ref, const struct object_id *oid, int reset_t
6767
case KEEP:
6868
case MERGE:
6969
opts.update = 1;
70-
/* FIXME: Default should be to remove ignored files */
71-
opts.preserve_ignored = 1;
70+
opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
7271
break;
7372
case HARD:
7473
opts.update = 1;

builtin/stash.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,8 +259,7 @@ static int reset_tree(struct object_id *i_tree, int update, int reset)
259259
opts.reset = reset;
260260
opts.update = update;
261261
if (update && !reset)
262-
/* FIXME: Default should be to remove ignored files */
263-
opts.preserve_ignored = 1;
262+
opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
264263
opts.fn = oneway_merge;
265264

266265
if (unpack_trees(nr_trees, t, &opts))

merge-ort.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4045,7 +4045,7 @@ static int checkout(struct merge_options *opt,
40454045
unpack_opts.quiet = 0; /* FIXME: sequencer might want quiet? */
40464046
unpack_opts.verbose_update = (opt->verbosity > 2);
40474047
unpack_opts.fn = twoway_merge;
4048-
unpack_opts.preserve_ignored = 0; /* FIXME: !opts->overwrite_ignore*/
4048+
unpack_opts.preserve_ignored = 0; /* FIXME: !opts->overwrite_ignore */
40494049
parse_tree(prev);
40504050
init_tree_desc(&trees[0], prev->buffer, prev->size);
40514051
parse_tree(next);

reset.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ int reset_head(struct repository *r, struct object_id *oid, const char *action,
5656
unpack_tree_opts.fn = reset_hard ? oneway_merge : twoway_merge;
5757
unpack_tree_opts.update = 1;
5858
unpack_tree_opts.merge = 1;
59-
/* FIXME: Default should be to remove ignored files */
60-
unpack_tree_opts.preserve_ignored = 1;
59+
unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
6160
init_checkout_metadata(&unpack_tree_opts.meta, switch_to_branch, oid, NULL);
6261
if (!detach_head)
6362
unpack_tree_opts.reset = 1;

sequencer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3690,8 +3690,7 @@ static int do_reset(struct repository *r,
36903690
unpack_tree_opts.fn = oneway_merge;
36913691
unpack_tree_opts.merge = 1;
36923692
unpack_tree_opts.update = 1;
3693-
/* FIXME: Default should be to remove ignored files */
3694-
unpack_tree_opts.preserve_ignored = 1;
3693+
unpack_tree_opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */
36953694
init_checkout_metadata(&unpack_tree_opts.meta, name, &oid, NULL);
36963695

36973696
if (repo_read_index_unmerged(r)) {

t/t7112-reset-submodule.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ test_description='reset can handle submodules'
66
. "$TEST_DIRECTORY"/lib-submodule-update.sh
77

88
KNOWN_FAILURE_DIRECTORY_SUBMODULE_CONFLICTS=1
9-
KNOWN_FAILURE_SUBMODULE_OVERWRITE_IGNORED_UNTRACKED=1
109

1110
test_submodule_switch_recursing_with_args "reset --keep"
1211

0 commit comments

Comments
 (0)