public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Jeff King <peff@peff•net>
To: Christian Couder <christian.couder@gmail•com>
Cc: Charles Rudolph <charles.w.rudolph@gmail•com>, git <git@vger•kernel.org>
Subject: Re: Additional plumbing commands
Date: Wed, 7 Jan 2015 03:04:09 -0500	[thread overview]
Message-ID: <20150107080408.GA1301@peff.net> (raw)
In-Reply-To: <CAP8UFD1OZ1QjHRyNGVs0Vm52=Ue-ta1gBzNxLpX25NSCbtu9EQ@mail.gmail.com>

On Tue, Jan 06, 2015 at 06:37:34PM +0100, Christian Couder wrote:

> On Tue, Jan 6, 2015 at 5:05 PM, Charles Rudolph
> <charles.w.rudolph@gmail•com> wrote:
> > I am writing some higher level git commands for
> > https://github.com/Originate/git-town and would like some additional
> > plumbing commands that can tell me
> >
> > 1. is there a merge in progress?
> > 2. is there a rebase in progress?
> > 3. is there a cherry-pick in progress?
> > 4. are there unmerged paths?
> >
> > Currently the only way I know how to do this is with "git status" and
> > looking for specific text.
> 
> You may have a look at how "contrib/completion/git-prompt.sh" does it.
> [...]

The prompt code is rather long and knows a lot about the internal state
of $GIT_DIR. I do not think it would be a bad thing for git-status to
expose a machine-readable version of the state it discovers, and then at
least we can keep the logic in one place.

Charles, if you are interested in adding that, the wt_status_state code
in wt-status.c is the right place to start looking.

Though I think in many cases that discovering which state we are in is
only half the story that a caller wants. Knowing what each state _means_
and what operations are meaningful to perform is much trickier (e.g., if
we are in a rebase, you probably do not want to start a new rebase. But
is it wrong to cherry-pick?).

It would be nice if we could find a way to generalize in-progress
operations and what they mean for starting new operations, but that is
a much harder problem (if it is even possible at all).

-Peff

  reply	other threads:[~2015-01-07  8:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-06 16:05 Additional plumbing commands Charles Rudolph
2015-01-06 17:37 ` Christian Couder
2015-01-07  8:04   ` Jeff King [this message]
2015-01-07 16:31     ` 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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150107080408.GA1301@peff.net \
    --to=peff@peff$(echo .)net \
    --cc=charles.w.rudolph@gmail$(echo .)com \
    --cc=christian.couder@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox