From: Junio C Hamano <gitster@pobox.com>
To: "W. Trevor King" <wking@tremily.us>
Cc: Git <git@vger.kernel.org>, "Łukasz Gryglicki" <lukaszgryglicki@o2.pl>
Subject: Re: [PATCH] pull: pass --signoff/--no-signoff to "git merge"
Date: Thu, 12 Oct 2017 10:17:51 +0900 [thread overview]
Message-ID: <xmqqefq92mgw.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <18953f46ffb5e3dbc4da8fbda7fe3ab4298d7cbd.1507752482.git.wking@tremily.us> (W. Trevor King's message of "Wed, 11 Oct 2017 13:10:47 -0700")
"W. Trevor King" <wking@tremily.us> writes:
> Following 09c2cb87 (pull: pass --allow-unrelated-histories to "git
> merge", 2016-03-18) with the tests also drawing on 14d01b4f (merge:
> add a --signoff flag, 2017-07-04).
I cannot find a verb in the above.
> The order of options in merge-options.txt isn't clear to me, but I've
> put --signoff between --log and --stat as somewhat alphabetized and
> having an "add to the commit message" function like --log.
>
> The tests aren't as extensive as t7614-merge-signoff.sh, but they
> exercises both the --signoff and --no-signoff options. There may be a
> more efficient way to set them up (like t7614-merge-signoff.sh's
> test_setup), but with all the pull options packed into a single test
> script it seemed easiest to just copy/paste the duplicate setup code.
The above two paragraphs read more like "requesting help for hints
to improve this patch" than commit log message. Perhaps move them
below the three-dash line and instead describe what you actually did
here (if they were worth explaining, that is)?
> 09c2cb87 didn't motivate the addition of --allow-unrelated-histories
> to pull; only citing the reason from e379fdf3 (merge: refuse to create
> too cool a merge by default, 2016-03-18) gave for *not* including it.
> I like having both exposed in pull because while the fetch-and-merge
> approach might be a more popular way to judge "how well they fit
> together", you can also do that after an optimistic pull. And in
> cases where an optimistic pull is likely to succeed, suggesting it is
> easier to explain to Git newbies than a FETCH_HEAD merge.
I find this paragraph totally unrelated to what the patch does.
Save it for the patch you add to pass --allow-unrelated-histories
given to pull down to underlying merge, perhaps?
>
> Signed-off-by: W. Trevor King <wking@tremily.us>
> ---
> Documentation/git-merge.txt | 8 --------
> Documentation/merge-options.txt | 10 ++++++++++
> builtin/pull.c | 8 ++++++++
> t/t5521-pull-options.sh | 43 +++++++++++++++++++++++++++++++++++++++++
> 4 files changed, 61 insertions(+), 8 deletions(-)
> ...
> diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
> index ded8f98dbe..d95789ab8c 100755
> --- a/t/t5521-pull-options.sh
> +++ b/t/t5521-pull-options.sh
> @@ -165,4 +165,47 @@ test_expect_success 'git pull --allow-unrelated-histories' '
> )
> '
>
> +test_expect_success 'git pull --signoff add a sign-off line' '
> + test_when_finished "rm -fr src dst actual expected" &&
> + cat >expected <<-EOF &&
> + Signed-off-by: $(git var GIT_COMMITTER_IDENT | sed -e "s/>.*/>/")
> + EOF
echo "Signed-off-by: $GIT_COMMITER_NAME <$GIT_COMMITTER_EMAIL>" >expect
or
git var GIT_COMMITTER_IDENT |
sed -e 's/^\([^>]*>\).*/Signed-off-by: \1/' >expect
> + git init src &&
> + (
> + cd src &&
> + test_commit one
> + ) &&
I suspect somebody will suggest "test_commit -C" ;-)
> + git clone src dst &&
> + (
> + cd src &&
> + test_commit two
> + ) &&
> + (
> + cd dst &&
> + git pull --signoff --no-ff &&
> + git cat-file commit HEAD | tail -n1 >../actual
I think it makes it more robust to replace "tail" with "collect all
the signed-off-by lines" like the other test (below) does. Perhaps
have a helper function and use it in both?
get_signoff () {
git cat-file commit "$1" | sed -n -e '/^Signed-off-by: /p'
}
Some may say "cat-file can fail, and having it on the LHS of a pipe
hides its failure", advocating for something like:
get_signoff () {
git cat-file commit "$1" >sign-off-temp &&
sed -n -e '/^Signed-off-by: /p' sign-off-temp
}
> + ) &&
> + test_cmp expected actual
> +'
> +test_expect_success 'git pull --no-signoff flag cancels --signoff flag' '
> + test_when_finished "rm -fr src dst actual" &&
> + git init src &&
> + (
> + cd src &&
> + test_commit one
> + ) &&
> + git clone src dst &&
> + (
> + cd src &&
> + test_commit two
> + ) &&
> + (
> + cd dst &&
> + git pull --signoff --no-signoff --no-ff &&
> + git cat-file commit HEAD | sed -n /Signed-off-by/p >../actual
> + ) &&
> + test_must_be_empty actual
> +'
> +
> test_done
I think "--signoff" and "--signoff --no-signoff" are reasonable
minimum things to test. Two more cases, i.e. running it without
either and with "--no-signoff" alone, to ensure that the sign-off
mechanism does not kick in would make it even better.
Thanks.
next prev parent reply other threads:[~2017-10-12 1:17 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-11 20:10 [PATCH] pull: pass --signoff/--no-signoff to "git merge" W. Trevor King
2017-10-12 1:17 ` Junio C Hamano [this message]
2017-10-12 5:30 ` W. Trevor King
2017-10-12 5:42 ` Junio C Hamano
2017-10-12 6:23 ` W. Trevor King
2017-10-12 11:08 ` Junio C Hamano
2017-10-12 8:46 ` [PATCH v2] " W. Trevor King
2017-10-12 9:18 ` W. Trevor King
2017-10-12 10:11 ` Junio C Hamano
2017-10-12 18:35 ` [PATCH v3] " W. Trevor King
2017-10-13 1:48 ` Junio C Hamano
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=xmqqefq92mgw.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=lukaszgryglicki@o2.pl \
--cc=wking@tremily.us \
/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).