git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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/
Previous: Sundararajan RNext: Kevin D
Message 2 of 4 in “reset: add tests for git reset -”
  1. 2/2 reset: add tests for git reset -Sundararajan R, Mar 18, 2015
  2. Matthieu MoyMar 18, 2015
  3. Kevin DMar 19, 2015
  4. Kevin DMar 20, 2015

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.