From: "Philip Oakley" <philipoakley@iee.org>
To: "Stephen P. Smith" <ischis2@cox.net>,
"Git Mailing List" <git@vger.kernel.org>
Cc: "Ovidiu Gheorghioiu" <ovidiug@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"Stephen P. Smith" <ischis2@cox.net>
Subject: Re: [PATCH] wt-status.c: set commitable bit if there is a meaningful merge.
Date: Tue, 16 Feb 2016 08:20:43 -0000 [thread overview]
Message-ID: <C8BDC3289C184F40BFBE3B150CFBB50B@PhilipOakley> (raw)
In-Reply-To: 1455590305-30923-1-git-send-email-ischis2@cox.net
From: "Stephen P. Smith" <ischis2@cox.net>
> The 'commit --dry-run' and commit return values differed if a
Should this have quotes around the second 'commit' as they both refer to the
command, rather than the action?
> conflicted merge had been resolved and the commit would be the same as
> the parent.
>
> Update show_merge_in_progress to set the commitable bit if conflicts
> have been resolved and a merge is in progress.
>
> Signed-off-by: Stephen P. Smith <ischis2@cox.net>
> ---
>
> Notes:
> In the original report when the dry run switch was passed and after
> the merge commit was resolved head and index matched leading to a
> returned value of 1. [1]
>
> If the dry run switch was not passed, the commit would succeed to
> correctly record the resolution.
>
> The result was that a dry run would report that there would be a
> failure, but there really isn't a failure if the commit is actually
> attemped.
>
> [1] $gmane/276591
>
> It appeared that the conditional for 'Reject an attempt to record a
> non-merge empty commit without * explicit --allow-empty.' could be
> simplified after adding this patch.
>
> This change can't be propagated to the conditional because it allows
> a commit that was previously disallowed.
>
> t/t7501-commit.sh | 20 ++++++++++++++++++++
> wt-status.c | 1 +
> 2 files changed, 21 insertions(+)
>
> diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
> index 63e0427..363abb1 100755
> --- a/t/t7501-commit.sh
> +++ b/t/t7501-commit.sh
> @@ -587,4 +587,24 @@ test_expect_success '--only works on to-be-born
> branch' '
> test_cmp expected actual
> '
>
> +test_expect_success '--dry-run with conflicts fixed from a merge' '
> + # setup two branches with conflicting information
> + # in the same file, resolve the conflict,
> + # call commit with --dry-run
> + echo "Initial contents, unimportant" >test-file &&
> + git add test-file &&
> + git commit -m "Initial commit" &&
> + echo "commit-1-state" >test-file &&
> + git commit -m "commit 1" -i test-file &&
> + git tag commit-1 &&
> + git checkout -b branch-2 HEAD^1 &&
> + echo "commit-2-state" >test-file &&
> + git commit -m "commit 2" -i test-file &&
> + ! $(git merge --no-commit commit-1) &&
> + echo "commit-2-state" >test-file &&
> + git add test-file &&
> + git commit --dry-run &&
> + git commit -m "conflicts fixed from merge."
> +'
> +
> test_done
> diff --git a/wt-status.c b/wt-status.c
> index ab4f80d..1374b48 100644
> --- a/wt-status.c
> +++ b/wt-status.c
> @@ -950,6 +950,7 @@ static void show_merge_in_progress(struct wt_status
> *s,
> status_printf_ln(s, color,
> _(" (fix conflicts and run \"git commit\")"));
> } else {
> + s-> commitable = 1;
> status_printf_ln(s, color,
> _("All conflicts fixed but you are still merging."));
> if (s->hints)
> --
> 2.7.0.GIT
>
> --
Philip
next prev parent reply other threads:[~2016-02-16 8:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1649296.sC1eN3ni6k@thunderbird>
2016-02-09 1:55 ` Bug report: 'git commit --dry-run' corner case: returns error ("nothing to commit") when all conflicts resolved to HEAD Stephen & Linda Smith
2016-02-16 2:38 ` [PATCH] wt-status.c: set commitable bit if there is a meaningful merge Stephen P. Smith
2016-02-16 8:20 ` Philip Oakley [this message]
2016-02-16 21:54 ` Junio C Hamano
2016-02-16 23:26 ` Stephen & Linda Smith
2016-02-16 23:40 ` Stephen & Linda Smith
2016-02-16 23:30 ` Stephen & Linda Smith
2016-02-17 3:33 ` Junio C Hamano
2016-02-17 5:06 ` [PATCH v2] " Stephen P. Smith
2016-02-17 4:58 ` [PATCH] " Stephen & Linda Smith
2016-05-10 4:51 ` Stephen & Linda Smith
2018-08-22 5:33 ` Stephen Smith
2018-08-22 15:39 ` Junio C Hamano
2018-08-22 15:54 ` Junio C Hamano
2018-08-23 1:28 ` Stephen & Linda Smith
2016-02-12 1:04 ` Bug report: 'git commit --dry-run' corner case: returns error ("nothing to commit") when all conflicts resolved to HEAD Stephen & Linda Smith
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=C8BDC3289C184F40BFBE3B150CFBB50B@PhilipOakley \
--to=philipoakley@iee.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=ischis2@cox.net \
--cc=ovidiug@gmail.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).