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

Re: [PATCH] refuse to merge during a merge

From
CPConstantine Plotnikov <constantine.plotnikov@gmail.com>
Date
May 28, 2009, 16:00 UTC
Message-ID
<85647ef50905280900v274d87ag8d364ea7bd9a97ee@mail.gmail.com>
In-Reply-To
<20090527210410.GA14742@localhost>

MERGE_HEAD file could also happen in case of --no-commit option. In that case there might be no conflict and the message would look confusing to the user. I suggest to change a message to "You are in the middle of a uncommitted or conflicted merge." or something like it.

Regards, Constantine

On Thu, May 28, 2009 at 1:04 AM, Clemens Buchacher <drizzd@aon.at> wrote:
Show 39 quoted lines
> The following is an easy mistake to make for users coming from version
> control systems with an "update and commit"-style workflow.
>
>        1. git merge
>        2. resolve conflicts
>        3. git pull, instead of commit
>
> This overrides MERGE_HEAD, starting a new merge with dirty index. IOW,
> probably not what the user intented. Instead, refuse to merge again if a
> merge is in progress.
>
> Reported-by: Dave Olszewski <cxreg@pobox.com>
> Signed-off-by: Clemens Buchacher <drizzd@aon.at>
> ---
>
>  builtin-merge.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/builtin-merge.c b/builtin-merge.c
> index 0b58e5e..74a8c8f 100644
> --- a/builtin-merge.c
> +++ b/builtin-merge.c
> @@ -836,7 +836,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
>        struct commit_list **remotes = &remoteheads;
>
>        setup_work_tree();
> -       if (read_cache_unmerged())
> +       if (read_cache_unmerged() || file_exists(git_path("MERGE_HEAD")))
>                die("You are in the middle of a conflicted merge.");
>
>        /*
> --
> 1.6.3.1.147.g637c3
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>
Previous: Clemens BuchacherNext: John Tapsell
Message 2 of 11 in “refuse to merge during a merge”
  1. refuse to merge during a mergeClemens Buchacher, May 27, 2009
  2. Constantine PlotnikovMay 28, 2009
  3. John TapsellMay 28, 2009
  4. Clemens BuchacherMay 30, 2009
  5. Jakub NarebskiMay 30, 2009
  6. Thomas RastMay 30, 2009
  7. refuse to merge during a mergeClemens Buchacher, May 31, 2009
  8. John TapsellMay 31, 2009
  9. Clemens BuchacherMay 31, 2009
  10. Junio C HamanoMay 31, 2009
  11. refuse to merge during a mergeClemens Buchacher, Jun 1, 2009

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.