From: Junio C Hamano <gitster@pobox.com>
To: Eric Sunshine <sunshine@sunshineco.com>
Cc: Benoit Pierre <benoit.pierre@gmail.com>, Git List <git@vger.kernel.org>
Subject: Re: [PATCH 3/7] test patch hunk editing with "commit -p -m"
Date: Tue, 11 Mar 2014 11:13:50 -0700 [thread overview]
Message-ID: <xmqqbnxcr4bl.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAPig+cQoUW5dqSzs-wAVOD1xrbSzuzGoHCDKdmgT_BprngMbvQ@mail.gmail.com> (Eric Sunshine's message of "Mon, 10 Mar 2014 16:20:59 -0400")
Eric Sunshine <sunshine@sunshineco.com> writes:
> On Mon, Mar 10, 2014 at 2:49 PM, Benoit Pierre <benoit.pierre@gmail.com> wrote:
>> Add (failing) test: with commit changing the environment to let hooks
>> now that no editor will be used (by setting GIT_EDITOR to ":"), the
>> "edit hunk" functionality does not work (no editor is launched and the
>> whole hunk is committed).
>>
>> Signed-off-by: Benoit Pierre <benoit.pierre@gmail.com>
>> ---
>> t/t7513-commit_-p_-m_hunk_edit.sh | 34 ++++++++++++++++++++++++++++++++++
>> 1 file changed, 34 insertions(+)
>> create mode 100755 t/t7513-commit_-p_-m_hunk_edit.sh
>
> Is it possible to give this file a name less unusual and more
> consistent with other test scripts? Perhaps choose a more generic name
> which may allow other similar tests to be added to the file in the
> future (if needed)?
Surely. There are "reset-patch" and "checkout-patch" tests, and if
we were to add something like this, I'd imagine "commit-patch" would
be a logical name for the new test.
>> diff --git a/t/t7513-commit_-p_-m_hunk_edit.sh b/t/t7513-commit_-p_-m_hunk_edit.sh
>> new file mode 100755
>> index 0000000..994939a
>> --- /dev/null
>> +++ b/t/t7513-commit_-p_-m_hunk_edit.sh
>> @@ -0,0 +1,34 @@
>> +#!/bin/sh
>> +
>> +test_description='hunk edit with "commit -p -m"'
>> +. ./test-lib.sh
>> +
>> +if ! test_have_prereq PERL
>> +then
>> + skip_all="skipping '$test_description' tests, perl not available"
>> + test_done
>> +fi
>> +
>> +test_expect_success 'setup (initial)' '
>> + echo line1 >file &&
>> + git add file &&
>> + git commit -m commit1 &&
>> + echo line3 >>file &&
>> + cat >expect <<-\EOF
>> + diff --git a/file b/file
>> + index a29bdeb..c0d0fb4 100644
>> + --- a/file
>> + +++ b/file
>> + @@ -1 +1,2 @@
>> + line1
>> + +line2
>> + EOF
>
> In the previous review, the suggestion was that creation of 'expect'
> should be moved to the test below where it is actually used rather
> than into the 'setup' phase above.
>
>> +'
>> +
>> +test_expect_failure 'edit hunk "commit -p -m message"' '
>> + echo e | env GIT_EDITOR="sed s/+line3\$/+line2/ -i" git commit -p -m commit2 file &&
>> + git diff HEAD^ HEAD >actual &&
>> + test_cmp expect actual
>> +'
>> +
>> +test_done
>> --
>> 1.9.0
next prev parent reply other threads:[~2014-03-11 18:13 UTC|newest]
Thread overview: 50+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-10 18:49 [PATCH V2 0/7] fix hunk editing with 'commit -p -m' Benoit Pierre
2014-03-10 18:49 ` [PATCH 1/7] merge hook tests: fix missing '&&' in test Benoit Pierre
2014-03-10 18:49 ` [PATCH 2/7] merge hook tests: use 'test_must_fail' instead of '!' Benoit Pierre
2014-03-10 18:49 ` [PATCH 3/7] test patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-10 20:20 ` Eric Sunshine
2014-03-11 18:13 ` Junio C Hamano [this message]
2014-03-10 20:30 ` Philip Oakley
2014-03-11 21:03 ` Junio C Hamano
2014-03-15 12:28 ` Torsten Bögershausen
2014-03-15 16:11 ` Benoit Pierre
2014-03-15 21:00 ` Torsten Bögershausen
2014-03-15 21:42 ` [PATCH 1/7] merge hook tests: fix missing '&&' in test Benoit Pierre
2014-03-15 21:42 ` [PATCH 2/7] merge hook tests: use 'test_must_fail' instead of '!' Benoit Pierre
2014-03-15 21:42 ` [PATCH 3/7] test patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-17 18:49 ` Junio C Hamano
2014-03-17 19:46 ` Benoit Pierre
2014-03-17 19:51 ` Eric Sunshine
2014-03-17 19:53 ` Benoit Pierre
2014-03-17 21:33 ` Junio C Hamano
2014-03-17 18:53 ` Junio C Hamano
2014-03-17 19:52 ` Benoit Pierre
2014-03-17 21:35 ` Junio C Hamano
2014-03-18 10:00 ` [PATCH 1/7] merge hook tests: fix missing '&&' in test Benoit Pierre
2014-03-18 10:00 ` [PATCH 2/7] merge hook tests: use 'test_must_fail' instead of '!' Benoit Pierre
2014-03-18 10:00 ` [PATCH 3/7] test patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-18 10:00 ` [PATCH 4/7] commit: fix " Benoit Pierre
2014-03-19 7:32 ` Torsten Bögershausen
2014-03-19 17:19 ` Junio C Hamano
2014-03-18 10:00 ` [PATCH 5/7] merge: fix GIT_EDITOR override for commit hook Benoit Pierre
2014-03-18 10:00 ` [PATCH 6/7] merge hook tests: fix and update tests Benoit Pierre
2014-03-18 10:00 ` [PATCH 7/7] run-command: mark run_hook_with_custom_index as deprecated Benoit Pierre
2014-03-18 18:27 ` [PATCH 1/7] merge hook tests: fix missing '&&' in test Junio C Hamano
2014-03-15 21:42 ` [PATCH 4/7] commit: fix patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-15 21:42 ` [PATCH 5/7] merge: fix GIT_EDITOR override for commit hook Benoit Pierre
2014-03-15 21:42 ` [PATCH 6/7] merge hook tests: fix and update tests Benoit Pierre
2014-03-15 21:42 ` [PATCH 7/7] run-command: mark run_hook_with_custom_index as deprecated Benoit Pierre
2014-03-10 18:49 ` [PATCH 4/7] commit: fix patch hunk editing with "commit -p -m" Benoit Pierre
2014-03-10 20:07 ` Jeff King
2014-03-11 0:45 ` Jun Hao
2014-03-11 17:56 ` Benoit Pierre
2014-03-11 18:00 ` Jeff King
2014-03-11 18:40 ` [PATCH 4/7] commit: fix patch hunk editing with Jun Hao
2014-03-11 21:02 ` [PATCH 4/7] commit: fix patch hunk editing with "commit -p -m" Junio C Hamano
2014-03-10 18:49 ` [PATCH 5/7] merge: fix GIT_EDITOR override for commit hook Benoit Pierre
2014-03-10 18:49 ` [PATCH 6/7] merge hook tests: fix and update tests Benoit Pierre
2014-03-10 20:27 ` Eric Sunshine
2014-03-10 18:49 ` [PATCH 7/7] run-command: mark run_hook_with_custom_index as deprecated Benoit Pierre
2014-03-11 1:00 ` brian m. carlson
2014-03-11 17:37 ` Benoit Pierre
2014-04-03 22:11 ` [PATCH V2 0/7] fix hunk editing with 'commit -p -m' Jonathan Nieder
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqqbnxcr4bl.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox.com \
--cc=benoit.pierre@gmail.com \
--cc=git@vger.kernel.org \
--cc=sunshine@sunshineco.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).