Subject: Re: [PATCH] Add a test for "git stash branch"

From: Junio C Hamano <[email-masked]>
Date: Sun, 06 Jul 2008 12:53:02 -0700

Abhijit Menon-Sen <[email-masked]> writes:

> At 2008-07-06 14:54:44 +0200, [email-masked] wrote:
>>
>> AFAICS the previous version is in 'next' already: 
>> 656b50345239293929ad8c639c5f1941c6b867ad
>
> Oh, I see, thanks. I misunderstood the request. Here's a separate patch
> to just add the test.

Oh, there is no misunderstanding.  You couldn't have possibly known if the
main body of the patch will go to 'next' or just be dropped when I said
"you might also want to have tests" to you.

> +test_expect_success 'stash apply' '
> +	echo foo > file &&
> +	git commit file -m first
> +	echo bar > file &&
> +	git stash &&
> +	echo baz > file &&
> +	git commit file -m second &&
> +	git stash branch stashbranch &&
> +	git commit file -m alternate\ second &&
> +	git diff master..stashbranch > output &&
> +	test_cmp output expect &&
> +	test 0 = $(git stash list | wc -l)
> +'

The title is probably not 'stash apply' but 'stash branch'.  Don't you
want to also validate that:

 - "stash branch" command switched to the new branch "stashbranch"?

 - before making "alternate second", the index and the working tree have
   expected contents?  and

 - the final shape of the history looks correctly forked (i.e.
   "stashbranch" branches at the commit before "-m second" commit was
   made)?

>  test_done
> -- 
> 1.5.6