]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'dl/stash-show-untracked-fixup'
authorJunio C Hamano <gitster@pobox.com>
Sat, 22 May 2021 09:29:01 +0000 (18:29 +0900)
committerJunio C Hamano <gitster@pobox.com>
Sat, 22 May 2021 09:29:01 +0000 (18:29 +0900)
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

Documentation/config/stash.txt
Documentation/git-stash.txt
builtin/stash.c
t/t3905-stash-include-untracked.sh

index 413f907cba059dfac0b7d481a652b253b3c588b5..9ed775281fb34f4e7ce0f7277784b7d74164daa1 100644 (file)
@@ -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
index a8c8c32f1e5157cdc7bd543a8882211ebfb1cc14..be6084ccefbee6fba30cc4e9137abbc7da84e749 100644 (file)
@@ -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>]::
 
index 56a33fb83a0a500267aa2806087567227b3cdbcb..01066d708548ab6ca10964e1289aefa25e0aa61f 100644 (file)
@@ -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"),
@@ -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;
index 5bed8fd2fd76efd7c89f09c3cb5b1a31cfc8ece2..dd2cdcc114867ed0810190417c0f2a98ee24a641 100755 (executable)
@@ -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
 '