git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Kenny Lee Sin Cheong <kenny.lee28@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH/RFC 1/4] Add "-" as @{-1} support for the rev-parse command
Date: Mon, 30 Mar 2015 12:46:56 -0700	[thread overview]
Message-ID: <xmqqy4mew9n3.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1427737315-7229-2-git-send-email-kenny.lee28@gmail.com> (Kenny Lee Sin Cheong's message of "Mon, 30 Mar 2015 13:41:52 -0400")

Kenny Lee Sin Cheong <kenny.lee28@gmail.com> writes:

> Allows the use of the "-" shorthand notation, including
> use with revision ranges. If we plan to allow "-" as a stand in every
> where a revision is allowed, then "-" would also need to be usable in
> plumbing commands, for writing tests, for example.
>
> Checks if the argument can be interpreted as a revision range first
> before checking for flags. This saves us from having to check that
> something that begins with "-" does not get checked as a possible flag.

Doesn't that mean -<something> that is a valid flag can no longer be
recognised as a flag if the same string can be an extended SHA-1
whose formulation starts from "the previous branch"?  It sounds like
a regression to me.

Hmmm.

After all, "we often call for the previous branch, so let's give a
short-and-sweet '-' as an even shorter short-hand than '@{-1}'" and
"allow '-' anywhere" are two quite different things.  We may do "git
checkout -" very often to go back to what we were working on, but I
do not think "git log -.." or "git log ..-" are something we want to
do very often.

I think what I am saying is that it may be perfectly fine if we said
"'-' can be used for '@{-1}' only by itself; no ranges, no
parent-traversals, no other uses", if it makes it less likely for
mistakes and confusions to happen.

  reply	other threads:[~2015-03-30 19:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-30 17:41 [PATCH/RFC 0/4] Adding '-' notation as @{-1} (pu, d40f108) Kenny Lee Sin Cheong
2015-03-30 17:41 ` [PATCH/RFC 1/4] Add "-" as @{-1} support for the rev-parse command Kenny Lee Sin Cheong
2015-03-30 19:46   ` Junio C Hamano [this message]
2015-03-30 17:41 ` [PATCH/RFC 2/4] t1505: add tests for '-' notation in rev-parse Kenny Lee Sin Cheong
2015-03-31  4:55   ` Torsten Bögershausen
2015-03-30 17:41 ` [PATCH/RFC 3/4] Handle arg as revision first, then option Kenny Lee Sin Cheong
2015-03-30 17:41 ` [PATCH/RFC 4/4] t0102: add tests for '-' notation Kenny Lee Sin Cheong

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=xmqqy4mew9n3.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=kenny.lee28@gmail.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).