{"thread":{"id":"46629","subject":"[PATCH 1/3] stash: add test for stash create with no files","startedAt":"2017-08-19T20:13:45Z","lastAt":"2017-08-19T21:08:03Z","messageCount":6,"participants":["Joel Teichroeb","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":3},"messages":[{"id":"326783","messageId":"20170819201326.6872-1-joel@teichroeb.net","threadId":"46629","inReplyTo":null,"subject":"[PATCH 1/3] stash: add test for stash create with no files","fromName":"Joel Teichroeb","fromEmail":"joel@teichroeb.net","sentAt":"2017-08-19T20:13:24Z","receivedAt":"2017-08-19T20:13:45Z","isPatch":true,"sender":{"key":"joel@teichroeb.net","avatar":"https://avatars.githubusercontent.com/u/240865?v=4"},"body":"Ensure the command suceeds and outputs nothing\n\nSigned-off-by: Joel Teichroeb <joel@teichroeb.net>\n---\n t/t3903-stash.sh | 8 ++++++++\n 1 file changed, 8 insertions(+)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 4046817d70..f0708ced27 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -444,6 +444,14 @@ test_expect_failure 'stash file to directory' '\n \ttest foo = \"$(cat file/file)\"\n '\n \n+test_expect_success 'stash create - no changes' '\n+\tgit stash clear &&\n+\ttest_when_finished \"git reset --hard HEAD\" &&\n+\tgit reset --hard &&\n+\tgit stash create >actual &&\n+\ttest_must_be_empty actual\n+'\n+\n 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-- \n2.14.1\n\n"},{"id":"326784","messageId":"20170819201326.6872-2-joel@teichroeb.net","threadId":"46629","inReplyTo":"20170819201326.6872-1-joel@teichroeb.net","subject":"[PATCH 2/3] stash: Add a test for when apply fails during stash branch","fromName":"Joel Teichroeb","fromEmail":"joel@teichroeb.net","sentAt":"2017-08-19T20:13:25Z","receivedAt":"2017-08-19T20:13:47Z","isPatch":true,"sender":{"key":"joel@teichroeb.net","avatar":"https://avatars.githubusercontent.com/u/240865?v=4"},"body":"If the return value of merge recursive is not checked, the stash could end\nup being dropped even though it was not applied properly\n\nSigned-off-by: Joel Teichroeb <joel@teichroeb.net>\n---\n t/t3903-stash.sh | 14 ++++++++++++++\n 1 file changed, 14 insertions(+)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex f0708ced27..887010c497 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -656,6 +656,20 @@ 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+\tgit stash clear &&\n+\tgit reset HEAD~1 --hard &&\n+\techo foo >file &&\n+\tgit add file &&\n+\tgit commit -m initial &&\n+\techo bar >file &&\n+\tgit stash &&\n+\techo baz >file &&\n+\ttest_when_finished \"git checkout master\" &&\n+\ttest_must_fail git stash branch new_branch stash@{0} &&\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 \tgit stash clear &&\n \techo 1 >subdir/subfile1 &&\n-- \n2.14.1\n\n"},{"id":"326785","messageId":"20170819201326.6872-3-joel@teichroeb.net","threadId":"46629","inReplyTo":"20170819201326.6872-1-joel@teichroeb.net","subject":"[PATCH 3/3] stash: add test for stashing in a detached state","fromName":"Joel Teichroeb","fromEmail":"joel@teichroeb.net","sentAt":"2017-08-19T20:13:26Z","receivedAt":"2017-08-19T20:13:49Z","isPatch":true,"sender":{"key":"joel@teichroeb.net","avatar":"https://avatars.githubusercontent.com/u/240865?v=4"},"body":"All that we are really testing here is that the message is\ncorrect when we are not on any branch. All other functionality is\nalready tested elsewhere.\n\nSigned-off-by: Joel Teichroeb <joel@teichroeb.net>\n---\n t/t3903-stash.sh | 12 ++++++++++++\n 1 file changed, 12 insertions(+)\n\ndiff --git a/t/t3903-stash.sh b/t/t3903-stash.sh\nindex 887010c497..3b1ac1971a 100755\n--- a/t/t3903-stash.sh\n+++ b/t/t3903-stash.sh\n@@ -822,6 +822,18 @@ test_expect_success 'create with multiple arguments for the message' '\n \ttest_cmp expect actual\n '\n \n+test_expect_success 'create in a detached state' '\n+\ttest_when_finished \"git checkout master\" &&\n+\tgit checkout HEAD~1 &&\n+\t>foo &&\n+\tgit add foo &&\n+\tSTASH_ID=$(git stash create) &&\n+\tHEAD_ID=$(git rev-parse --short HEAD) &&\n+\techo \"WIP on (no branch): ${HEAD_ID} initial\" >expect &&\n+\tgit show --pretty=%s -s ${STASH_ID} >actual &&\n+\ttest_cmp expect actual\n+'\n+\n test_expect_success 'stash -- <pathspec> stashes and restores the file' '\n \t>foo &&\n \t>bar &&\n-- \n2.14.1\n\n"},{"id":"326789","messageId":"xmqqpobr8ego.fsf@gitster.mtv.corp.google.com","threadId":"46629","inReplyTo":"20170819201326.6872-1-joel@teichroeb.net","subject":"Re: [PATCH 1/3] stash: add test for stash create with no files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-19T20:55:35Z","receivedAt":"2017-08-19T20:55:49Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I see three patches that add tests, but it is hard to judge them\nwithout any explanation on what the point of them are.\n\nAre you documenting an existing breakage?  Are you extending test\ncoverage for some breakage we recently fixed without adding tests to\nensure that the fix will stay unbroken?  Are you planning to touch\nthe implementation (perhaps to add yet another feature that uses\nsome existing code) and adding new tests in advance to avoid breaking\nthe existing code?  Some other motivation?\n\nThese would have made fine material to write in the cover letter for\nthis series.\n\nThanks.\n"},{"id":"326791","messageId":"CA+CzEk98Tg_jyteZp7SGTchDNjP8FZFvHNXfvisg1XGgsT0vvg@mail.gmail.com","threadId":"46629","inReplyTo":"xmqqpobr8ego.fsf@gitster.mtv.corp.google.com","subject":"Re: [PATCH 1/3] stash: add test for stash create with no files","fromName":"Joel Teichroeb","fromEmail":"joel@teichroeb.net","sentAt":"2017-08-19T21:00:36Z","receivedAt":"2017-08-19T21:01:01Z","isPatch":true,"sender":{"key":"joel@teichroeb.net","avatar":"https://avatars.githubusercontent.com/u/240865?v=4"},"body":"Hi Junio,\n\nI was just too lazy to write a cover letter, and thought these would\nmake sense on their own. I'll make sure to include a cover letter next\ntime.\n\nI just ripped them out of my patch series on implementing stash as a\nbuiltin[1]. Since I haven't had time, I figured I could at least get\nthe additional tests I wrote into the codebase.\n\nThe tests mainly expand coverage of git stash, covering a few critical\nerror cases that didn't have tests.\n\n[1] https://public-inbox.org/git/20170608005535.13080-1-joel@teichroeb.net/\n\nOn Sat, Aug 19, 2017 at 1:55 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> I see three patches that add tests, but it is hard to judge them\n> without any explanation on what the point of them are.\n>\n> Are you documenting an existing breakage?  Are you extending test\n> coverage for some breakage we recently fixed without adding tests to\n> ensure that the fix will stay unbroken?  Are you planning to touch\n> the implementation (perhaps to add yet another feature that uses\n> some existing code) and adding new tests in advance to avoid breaking\n> the existing code?  Some other motivation?\n>\n> These would have made fine material to write in the cover letter for\n> this series.\n>\n> Thanks.\n"},{"id":"326792","messageId":"xmqqh8x38dwb.fsf@gitster.mtv.corp.google.com","threadId":"46629","inReplyTo":"CA+CzEk98Tg_jyteZp7SGTchDNjP8FZFvHNXfvisg1XGgsT0vvg@mail.gmail.com","subject":"Re: [PATCH 1/3] stash: add test for stash create with no files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2017-08-19T21:07:48Z","receivedAt":"2017-08-19T21:08:03Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Joel Teichroeb <joel@teichroeb.net> writes:\n\n> On Sat, Aug 19, 2017 at 1:55 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>\n>> Are you documenting an existing breakage?  Are you extending test\n>> coverage for some breakage we recently fixed without adding tests to\n>> ensure that the fix will stay unbroken?  Are you planning to touch\n>> the implementation (perhaps to add yet another feature that uses\n>> some existing code) and adding new tests in advance to avoid breaking\n>> the existing code?  Some other motivation?\n>>\n>\n> I was just too lazy to write a cover letter, and thought these would\n> make sense on their own. I'll make sure to include a cover letter next\n> time.\n>\n> I just ripped them out of my patch series on implementing stash as a\n> builtin[1]. Since I haven't had time, I figured I could at least get\n> the additional tests I wrote into the codebase.\n\nOK, so it is the third one among my random 4 choices ;-)  \n\nThey do look sensible; I did not want to make sure they are not\nduplicates myself (i.e. a new test that makes sense may not be an\nundesired addition if the only effect it has is to eat more cycles\nwithout improving test coverage).\n\nWill queue.  Thanks.\n\n> The tests mainly expand coverage of git stash, covering a few critical\n> error cases that didn't have tests.\n>\n> [1] https://public-inbox.org/git/20170608005535.13080-1-joel@teichroeb.net/\n>\n"}]}