Skip to content

Commit 378c7c6

Browse files
committed
Merge branch 'dl/stash-show-untracked-fixup'
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
2 parents 6aae0e2 + af5cd44 commit 378c7c6

File tree

4 files changed

+10
-9
lines changed

4 files changed

+10
-9
lines changed

Documentation/config/stash.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ stash.useBuiltin::
66
remaining users that setting this now does nothing.
77

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

1313
stash.showPatch::
1414
If this is set to true, the `git stash show` command without an

Documentation/git-stash.txt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,10 @@ show [-u|--include-untracked|--only-untracked] [<diff-options>] [<stash>]::
9191
By default, the command shows the diffstat, but it will accept any
9292
format known to 'git diff' (e.g., `git stash show -p stash@{1}`
9393
to view the second most recent entry in patch form).
94-
You can use stash.showIncludeUntracked, stash.showStat, and
95-
stash.showPatch config variables to change the default behavior.
94+
If no `<diff-option>` is provided, the default behavior will be given
95+
by the `stash.showStat`, and `stash.showPatch` config variables. You
96+
can also use `stash.showIncludeUntracked` to set whether
97+
`--include-untracked` is enabled by default.
9698

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

builtin/stash.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,7 @@ static int show_stash(int argc, const char **argv, const char *prefix)
833833
UNTRACKED_NONE,
834834
UNTRACKED_INCLUDE,
835835
UNTRACKED_ONLY
836-
} show_untracked = UNTRACKED_NONE;
836+
} show_untracked = show_include_untracked ? UNTRACKED_INCLUDE : UNTRACKED_NONE;
837837
struct option options[] = {
838838
OPT_SET_INT('u', "include-untracked", &show_untracked,
839839
N_("include untracked files in the stash"),
@@ -876,9 +876,6 @@ static int show_stash(int argc, const char **argv, const char *prefix)
876876
if (show_patch)
877877
rev.diffopt.output_format |= DIFF_FORMAT_PATCH;
878878

879-
if (show_include_untracked)
880-
show_untracked = UNTRACKED_INCLUDE;
881-
882879
if (!show_stat && !show_patch) {
883880
free_stash_info(&info);
884881
return 0;

t/t3905-stash-include-untracked.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -333,6 +333,8 @@ test_expect_success 'stash show --include-untracked shows untracked files' '
333333
git stash show -p --include-untracked >actual &&
334334
test_cmp expect actual &&
335335
git stash show --include-untracked -p >actual &&
336+
test_cmp expect actual &&
337+
git -c stash.showIncludeUntracked=true stash show -p >actual &&
336338
test_cmp expect actual
337339
'
338340

0 commit comments

Comments
 (0)