All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael J Gruber <git@drmicha.warpmail.net>
To: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [JFF] "-" and "@{-1}" on various programs
Date: Wed, 11 Mar 2015 13:38:47 +0100	[thread overview]
Message-ID: <55003757.8090004@drmicha.warpmail.net> (raw)
In-Reply-To: <xmqqy4n4zjst.fsf@gitster.dls.corp.google.com>

Junio C Hamano venit, vidit, dixit 10.03.2015 21:20:
> JFF stands for just for fun.
> 
> This is not meant to give out a model answer and is known to be
> incomplete, but I was wondering if it would be a better direction to
> allow "-" as a stand-in for "@{-1}" everywhere we allow a branch
> name, losing workarounds at the surface level we have for checkout,
> merge and revert.
> 
> The first three paths are to remove the surface workarounds that
> become unnecessary.  The one in sha1_name.c is the central change.
> 
> The change in revision.c is to allow a single "-" to be recognized
> as a potential revision name (without this change, what begins with
> "-" is either an option or an unknown option).
> 
> So you could do things like "git reset - $path" but also things like
> "git log -" after switching out of a branch.
> 
> What does not work are what needs further tweaking in revision.c
> parser.  "git checkout master && git checkout next && git log -.."
> should show what next has on top of master but I didn't touch the
> range notation so it does not work, for example.
> 
>  builtin/checkout.c |  3 ---
>  builtin/merge.c    |  3 +--
>  builtin/revert.c   |  2 --
>  revision.c         |  2 +-
>  sha1_name.c        | 57 +++++++++++++++++++++++++++++++++---------------------
>  5 files changed, 37 insertions(+), 30 deletions(-)

Like it :)

It removes the special casing and makes a shorthand available
systematically. I'd say it's useful even without extending it to ranges.

Michae

  reply	other threads:[~2015-03-11 12:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-10 20:20 [JFF] "-" and "@{-1}" on various programs Junio C Hamano
2015-03-11 12:38 ` Michael J Gruber [this message]
2015-03-11 20:16   ` 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=55003757.8090004@drmicha.warpmail.net \
    --to=git@drmicha.warpmail.net \
    --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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.