diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-10-13 15:15:57 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-10-13 15:15:57 -0700 |
commit | a7c2daa06d6f7d8fd13a1d72f23741acbaeba522 (patch) | |
tree | b1b0095d267b98188a7ae24ac77934298b665649 /builtin/stash.c | |
parent | Merge branch 'mt/grep-submodule-textconv' (diff) | |
parent | Documentation: call out commands that nuke untracked files/directories (diff) | |
download | tgif-a7c2daa06d6f7d8fd13a1d72f23741acbaeba522.tar.xz |
Merge branch 'en/removing-untracked-fixes'
Various fixes in code paths that move untracked files away to make room.
* en/removing-untracked-fixes:
Documentation: call out commands that nuke untracked files/directories
Comment important codepaths regarding nuking untracked files/dirs
unpack-trees: avoid nuking untracked dir in way of locally deleted file
unpack-trees: avoid nuking untracked dir in way of unmerged file
Change unpack_trees' 'reset' flag into an enum
Remove ignored files by default when they are in the way
unpack-trees: make dir an internal-only struct
unpack-trees: introduce preserve_ignored to unpack_trees_options
read-tree, merge-recursive: overwrite ignored files by default
checkout, read-tree: fix leak of unpack_trees_options.dir
t2500: add various tests for nuking untracked files
Diffstat (limited to 'builtin/stash.c')
-rw-r--r-- | builtin/stash.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/builtin/stash.c b/builtin/stash.c index 5512f4942c..cc93ace422 100644 --- a/builtin/stash.c +++ b/builtin/stash.c @@ -256,8 +256,10 @@ static int reset_tree(struct object_id *i_tree, int update, int reset) opts.src_index = &the_index; opts.dst_index = &the_index; opts.merge = 1; - opts.reset = reset; + opts.reset = reset ? UNPACK_RESET_PROTECT_UNTRACKED : 0; opts.update = update; + if (update) + opts.preserve_ignored = 0; /* FIXME: !overwrite_ignore */ opts.fn = oneway_merge; if (unpack_trees(nr_trees, t, &opts)) @@ -1533,6 +1535,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q } else { struct child_process cp = CHILD_PROCESS_INIT; cp.git_cmd = 1; + /* BUG: this nukes untracked files in the way */ strvec_pushl(&cp.args, "reset", "--hard", "-q", "--no-recurse-submodules", NULL); if (run_command(&cp)) { |