Re: [PATCH v3 2/4] stash: add test for stashing in a detached state

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Joel Teichroeb <joel@xxxxxxxxxxxxx> writes:

> Signed-off-by: Joel Teichroeb <joel@xxxxxxxxxxxxx>
> ---
>  t/t3903-stash.sh | 11 +++++++++++
>  1 file changed, 11 insertions(+)
>
> diff --git a/t/t3903-stash.sh b/t/t3903-stash.sh
> index aaae221304..b86851ef46 100755
> --- a/t/t3903-stash.sh
> +++ b/t/t3903-stash.sh
> @@ -808,6 +808,17 @@ test_expect_success 'create with multiple arguments for the message' '
>  	test_cmp expect actual
>  '
>  
> +test_expect_success 'create in a detached state' '
> +	test_when_finished "git checkout master" &&
> +	git checkout HEAD~1 &&
> +	>foo &&
> +	git add foo &&
> +	STASH_ID=$(git stash create) &&
> +	echo "WIP on (no branch): 47d5e0e initial" >expect &&

Is it easy to generate this (especially 47d5e0e) at runtime?  I know
that earlier tests in this script are brittle and will break when
object names change by using test vectors that hardcode object names
a bit too much, but if we can avoid making it worse, let's try to do
so for future developers who will have to do the work of adjusting
the tests for possible changes to the object name hashing algorithm.

> +	git show --pretty=%s -s ${STASH_ID} >actual &&
> +	test_cmp expect actual
> +'
> +
>  test_expect_success 'stash -- <pathspec> stashes and restores the file' '
>  	>foo &&
>  	>bar &&



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]