git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: How to detect if a tree is in status "merge"?
Date: Tue, 10 Dec 2019 10:55:45 +0100	[thread overview]
Message-ID: <20191210105545.66768b7a.olaf@aepfle.de> (raw)
In-Reply-To: <xmqqzhg1tdm9.fsf@gitster-ct.c.googlers.com>

[-- Attachment #1: Type: text/plain, Size: 1303 bytes --]

Am Mon, 09 Dec 2019 13:04:14 -0800
schrieb Junio C Hamano <gitster@pobox.com>:

> Olaf Hering <olaf@aepfle.de> writes:
> > Is there a way to detect (from a script) if the current working tree is in state 'merge'?  
> The first step is to define what "state 'merge'" is, I think.

I do a fresh clone of a remote repository, checkout the target branch,
then merge some other branch into it. Usually the 'git status' command
gives me a list of files. In case it creates some output, 'git commit'
is called. In case there is '^UU' in the output, manual intervention
is required prior commit.

In this case the resolved conflict resulted in no changes. I do remember
a plain 'git status' showed something like 'a merge is going on'.
Apparently there is no easy way to get this state from a git command.
But as you said I may be able to test for existence of files in the
.git directory. I will try to recreate the state to repeat this merge.

> Why are you scripting around "git commit"?  Doesn't "git commit"
> refrain from creating an empty commit when there is nothing to
> commit anyway, unless it is recording a merge whose result happens
> to be a no-op?

'git commit' errors out if there is nothing to commit.
But in this case it would have to create a merge commit.

Olaf

[-- Attachment #2: Digitale Signatur von OpenPGP --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

      reply	other threads:[~2019-12-10 10:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-08 10:55 How to detect if a tree is in status "merge"? Olaf Hering
2019-12-09 21:04 ` Junio C Hamano
2019-12-10  9:55   ` Olaf Hering [this message]

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=20191210105545.66768b7a.olaf@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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).