Skip to content

Commit

Permalink
Merge branch 'dl/stash-show-untracked-fixup'
Browse files Browse the repository at this point in the history
Another brown paper bag inconsistency fix for a new feature
introduced during this cycle.

* dl/stash-show-untracked-fixup:
  stash show: use stash.showIncludeUntracked even when diff options given
  • Loading branch information
gitster committed May 22, 2021
2 parents 6aae0e2 + af5cd44 commit 378c7c6
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Documentation/config/stash.txt
Expand Up @@ -6,9 +6,9 @@ stash.useBuiltin::
remaining users that setting this now does nothing.

stash.showIncludeUntracked::
If this is set to true, the `git stash show` command without an
option will show the untracked files of a stash entry. Defaults to
false. See description of 'show' command in linkgit:git-stash[1].
If this is set to true, the `git stash show` command will show
the untracked files of a stash entry. Defaults to false. See
description of 'show' command in linkgit:git-stash[1].

stash.showPatch::
If this is set to true, the `git stash show` command without an
Expand Down
6 changes: 4 additions & 2 deletions Documentation/git-stash.txt
Expand Up @@ -91,8 +91,10 @@ show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]::
By default, the command shows the diffstat, but it will accept any
format known to 'git diff' (e.g., `git stash show -p stash@{1}`
to view the second most recent entry in patch form).
You can use stash.showIncludeUntracked, stash.showStat, and
stash.showPatch config variables to change the default behavior.
If no `<diff-option>` is provided, the default behavior will be given
by the `stash.showStat`, and `stash.showPatch` config variables. You
can also use `stash.showIncludeUntracked` to set whether
`--include-untracked` is enabled by default.

pop [--index] [-q|--quiet] [<stash>]::

Expand Down
5 changes: 1 addition & 4 deletions builtin/stash.c
Expand Up @@ -833,7 +833,7 @@ static int show_stash(int argc, const char **argv, const char *prefix)
UNTRACKED_NONE,
UNTRACKED_INCLUDE,
UNTRACKED_ONLY
} show_untracked = UNTRACKED_NONE;
} show_untracked = show_include_untracked ? UNTRACKED_INCLUDE : UNTRACKED_NONE;
struct option options[] = {
OPT_SET_INT('u', "include-untracked", &show_untracked,
N_("include untracked files in the stash"),
Expand Down Expand Up @@ -876,9 +876,6 @@ static int show_stash(int argc, const char **argv, const char *prefix)
if (show_patch)
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;

if (show_include_untracked)
show_untracked = UNTRACKED_INCLUDE;

if (!show_stat && !show_patch) {
free_stash_info(&info);
return 0;
Expand Down
2 changes: 2 additions & 0 deletions t/t3905-stash-include-untracked.sh
Expand Up @@ -333,6 +333,8 @@ test_expect_success 'stash show --include-untracked shows untracked files' '
git stash show -p --include-untracked >actual &&
test_cmp expect actual &&
git stash show --include-untracked -p >actual &&
test_cmp expect actual &&
git -c stash.showIncludeUntracked=true stash show -p >actual &&
test_cmp expect actual
'

Expand Down

0 comments on commit 378c7c6

Please sign in to comment.