diff mbox series

[3/3,Outreachy] stash: use set_fallback_ident() function

Message ID 20181101120239.15636-1-slawica92@hotmail.com (mailing list archive)
State New, archived
Headers show
Series make stash work if user.name and user.email are not configured | expand

Commit Message

Slavica Djukic Nov. 1, 2018, 12:02 p.m. UTC
Call set_fallback_ident() in cmd_stash() and update test
from the first commit to expect success.

Executing stash without user.name and user.email configured
can be useful when bots or similar users use stash, without anyone
specifing valid ident. Use case would be automated testing.
There are also users who  find this convinient.
For example, in this thread:
user points out that he would find it useful if stash had --author option.

Signed-off-by: Slavica Djukic <slawica92@hotmail.com>
 builtin/stash.c  | 1 +
 t/t3903-stash.sh | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
diff mbox series


diff --git a/builtin/stash.c b/builtin/stash.c
index 965e938ebd..add30aae64 100644
--- a/builtin/stash.c
+++ b/builtin/stash.c
@@ -1523,6 +1523,7 @@  int cmd_stash(int argc, const char **argv, const char *prefix)
+	set_fallback_ident("git stash", "stash@git.commands");
 	git_config(git_default_config, NULL);
 	argc = parse_options(argc, argv, prefix, options, git_stash_usage,
diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index aaff36978e..06a2ffb398 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -1156,7 +1156,7 @@  test_expect_success 'stash -- <subdir> works with binary files' '
 	test_path_is_file subdir/untracked
-test_expect_failure 'stash works when user.name and user.email are not set' '
+test_expect_success 'stash works when user.name and user.email are not set' '
 	git reset &&
 	>1 &&
 	git add 1 &&