{"thread":{"id":"49423","subject":"[GSoC][PATCH v9 02/21] stash: improve option parsing test coverage","startedAt":"2018-09-25T22:34:24Z","lastAt":"2018-09-25T22:34:52Z","messageCount":5,"participants":["Paul-Sebastian Ungureanu"],"isPatch":true,"patchVersion":9,"patchTotal":21},"messages":[{"id":"358886","messageId":"42423f6af38dd9029c7f7fe870593efbeabe3f1c.1537911869.git.ungureanupaulsebastian@gmail.com","threadId":"49423","inReplyTo":"cover.1537911869.git.ungureanupaulsebastian@gmail.com","subject":"[GSoC][PATCH v9 02/21] stash: improve option parsing test coverage","fromName":"Paul-Sebastian Ungureanu","fromEmail":"ungureanupaulsebastian@gmail.com","sentAt":"2018-09-25T22:33:13Z","receivedAt":"2018-09-25T22:34:24Z","isPatch":true,"sender":{"key":"ungureanupaulsebastian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/24317622?v=4"},"body":"From: Joel Teichroeb <joel@teichroeb.net>\n\nIn preparation for converting the stash command incrementally to\na builtin command, this patch improves test coverage of the option\nparsing. Both for having too many parameters, or too few.\n\nSigned-off-by: Joel Teichroeb <joel@teichroeb.net>\nSigned-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>\n---\n t/t3903-stash.sh | 35 +++++++++++++++++++++++++++++++++++\n 1 file changed, 35 insertions(+)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 1f871d3cca..af7586d43d 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -444,6 +444,36 @@ test_expect_failure 'stash file to directory' '\n \ttest foo = \"$(cat file/file)\"\n '\n \n+test_expect_success 'giving too many ref arguments does not modify files' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\techo foo >file2 &&\n+\tgit stash &&\n+\techo bar >file2 &&\n+\tgit stash &&\n+\ttest-tool chmtime =123456789 file2 &&\n+\tfor type in apply pop \"branch stash-branch\"\n+\tdo\n+\t\ttest_must_fail git stash $type stash@{0} stash@{1} 2>err &&\n+\t\ttest_i18ngrep \"Too many revisions\" err &&\n+\t\ttest 123456789 = $(test-tool chmtime -g file2) || return 1\n+\tdone\n+'\n+\n+test_expect_success 'drop: too many arguments errors out (does nothing)' '\n+\tgit stash list >expect &&\n+\ttest_must_fail git stash drop stash@{0} stash@{1} 2>err &&\n+\ttest_i18ngrep \"Too many revisions\" err &&\n+\tgit stash list >actual &&\n+\ttest_cmp expect actual\n+'\n+\n+test_expect_success 'show: too many arguments errors out (does nothing)' '\n+\ttest_must_fail git stash show stash@{0} stash@{1} 2>err 1>out &&\n+\ttest_i18ngrep \"Too many revisions\" err &&\n+\ttest_must_be_empty out\n+'\n+\n test_expect_success 'stash create - no changes' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD\" &&\n@@ -479,6 +509,11 @@ test_expect_success 'stash branch - stashes on stack, stash-like argument' '\n \ttest $(git ls-files --modified | wc -l) -eq 1\n '\n \n+test_expect_success 'stash branch complains with no arguments' '\n+\ttest_must_fail git stash branch 2>err &&\n+\ttest_i18ngrep \"No branch name specified\" err\n+'\n+\n test_expect_success 'stash show format defaults to --stat' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD\" &&\n-- \n2.19.0.rc0.23.g1c0a08a5d3\n\n"},{"id":"358889","messageId":"2e7eef95b626721bac48d072aa0869452fe4297a.1537911869.git.ungureanupaulsebastian@gmail.com","threadId":"49423","inReplyTo":"cover.1537911869.git.ungureanupaulsebastian@gmail.com","subject":"[GSoC][PATCH v9 03/21] stash: update test cases conform to coding guidelines","fromName":"Paul-Sebastian Ungureanu","fromEmail":"ungureanupaulsebastian@gmail.com","sentAt":"2018-09-25T22:33:16Z","receivedAt":"2018-09-25T22:34:28Z","isPatch":true,"sender":{"key":"ungureanupaulsebastian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/24317622?v=4"},"body":"Removed whitespaces after redirection operators.\n\nSigned-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>\n---\n t/t3903-stash.sh | 120 ++++++++++++++++++++++++-----------------------\n 1 file changed, 61 insertions(+), 59 deletions(-)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex af7586d43d..de6cab1fe7 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -8,22 +8,22 @@ test_description='Test git stash'\n . ./test-lib.sh\n \n test_expect_success 'stash some dirty working directory' '\n-\techo 1 > file &&\n+\techo 1 >file &&\n \tgit add file &&\n \techo unrelated >other-file &&\n \tgit add other-file &&\n \ttest_tick &&\n \tgit commit -m initial &&\n-\techo 2 > file &&\n+\techo 2 >file &&\n \tgit add file &&\n-\techo 3 > file &&\n+\techo 3 >file &&\n \ttest_tick &&\n \tgit stash &&\n \tgit diff-files --quiet &&\n \tgit diff-index --cached --quiet HEAD\n '\n \n-cat > expect << EOF\n+cat >expect <<EOF\n diff --git a/file b/file\n index 0cfbf08..00750ed 100644\n --- a/file\n@@ -35,7 +35,7 @@ EOF\n \n test_expect_success 'parents of stash' '\n \ttest $(git rev-parse stash^) = $(git rev-parse HEAD) &&\n-\tgit diff stash^2..stash > output &&\n+\tgit diff stash^2..stash >output &&\n \ttest_cmp output expect\n '\n \n@@ -74,7 +74,7 @@ test_expect_success 'apply stashed changes' '\n \n test_expect_success 'apply stashed changes (including index)' '\n \tgit reset --hard HEAD^ &&\n-\techo 6 > other-file &&\n+\techo 6 >other-file &&\n \tgit add other-file &&\n \ttest_tick &&\n \tgit commit -m other-file &&\n@@ -99,12 +99,12 @@ test_expect_success 'stash drop complains of extra options' '\n \n test_expect_success 'drop top stash' '\n \tgit reset --hard &&\n-\tgit stash list > stashlist1 &&\n-\techo 7 > file &&\n+\tgit stash list >expected &&\n+\techo 7 >file &&\n \tgit stash &&\n \tgit stash drop &&\n-\tgit stash list > stashlist2 &&\n-\ttest_cmp stashlist1 stashlist2 &&\n+\tgit stash list >actual &&\n+\ttest_cmp expected actual &&\n \tgit stash apply &&\n \ttest 3 = $(cat file) &&\n \ttest 1 = $(git show :file) &&\n@@ -113,9 +113,9 @@ test_expect_success 'drop top stash' '\n \n test_expect_success 'drop middle stash' '\n \tgit reset --hard &&\n-\techo 8 > file &&\n+\techo 8 >file &&\n \tgit stash &&\n-\techo 9 > file &&\n+\techo 9 >file &&\n \tgit stash &&\n \tgit stash drop stash@{1} &&\n \ttest 2 = $(git stash list | wc -l) &&\n@@ -160,7 +160,7 @@ test_expect_success 'stash pop' '\n \ttest 0 = $(git stash list | wc -l)\n '\n \n-cat > expect << EOF\n+cat >expect <<EOF\n diff --git a/file2 b/file2\n new file mode 100644\n index 0000000..1fe912c\n@@ -170,7 +170,7 @@ index 0000000..1fe912c\n +bar2\n EOF\n \n-cat > expect1 << EOF\n+cat >expect1 <<EOF\n diff --git a/file b/file\n index 257cc56..5716ca5 100644\n --- a/file\n@@ -180,7 +180,7 @@ index 257cc56..5716ca5 100644\n +bar\n EOF\n \n-cat > expect2 << EOF\n+cat >expect2 <<EOF\n diff --git a/file b/file\n index 7601807..5716ca5 100644\n --- a/file\n@@ -198,79 +198,79 @@ index 0000000..1fe912c\n EOF\n \n test_expect_success 'stash branch' '\n-\techo foo > file &&\n+\techo foo >file &&\n \tgit commit file -m first &&\n-\techo bar > file &&\n-\techo bar2 > file2 &&\n+\techo bar >file &&\n+\techo bar2 >file2 &&\n \tgit add file2 &&\n \tgit stash &&\n-\techo baz > file &&\n+\techo baz >file &&\n \tgit commit file -m second &&\n \tgit stash branch stashbranch &&\n \ttest refs/heads/stashbranch = $(git symbolic-ref HEAD) &&\n \ttest $(git rev-parse HEAD) = $(git rev-parse master^) &&\n-\tgit diff --cached > output &&\n+\tgit diff --cached >output &&\n \ttest_cmp output expect &&\n-\tgit diff > output &&\n+\tgit diff >output &&\n \ttest_cmp output expect1 &&\n \tgit add file &&\n \tgit commit -m alternate\\ second &&\n-\tgit diff master..stashbranch > output &&\n+\tgit diff master..stashbranch >output &&\n \ttest_cmp output expect2 &&\n \ttest 0 = $(git stash list | wc -l)\n '\n \n test_expect_success 'apply -q is quiet' '\n-\techo foo > file &&\n+\techo foo >file &&\n \tgit stash &&\n-\tgit stash apply -q > output.out 2>&1 &&\n+\tgit stash apply -q >output.out 2>&1 &&\n \ttest_must_be_empty output.out\n '\n \n test_expect_success 'save -q is quiet' '\n-\tgit stash save --quiet > output.out 2>&1 &&\n+\tgit stash save --quiet >output.out 2>&1 &&\n \ttest_must_be_empty output.out\n '\n \n test_expect_success 'pop -q is quiet' '\n-\tgit stash pop -q > output.out 2>&1 &&\n+\tgit stash pop -q >output.out 2>&1 &&\n \ttest_must_be_empty output.out\n '\n \n test_expect_success 'pop -q --index works and is quiet' '\n-\techo foo > file &&\n+\techo foo >file &&\n \tgit add file &&\n \tgit stash save --quiet &&\n-\tgit stash pop -q --index > output.out 2>&1 &&\n+\tgit stash pop -q --index >output.out 2>&1 &&\n \ttest foo = \"$(git show :file)\" &&\n \ttest_must_be_empty output.out\n '\n \n test_expect_success 'drop -q is quiet' '\n \tgit stash &&\n-\tgit stash drop -q > output.out 2>&1 &&\n+\tgit stash drop -q >output.out 2>&1 &&\n \ttest_must_be_empty output.out\n '\n \n test_expect_success 'stash -k' '\n-\techo bar3 > file &&\n-\techo bar4 > file2 &&\n+\techo bar3 >file &&\n+\techo bar4 >file2 &&\n \tgit add file2 &&\n \tgit stash -k &&\n \ttest bar,bar4 = $(cat file),$(cat file2)\n '\n \n test_expect_success 'stash --no-keep-index' '\n-\techo bar33 > file &&\n-\techo bar44 > file2 &&\n+\techo bar33 >file &&\n+\techo bar44 >file2 &&\n \tgit add file2 &&\n \tgit stash --no-keep-index &&\n \ttest bar,bar2 = $(cat file),$(cat file2)\n '\n \n test_expect_success 'stash --invalid-option' '\n-\techo bar5 > file &&\n-\techo bar6 > file2 &&\n+\techo bar5 >file &&\n+\techo bar6 >file2 &&\n \tgit add file2 &&\n \ttest_must_fail git stash --invalid-option &&\n \ttest_must_fail git stash save --invalid-option &&\n@@ -486,11 +486,12 @@ test_expect_success 'stash branch - no stashes on stack, stash-like argument' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit reset --hard &&\n-\techo foo >> file &&\n+\techo foo >>file &&\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \tgit stash branch stash-branch ${STASH_ID} &&\n-\ttest_when_finished \"git reset --hard HEAD && git checkout master && git branch -D stash-branch\" &&\n+\ttest_when_finished \"git reset --hard HEAD && git checkout master &&\n+\tgit branch -D stash-branch\" &&\n \ttest $(git ls-files --modified | wc -l) -eq 1\n '\n \n@@ -498,14 +499,15 @@ test_expect_success 'stash branch - stashes on stack, stash-like argument' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit reset --hard &&\n-\techo foo >> file &&\n+\techo foo >>file &&\n \tgit stash &&\n \ttest_when_finished \"git stash drop\" &&\n-\techo bar >> file &&\n+\techo bar >>file &&\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \tgit stash branch stash-branch ${STASH_ID} &&\n-\ttest_when_finished \"git reset --hard HEAD && git checkout master && git branch -D stash-branch\" &&\n+\ttest_when_finished \"git reset --hard HEAD && git checkout master &&\n+\tgit branch -D stash-branch\" &&\n \ttest $(git ls-files --modified | wc -l) -eq 1\n '\n \n@@ -518,10 +520,10 @@ test_expect_success 'stash show format defaults to --stat' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit reset --hard &&\n-\techo foo >> file &&\n+\techo foo >>file &&\n \tgit stash &&\n \ttest_when_finished \"git stash drop\" &&\n-\techo bar >> file &&\n+\techo bar >>file &&\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \tcat >expected <<-EOF &&\n@@ -536,10 +538,10 @@ test_expect_success 'stash show - stashes on stack, stash-like argument' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit reset --hard &&\n-\techo foo >> file &&\n+\techo foo >>file &&\n \tgit stash &&\n \ttest_when_finished \"git stash drop\" &&\n-\techo bar >> file &&\n+\techo bar >>file &&\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \techo \"1\t0\tfile\" >expected &&\n@@ -551,10 +553,10 @@ test_expect_success 'stash show -p - stashes on stack, stash-like argument' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit reset --hard &&\n-\techo foo >> file &&\n+\techo foo >>file &&\n \tgit stash &&\n \ttest_when_finished \"git stash drop\" &&\n-\techo bar >> file &&\n+\techo bar >>file &&\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \tcat >expected <<-EOF &&\n@@ -574,7 +576,7 @@ test_expect_success 'stash show - no stashes on stack, stash-like argument' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit reset --hard &&\n-\techo foo >> file &&\n+\techo foo >>file &&\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \techo \"1\t0\tfile\" >expected &&\n@@ -586,7 +588,7 @@ test_expect_success 'stash show -p - no stashes on stack, stash-like argument' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD\" &&\n \tgit reset --hard &&\n-\techo foo >> file &&\n+\techo foo >>file &&\n \tSTASH_ID=$(git stash create) &&\n \tgit reset --hard &&\n \tcat >expected <<-EOF &&\n@@ -606,9 +608,9 @@ test_expect_success 'stash drop - fail early if specified stash is not a stash r\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD && git stash clear\" &&\n \tgit reset --hard &&\n-\techo foo > file &&\n+\techo foo >file &&\n \tgit stash &&\n-\techo bar > file &&\n+\techo bar >file &&\n \tgit stash &&\n \ttest_must_fail git stash drop $(git rev-parse stash@{0}) &&\n \tgit stash pop &&\n@@ -620,9 +622,9 @@ test_expect_success 'stash pop - fail early if specified stash is not a stash re\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD && git stash clear\" &&\n \tgit reset --hard &&\n-\techo foo > file &&\n+\techo foo >file &&\n \tgit stash &&\n-\techo bar > file &&\n+\techo bar >file &&\n \tgit stash &&\n \ttest_must_fail git stash pop $(git rev-parse stash@{0}) &&\n \tgit stash pop &&\n@@ -632,8 +634,8 @@ test_expect_success 'stash pop - fail early if specified stash is not a stash re\n \n test_expect_success 'ref with non-existent reflog' '\n \tgit stash clear &&\n-\techo bar5 > file &&\n-\techo bar6 > file2 &&\n+\techo bar5 >file &&\n+\techo bar6 >file2 &&\n \tgit add file2 &&\n \tgit stash &&\n \ttest_must_fail git rev-parse --quiet --verify does-not-exist &&\n@@ -653,8 +655,8 @@ test_expect_success 'ref with non-existent reflog' '\n test_expect_success 'invalid ref of the form stash@{n}, n >= N' '\n \tgit stash clear &&\n \ttest_must_fail git stash drop stash@{0} &&\n-\techo bar5 > file &&\n-\techo bar6 > file2 &&\n+\techo bar5 >file &&\n+\techo bar6 >file2 &&\n \tgit add file2 &&\n \tgit stash &&\n \ttest_must_fail git stash drop stash@{1} &&\n@@ -724,7 +726,7 @@ test_expect_success 'stash apply shows status same as git status (relative to cu\n \ttest_i18ncmp expect actual\n '\n \n-cat > expect << EOF\n+cat >expect <<EOF\n diff --git a/HEAD b/HEAD\n new file mode 100644\n index 0000000..fe0cbee\n@@ -737,14 +739,14 @@ EOF\n test_expect_success 'stash where working directory contains \"HEAD\" file' '\n \tgit stash clear &&\n \tgit reset --hard &&\n-\techo file-not-a-ref > HEAD &&\n+\techo file-not-a-ref >HEAD &&\n \tgit add HEAD &&\n \ttest_tick &&\n \tgit stash &&\n \tgit diff-files --quiet &&\n \tgit diff-index --cached --quiet HEAD &&\n \ttest \"$(git rev-parse stash^)\" = \"$(git rev-parse HEAD)\" &&\n-\tgit diff stash^..stash > output &&\n+\tgit diff stash^..stash >output &&\n \ttest_cmp output expect\n '\n \n-- \n2.19.0.rc0.23.g1c0a08a5d3\n\n"},{"id":"358890","messageId":"41fa6cc1a9df062ee35a0fdd20ff53b46ace1719.1537911869.git.ungureanupaulsebastian@gmail.com","threadId":"49423","inReplyTo":"cover.1537911869.git.ungureanupaulsebastian@gmail.com","subject":"[GSoC][PATCH v9 04/21] stash: rename test cases to be more descriptive","fromName":"Paul-Sebastian Ungureanu","fromEmail":"ungureanupaulsebastian@gmail.com","sentAt":"2018-09-25T22:33:17Z","receivedAt":"2018-09-25T22:34:29Z","isPatch":true,"sender":{"key":"ungureanupaulsebastian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/24317622?v=4"},"body":"Rename some test cases' labels to be more descriptive and under 80\ncharacters per line.\n\nSigned-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>\n---\n t/t3903-stash.sh | 14 +++++++-------\n 1 file changed, 7 insertions(+), 7 deletions(-)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex de6cab1fe7..3114c7bc4c 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -604,7 +604,7 @@ test_expect_success 'stash show -p - no stashes on stack, stash-like argument' '\n \ttest_cmp expected actual\n '\n \n-test_expect_success 'stash drop - fail early if specified stash is not a stash reference' '\n+test_expect_success 'drop: fail early if specified stash is not a stash ref' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD && git stash clear\" &&\n \tgit reset --hard &&\n@@ -618,7 +618,7 @@ test_expect_success 'stash drop - fail early if specified stash is not a stash r\n \tgit reset --hard HEAD\n '\n \n-test_expect_success 'stash pop - fail early if specified stash is not a stash reference' '\n+test_expect_success 'pop: fail early if specified stash is not a stash ref' '\n \tgit stash clear &&\n \ttest_when_finished \"git reset --hard HEAD && git stash clear\" &&\n \tgit reset --hard &&\n@@ -682,7 +682,7 @@ test_expect_success 'invalid ref of the form \"n\", n >= N' '\n \tgit stash drop\n '\n \n-test_expect_success 'stash branch should not drop the stash if the branch exists' '\n+test_expect_success 'branch: do not drop the stash if the branch exists' '\n \tgit stash clear &&\n \techo foo >file &&\n \tgit add file &&\n@@ -693,7 +693,7 @@ test_expect_success 'stash branch should not drop the stash if the branch exists\n \tgit rev-parse stash@{0} --\n '\n \n-test_expect_success 'stash branch should not drop the stash if the apply fails' '\n+test_expect_success 'branch: should not drop the stash if the apply fails' '\n \tgit stash clear &&\n \tgit reset HEAD~1 --hard &&\n \techo foo >file &&\n@@ -707,7 +707,7 @@ test_expect_success 'stash branch should not drop the stash if the apply fails'\n \tgit rev-parse stash@{0} --\n '\n \n-test_expect_success 'stash apply shows status same as git status (relative to current directory)' '\n+test_expect_success 'apply: show same status as git status (relative to ./)' '\n \tgit stash clear &&\n \techo 1 >subdir/subfile1 &&\n \techo 2 >subdir/subfile2 &&\n@@ -1048,7 +1048,7 @@ test_expect_success 'stash push -p with pathspec shows no changes only once' '\n \ttest_i18ncmp expect actual\n '\n \n-test_expect_success 'stash push with pathspec shows no changes when there are none' '\n+test_expect_success 'push <pathspec>: show no changes when there are none' '\n \t>foo &&\n \tgit add foo &&\n \tgit commit -m \"tmp\" &&\n@@ -1058,7 +1058,7 @@ test_expect_success 'stash push with pathspec shows no changes when there are no\n \ttest_i18ncmp expect actual\n '\n \n-test_expect_success 'stash push with pathspec not in the repository errors out' '\n+test_expect_success 'push: <pathspec> not in the repository errors out' '\n \t>untracked &&\n \ttest_must_fail git stash push untracked &&\n \ttest_path_is_file untracked\n-- \n2.19.0.rc0.23.g1c0a08a5d3\n\n"},{"id":"358894","messageId":"ab5bb135401ed4aff45ec95cbcda79c12961a84a.1537911869.git.ungureanupaulsebastian@gmail.com","threadId":"49423","inReplyTo":"cover.1537911869.git.ungureanupaulsebastian@gmail.com","subject":"[GSoC][PATCH v9 06/21] strbuf.c: add `strbuf_join_argv()`","fromName":"Paul-Sebastian Ungureanu","fromEmail":"ungureanupaulsebastian@gmail.com","sentAt":"2018-09-25T22:33:22Z","receivedAt":"2018-09-25T22:34:33Z","isPatch":true,"sender":{"key":"ungureanupaulsebastian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/24317622?v=4"},"body":"Implement `strbuf_join_argv()` to join arguments.\n\nSigned-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>\n---\n strbuf.c | 15 +++++++++++++++\n strbuf.h |  7 +++++++\n 2 files changed, 22 insertions(+)\n\ndiff --git a/strbuf.c b/strbuf.c\nindex 64041c3c24..3eb431b2b0 100644\n--- a/strbuf.c\n+++ b/strbuf.c\n@@ -259,6 +259,21 @@ void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2)\n \tstrbuf_setlen(sb, sb->len + sb2->len);\n }\n \n+const char *strbuf_join_argv(struct strbuf *buf,\n+\t\t\t     int argc, const char **argv, char delim)\n+{\n+\tif (!argc)\n+\t\treturn buf->buf;\n+\n+\tstrbuf_addstr(buf, *argv);\n+\twhile (--argc) {\n+\t\tstrbuf_addch(buf, delim);\n+\t\tstrbuf_addstr(buf, *(++argv));\n+\t}\n+\n+\treturn buf->buf;\n+}\n+\n void strbuf_addchars(struct strbuf *sb, int c, size_t n)\n {\n \tstrbuf_grow(sb, n);\ndiff --git a/strbuf.h b/strbuf.h\nindex 60a35aef16..7ed859bb8a 100644\n--- a/strbuf.h\n+++ b/strbuf.h\n@@ -284,6 +284,13 @@ static inline void strbuf_addstr(struct strbuf *sb, const char *s)\n  */\n extern void strbuf_addbuf(struct strbuf *sb, const struct strbuf *sb2);\n \n+\n+/**\n+ *\n+ */\n+extern const char *strbuf_join_argv(struct strbuf *buf, int argc,\n+\t\t\t\t    const char **argv, char delim);\n+\n /**\n  * This function can be used to expand a format string containing\n  * placeholders. To that end, it parses the string and calls the specified\n-- \n2.19.0.rc0.23.g1c0a08a5d3\n\n"},{"id":"358909","messageId":"fb89d3dfa8ab6a4d1be2aa0e2df6dea5d0d58f43.1537911869.git.ungureanupaulsebastian@gmail.com","threadId":"49423","inReplyTo":"cover.1537911869.git.ungureanupaulsebastian@gmail.com","subject":"[GSoC][PATCH v9 05/21] stash: add tests for `git stash show` config","fromName":"Paul-Sebastian Ungureanu","fromEmail":"ungureanupaulsebastian@gmail.com","sentAt":"2018-09-25T22:33:19Z","receivedAt":"2018-09-25T22:34:52Z","isPatch":true,"sender":{"key":"ungureanupaulsebastian@gmail.com","avatar":"https://avatars.githubusercontent.com/u/24317622?v=4"},"body":"This commit introduces tests for `git stash show`\nconfig. It tests all the cases where `stash.showStat`\nand `stash.showPatch` are unset or set to true / false.\n\nSigned-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>\n---\n t/t3907-stash-show-config.sh | 83 ++++++++++++++++++++++++++++++++++++\n 1 file changed, 83 insertions(+)\n create mode 100755 t/t3907-stash-show-config.sh\n\ndiff --git a/t/t3907-stash-show-config.sh b/t/t3907-stash-show-config.sh\nnew file mode 100755\nindex 0000000000..10914bba7b\n--- /dev/null\n+++ b/t/t3907-stash-show-config.sh\n@@ -0,0 +1,83 @@\n+#!/bin/sh\n+\n+test_description='Test git stash show configuration.'\n+\n+. ./test-lib.sh\n+\n+test_expect_success 'setup' '\n+\ttest_commit file\n+'\n+\n+# takes three parameters:\n+# 1. the stash.showStat value (or \"<unset>\")\n+# 2. the stash.showPatch value (or \"<unset>\")\n+# 3. the diff options of the expected output (or nothing for no output)\n+test_stat_and_patch () {\n+\tif test \"<unset>\" = \"$1\"\n+\tthen\n+\t\ttest_unconfig stash.showStat\n+\telse\n+\t\ttest_config stash.showStat \"$1\"\n+\tfi &&\n+\n+\tif test \"<unset>\" = \"$2\"\n+\tthen\n+\t\ttest_unconfig stash.showPatch\n+\telse\n+\t\ttest_config stash.showPatch \"$2\"\n+\tfi &&\n+\n+\tshift 2 &&\n+\techo 2 >file.t &&\n+\tif test $# != 0\n+\tthen\n+\t\tgit diff \"$@\" >expect\n+\tfi &&\n+\tgit stash &&\n+\tgit stash show >actual &&\n+\n+\tif test $# = 0\n+\tthen\n+\t\ttest_must_be_empty actual\n+\telse\n+\t\ttest_cmp expect actual\n+\tfi\n+}\n+\n+test_expect_success 'showStat unset showPatch unset' '\n+\ttest_stat_and_patch \"<unset>\" \"<unset>\" --stat\n+'\n+\n+test_expect_success 'showStat unset showPatch false' '\n+\ttest_stat_and_patch \"<unset>\" false --stat\n+'\n+\n+test_expect_success 'showStat unset showPatch true' '\n+\ttest_stat_and_patch \"<unset>\" true --stat -p\n+'\n+\n+test_expect_success 'showStat false showPatch unset' '\n+\ttest_stat_and_patch false \"<unset>\"\n+'\n+\n+test_expect_success 'showStat false showPatch false' '\n+\ttest_stat_and_patch false false\n+'\n+\n+test_expect_success 'showStat false showPatch true' '\n+\ttest_stat_and_patch false true -p\n+'\n+\n+test_expect_success 'showStat true showPatch unset' '\n+\ttest_stat_and_patch true \"<unset>\" --stat\n+'\n+\n+test_expect_success 'showStat true showPatch false' '\n+\ttest_stat_and_patch true false --stat\n+'\n+\n+test_expect_success 'showStat true showPatch true' '\n+\ttest_stat_and_patch true true --stat -p\n+'\n+\n+test_done\n-- \n2.19.0.rc0.23.g1c0a08a5d3\n\n"}]}