summaryrefslogtreecommitdiff
path: root/builtin/stash.c
diff options
context:
space:
mode:
authorLibravatar Denton Liu <liu.denton@gmail.com>2021-03-03 03:16:43 -0800
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-03-05 14:31:27 -0800
commit0af760e26191acd3c5957841461ff224b80b43f7 (patch)
tree4ac568f916e8965219c52300d0d9f5048a2f3dbe /builtin/stash.c
parentstash show: teach --include-untracked and --only-untracked (diff)
downloadtgif-0af760e26191acd3c5957841461ff224b80b43f7.tar.xz
stash show: learn stash.showIncludeUntracked
The previous commit teaches `git stash show --include-untracked`. It may be desirable for a user to be able to always enable the --include-untracked behavior. Teach the stash.showIncludeUntracked config option which allows users to do this in a similar manner to stash.showPatch. Signed-off-by: Denton Liu <liu.denton@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/stash.c')
-rw-r--r--builtin/stash.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/builtin/stash.c b/builtin/stash.c
index 9b7a541cd0..8922a1240c 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -768,6 +768,7 @@ static int list_stash(int argc, const char **argv, const char *prefix)
static int show_stat = 1;
static int show_patch;
+static int show_include_untracked;
static int use_legacy_stash;
static int git_stash_config(const char *var, const char *value, void *cb)
@@ -780,6 +781,10 @@ static int git_stash_config(const char *var, const char *value, void *cb)
show_patch = git_config_bool(var, value);
return 0;
}
+ if (!strcmp(var, "stash.showincludeuntracked")) {
+ show_include_untracked = git_config_bool(var, value);
+ return 0;
+ }
if (!strcmp(var, "stash.usebuiltin")) {
use_legacy_stash = !git_config_bool(var, value);
return 0;
@@ -869,6 +874,9 @@ 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;