summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorLibravatar Denton Liu <liu.denton@gmail.com>2021-03-03 03:16:42 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-03-05 14:31:26 -0800
commitd3c7bf73bdb679dd98c6aff65edbce4df743ddd3 (patch)
tree7e4757674006ff07cfe29906afdc6bb8f0ec8aea /contrib
parentstash: declare ref_stash as an array (diff)
downloadtgif-d3c7bf73bdb679dd98c6aff65edbce4df743ddd3.tar.xz
stash show: teach --include-untracked and --only-untracked
Stash entries can be made with untracked files via `git stash push --include-untracked`. However, because the untracked files are stored in the third parent of the stash entry and not the stash entry itself, running `git stash show` does not include the untracked files as part of the diff. With --include-untracked, untracked paths, which are recorded in the third-parent if it exists, are shown in addition to the paths that have modifications between the stash base and the working tree in the stash. It is possible to manually craft a malformed stash entry where duplicate untracked files in the stash entry will mask tracked files. We detect and error out in that case via a custom unpack_trees() callback: stash_worktree_untracked_merge(). Also, teach stash the --only-untracked option which only shows the untracked files of a stash entry. This is similar to `git show stash^3` but it is nice to provide a convenient abstraction for it so that users do not have to think about the underlying implementation. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib')
-rw-r--r--contrib/completion/git-completion.bash2
1 files changed, 1 insertions, 1 deletions
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 4b1f4264a6..64ef6ffa21 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3051,7 +3051,7 @@ _git_stash ()
__gitcomp "--name-status --oneline --patch-with-stat"
;;
show,--*)
- __gitcomp "$__git_diff_common_options"
+ __gitcomp "--include-untracked --only-untracked $__git_diff_common_options"
;;
branch,--*)
;;