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

Re: [PATCH] wt-status.c: set commitable bit if there is a meaningful merge.

From
Philip Oakley <philipoakley@iee.org>
Date
Feb 16, 2016, 06:33 UTC
Message-ID
<C8BDC3289C184F40BFBE3B150CFBB50B@PhilipOakley>
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?

Show 81 quoted lines
> 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 
Previous: Stephen P. SmithNext: Junio C Hamano
Message 3 of 16 in “Re: Bug report: 'git commit --dry-run' corner case: returns error ("nothing to commit") when all conflicts resolved to HEAD”
  1. Stephen & Linda SmithFeb 9, 2016
  2. wt-status.c: set commitable bit if there is a meaningful merge.Stephen P. Smith, Feb 16, 2016
  3. Philip OakleyFeb 16, 2016
  4. Junio C HamanoFeb 16, 2016
  5. Stephen & Linda SmithFeb 16, 2016
  6. Stephen & Linda SmithFeb 16, 2016
  7. Stephen & Linda SmithFeb 16, 2016
  8. Junio C HamanoFeb 17, 2016
  9. wt-status.c: set commitable bit if there is a meaningful merge.Stephen P. Smith, Feb 17, 2016
  10. Stephen & Linda SmithFeb 17, 2016
  11. Stephen & Linda SmithMay 10, 2016
  12. Stephen SmithAug 22, 2018
  13. Junio C HamanoAug 22, 2018
  14. Junio C HamanoAug 22, 2018
  15. Stephen & Linda SmithAug 23, 2018
  16. Stephen & Linda SmithFeb 12, 2016

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.