public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Matthieu Moy <Matthieu.Moy@grenoble-inp•fr>
To: Sundararajan R <dyoucme@gmail•com>
Cc: git@vger•kernel.org, Junio C Hamano <gitster@pobox•com>,
	Eric Sunshine <sunshine@sunshineco•com>
Subject: Re: [v3 PATCH 2/2] reset: add tests for git reset -
Date: Wed, 18 Mar 2015 17:54:16 +0100	[thread overview]
Message-ID: <vpqh9ticklj.fsf@anie.imag.fr> (raw)
In-Reply-To: <1426667709-26698-1-git-send-email-dyoucme@gmail.com> (Sundararajan R.'s message of "Wed, 18 Mar 2015 14:05:09 +0530")

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:

> +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.

> +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/

  reply	other threads:[~2015-03-18 16:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-18  8:35 [v3 PATCH 2/2] reset: add tests for git reset - Sundararajan R
2015-03-18 16:54 ` Matthieu Moy [this message]
2015-03-19 22:16 ` Kevin D
     [not found]   ` <CAPV5_7+Kfuiy01cmwfjJCGJPo7mO_bzBc7DjPr9JyuV=XSXSrA@mail.gmail.com>
2015-03-20 20:32     ` Kevin D

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=vpqh9ticklj.fsf@anie.imag.fr \
    --to=matthieu.moy@grenoble-inp$(echo .)fr \
    --cc=dyoucme@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=sunshine@sunshineco$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox