git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: "Björn Steinbrink" <B.Steinbrink@gmx.de>,
	"Michael J Gruber" <git@drmicha.warpmail.net>,
	"Pete Wyckoff" <pw@padd.com>,
	git@vger.kernel.org
Subject: Re: tracking branch for a rebase
Date: Mon, 7 Sep 2009 04:43:25 -0400	[thread overview]
Message-ID: <20090907084324.GB17997@coredump.intra.peff.net> (raw)
In-Reply-To: <7vfxaz9wfi.fsf@alter.siamese.dyndns.org>

On Sun, Sep 06, 2009 at 10:05:21PM -0700, Junio C Hamano wrote:

> At-mark currently is reserved for anything that uses reflog, but we can
> say that it is to specify operations on refs (as opposed to caret and
> tilde are to specify operations on object names).

I assume you meant that @{} is reserved; my reading of the previous
discussion was that "foo@bar" is still valid.

> It specifies what ref to work on with the operand on its left side (and an
> empty string stands for "HEAD"), and what operation is done to it by what
> is in {} on the right side of it.  This view is quite consistent with the
> following existing uses of the notation:
> 
> 	ref@{number}	-- nth reflog entry
>         ref@{time}	-- ref back then
> 	@{-number}	-- nth branch switching
> 
> So perhaps ref@{upstream}, or any string that is not a number and cannot
> be time, can trigger the magic operation on the ref with ref@{magic}
> syntax?

I think using @{} is a reasonable extension format. It's easy to read
and syntactically obvious. We need to watch out for conflicts with
things that might be valid times, but that is an easy thing to check
when adding new keywords. The only danger would be some extension
specifier that used arbitrary input, but that would probably be prefixed
with a keyword (and I can't even think of an example extension that
would want arbitrary input).

My only two complaints with ref@{upstream} are (and I don't think either
is a show-stopper, but maybe something we can improve on).

  1. It is a nice abstraction, but it doesn't save typing in most cases.
     "origin" is shorter than "master@{upstream}". One of the desired
     features in the last thread was that it be very short (which isn't
     to say we can't introduce @{upstream} _now_ and add a shorter
     synonym later on).

  2. I assume @{upstream} will be equivalent to HEAD@{upstream}. What
     should it do? The most useful thing to me would be to find the
     upstream for the current branch. But that is actually quite
     different from how HEAD@{1} works, which looks at the reflog for
     HEAD and not the branch.

     Maybe this is an inconsistency we can live with. The features are,
     after all, only syntactically related. I was just hoping to keep
     things as simple as possible for users to understand (and they
     often take semantic clues from syntax).

And some final thinking out loud in this area (i.e., these ideas are, I
think, somewhat half baked):

We already have some reserved uppercase ref names like HEAD, FETCH_HEAD,
ORIG_HEAD, and MERGE_HEAD.  One option would be to declare all-caps
names as reserved and allow UPSTREAM for the feature in question. I can
think of two arguments against it:

 1. The obvious one, that somebody somewhere is using all-caps and we
    are breaking their setup.

 2. It is not syntactically obvious to the user that it is not a real
    ref, but rather a magic name. Users are accustomed to punctuation
    introducing magic, so @{upstream} is probably better in that regard.

So I think that is a bad idea. But what about allowing "ref aliases"?
Obviously a static one like "f" for "foo" is kind of lame. But if you
could use the extension syntax, like:

  git config refalias.% '@{upstream}'

then we can let people set up whatever shorthand they think is sane (and
without worrying about clobbering unlikely-but-allowed setups, since
they are in control of their setup).

Like I said, I am not sure that is not half-baked. ;)

-Peff

  parent reply	other threads:[~2009-09-07  8:43 UTC|newest]

Thread overview: 39+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-04 13:54 tracking branch for a rebase Pete Wyckoff
2009-09-04 14:31 ` Michael J Gruber
2009-09-04 18:18   ` Jeff King
2009-09-04 18:59     ` Björn Steinbrink
2009-09-05  6:12       ` Jeff King
2009-09-05 14:01         ` Björn Steinbrink
2009-09-05 14:28           ` Jeff King
2009-09-07  5:05             ` Junio C Hamano
2009-09-07  8:14               ` Michael J Gruber
2009-09-07  8:25                 ` Junio C Hamano
2009-09-07  8:44                   ` Jeff King
2009-09-07  9:06                     ` Michael J Gruber
2009-09-07  8:43               ` Jeff King [this message]
2009-09-07  9:29                 ` Johannes Schindelin
2009-09-07  9:53                   ` Michael J Gruber
2009-09-08 23:17                     ` Julian Phillips
2009-09-09 10:45                   ` Jeff King
2009-09-10  6:42                     ` Junio C Hamano
2009-09-10  7:47                       ` Johannes Schindelin
2009-09-10  9:36                         ` [PATCH] Introduce <branch>@{tracked} as shortcut to the tracked branch Johannes Schindelin
2009-09-10  9:44                           ` Michael J Gruber
2009-09-10 10:14                             ` Johannes Schindelin
2009-09-10 10:18                             ` Johan Herland
2009-09-10 10:59                               ` Michael J Gruber
2009-09-10 12:29                                 ` Johan Herland
2009-09-10 13:35                                   ` Johannes Schindelin
2009-09-10 14:17                                     ` Michael J Gruber
2009-09-10 11:11                               ` Jeff King
2009-09-10 18:29                                 ` Junio C Hamano
2009-10-02 14:54                                   ` Björn Steinbrink
2009-09-10 14:16                           ` Jeff King
2009-09-10 14:26                             ` Jeff King
2009-09-10 15:24                               ` Johannes Schindelin
2009-09-10 15:25                                 ` [PATCH v2] Introduce <branch>@{upstream} " Johannes Schindelin
2009-09-10 15:55                                   ` Jeff King
2009-09-10 16:18                                     ` Johannes Schindelin
2009-09-10 15:22                             ` [PATCH] Introduce <branch>@{tracked} " Johannes Schindelin
2009-09-11  4:54                         ` tracking branch for a rebase Junio C Hamano
2009-09-05 17:59           ` 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

  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=20090907084324.GB17997@coredump.intra.peff.net \
    --to=peff@peff.net \
    --cc=B.Steinbrink@gmx.de \
    --cc=git@drmicha.warpmail.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pw@padd.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).