[1/3,Outreachy] t3903-stash: test without configured user.name and user.email
diff mbox series

Message ID 20181101115834.19044-1-slawica92@hotmail.com
State New
Headers show
Series
  • make stash work if user.name and user.email are not configured
Related show

Commit Message

Slavica Djukic Nov. 1, 2018, 11:58 a.m. UTC
Add test to assert that stash fails if user.name and user.email
are not configured.
In the final commit, test will be updated to expect success.

Signed-off-by: Slavica Djukic <slawica92@hotmail.com>
---
 t/t3903-stash.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

Christian Couder Nov. 1, 2018, 2:53 p.m. UTC | #1
On Thu, Nov 1, 2018 at 2:31 PM Slavica Djukic
<slavicadj.ip2018@gmail.com> wrote:
>
> Add test to assert that stash fails if user.name and user.email

Nit: I am not sure that "assert" is the right word here.
test_expect_failure() is more for documenting an existing bug than for
really asserting a behavior (that users could rely upon). So I would
replace "assert" with "document" or maybe "document the bug".

> are not configured.
> In the final commit, test will be updated to expect success.

Other nit: maybe use "In a later commit" instead of "In the final
commit" as you, or someone else, may add another commit in this patch
series after the current final one.

> Signed-off-by: Slavica Djukic <slawica92@hotmail.com>

Thanks!

Patch
diff mbox series

diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
index 9e06494ba0..aaff36978e 100755
--- a/t/t3903-stash.sh
+++ b/t/t3903-stash.sh
@@ -1156,4 +1156,19 @@  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' '
+	git reset &&
+	>1 &&
+	git add 1 &&
+	test_config user.useconfigonly true &&
+	test_config stash.usebuiltin true &&
+	sane_unset GIT_AUTHOR_NAME &&
+	sane_unset GIT_AUTHOR_EMAIL &&
+	sane_unset GIT_COMMITTER_NAME &&
+	sane_unset GIT_COMMITTER_EMAIL &&
+	test_unconfig user.email &&
+	test_unconfig user.name &&
+	git stash
+'
+
 test_done