Re: [v3 PATCH 2/2] reset: add tests for git reset -
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Mar 18, 2015, 16:54 UTC
- Message-ID
- <vpqh9ticklj.fsf@anie.imag.fr>
- In-Reply-To
- <1426667709-26698-1-git-send-email-dyoucme@gmail.com>
Sundararajan R <dyoucme@gmail.com> writes:
> Subject: [v3 PATCH 2/2] reset: add tests for git reset -
This should be [PATCH v3 2/2].
"git send-email -v2" can do this for you.
Sundararajan R <dyoucme@gmail.com> writes:
Show 12 quoted lines
> +test_expect_success 'reset - with no @{-1} branch and file named - should succeed' '
> + test_when_finished rm -rf new &&
> + >expected &&
> + git init new &&
> + (
> + cd new &&
> + echo "Hello" >- &&
> + git add - &&
> + git reset - >../actual
> + ) &&
> + test_cmp expected actual
> +'test_must_be_empty actual would be easier to read than ">expected ... test_cmp expected" IMHO.
Show 19 quoted lines
> +test_expect_success 'reset - with @{-1} branch and no file named - should succeed' '
> + test_when_finished rm -rf new &&
> + git init new &&
> + (
> + cd new &&
> + echo "Hey" >new_file &&
> + git add new_file &&
> + git commit -m "first_commit" &&
> + git checkout -b new_branch &&
> + >new_file &&
> + git add new_file &&
> + git reset - &&
> + git status -uno >actual &&
> + git add new_file &&
> + git reset @{-1} &&
> + git status -uno >expected &&
> + test_cmp actual expected
> + )
> +'Better use "git status --porcelain" here as its format is meant to be stable and unambiguous. The non-porcelain should work two because you're comparing the output on two identical states, but who knows.
With or without my suggested change, the series looks good to me.
-- Matthieu Moy http://www-verimag.imag.fr/~moy/