* [PATCH v2] stash: Add stash.showFlag config variable
@ 2015-08-27 15:49 Namhyung Kim
2015-08-27 15:55 ` [PATCH v2.1] " Namhyung Kim
0 siblings, 1 reply; 2+ messages in thread
From: Namhyung Kim @ 2015-08-27 15:49 UTC (permalink / raw)
To: git
Some users might want to see diff (patch) output always rather than
diffstat when [s]he runs 'git stash show'. Although this can be done
with adding -p option, it'd be better to provide a config option to
control this behavior IMHO.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
Documentation/config.txt | 5 +++++
Documentation/git-stash.txt | 1 +
git-stash.sh | 7 ++++++-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index f5d15ff..bbadae6 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2567,6 +2567,11 @@ status.submoduleSummary::
submodule summary' command, which shows a similar output but does
not honor these settings.
+stash.showFlag::
+ The default option to pass to `git stash show` when no option is
+ given. The default is '--stat'. See description of 'show' command
+ in linkgit:git-stash[1].
+
submodule.<name>.path::
submodule.<name>.url::
The path within this project and URL for a submodule. These
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 375213f..e00f67e 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -95,6 +95,7 @@ show [<stash>]::
shows the latest one. 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 stash in patch form).
+ You can use stash.showflag config variable to change this behavior.
pop [--index] [-q|--quiet] [<stash>]::
diff --git a/git-stash.sh b/git-stash.sh
index 1d5ba7a..f48a97d 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -305,7 +305,12 @@ show_stash () {
ALLOW_UNKNOWN_FLAGS=t
assert_stash_like "$@"
- git diff ${FLAGS:---stat} $b_commit $w_commit
+ if test -z "$FLAGS"
+ then
+ show_flag=$(git config --get stash.showFlag || echo "--stat")
+ fi
+
+ git diff ${FLAGS:-${show_flag}} $b_commit $w_commit
}
show_help () {
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH v2.1] stash: Add stash.showFlag config variable
2015-08-27 15:49 [PATCH v2] stash: Add stash.showFlag config variable Namhyung Kim
@ 2015-08-27 15:55 ` Namhyung Kim
0 siblings, 0 replies; 2+ messages in thread
From: Namhyung Kim @ 2015-08-27 15:55 UTC (permalink / raw)
To: git
Some users might want to see diff (patch) output always rather than
diffstat when [s]he runs 'git stash show'. Although this can be done
with adding -p option, it'd be better to provide a config option to
control this behavior IMHO.
Signed-off-by: Namhyung Kim <namhyung@gmail.com>
---
Documentation/config.txt | 5 +++++
Documentation/git-stash.txt | 1 +
git-stash.sh | 7 ++++++-
3 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index f5d15ff..bbadae6 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -2567,6 +2567,11 @@ status.submoduleSummary::
submodule summary' command, which shows a similar output but does
not honor these settings.
+stash.showFlag::
+ The default option to pass to `git stash show` when no option is
+ given. The default is '--stat'. See description of 'show' command
+ in linkgit:git-stash[1].
+
submodule.<name>.path::
submodule.<name>.url::
The path within this project and URL for a submodule. These
diff --git a/Documentation/git-stash.txt b/Documentation/git-stash.txt
index 375213f..e00f67e 100644
--- a/Documentation/git-stash.txt
+++ b/Documentation/git-stash.txt
@@ -95,6 +95,7 @@ show [<stash>]::
shows the latest one. 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 stash in patch form).
+ You can use stash.showflag config variable to change this behavior.
pop [--index] [-q|--quiet] [<stash>]::
diff --git a/git-stash.sh b/git-stash.sh
index 1d5ba7a..992fb02 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -305,7 +305,12 @@ show_stash () {
ALLOW_UNKNOWN_FLAGS=t
assert_stash_like "$@"
- git diff ${FLAGS:---stat} $b_commit $w_commit
+ if test -z "$FLAGS"
+ then
+ FLAGS=$(git config --get stash.showFlag || echo "--stat")
+ fi
+
+ git diff ${FLAGS} $b_commit $w_commit
}
show_help () {
--
2.5.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-08-27 15:58 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-27 15:49 [PATCH v2] stash: Add stash.showFlag config variable Namhyung Kim
2015-08-27 15:55 ` [PATCH v2.1] " Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).