Re: [PATCH] Introduce <branch>@{tracked} as shortcut to the tracked branch
- From
Jeff King <peff@peff.net>
- Date
- Sep 10, 2009, 14:16 UTC
- Message-ID
- <20090910141618.GB4942@coredump.intra.peff.net>
- In-Reply-To
- <alpine.DEB.1.00.0909101135590.8306@pacific.mpi-cbg.de>
On Thu, Sep 10, 2009 at 11:36:42AM +0200, Johannes Schindelin wrote:
Show 12 quoted lines
> diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt
> index 82045a2..09a2145 100644
> --- a/Documentation/git-rev-parse.txt
> +++ b/Documentation/git-rev-parse.txt
> @@ -231,6 +231,10 @@ when you run 'git-merge'.
> * The special construct '@\{-<n>\}' means the <n>th branch checked out
> before the current one.
>
> +* The suffix '@{tracked}' to a ref (short form 'blabla@{t}') refers to
> + the branch tracked by that ref. If no ref was specified, it means the
> + branch tracked by the current branch.
> +It looks like the code dereferences symbolic refs when doing the lookup (so HEAD@{t} will find the upstream of the current branch), which I think is the best thing to do. However, that does make it behave slightly differently than HEAD@{2.minutes.ago}, so it may be worth adding a sentence to this paragraph like:
If the ref is a symbolic ref, it is dereferenced before searching for the upstream ref.
And we may want to add a test for HEAD, as well.
Also, I seem to be able to stimulate a segfault on a detached HEAD, but I haven't investigated it yet.
-Peff