diff options
author | Bert Wesarg <bert.wesarg@googlemail.com> | 2008-09-05 23:16:23 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-09-05 23:06:37 -0700 |
commit | 7d66f21a1bfd2d6ea8b1e234befbcc187111cee6 (patch) | |
tree | fe68e20d202072648dc713dcccc880b29b79dd6d /rerere.h | |
parent | 80d12c23de4fbddfaee2f9bf7fe809f57d02e171 (diff) | |
download | git-7d66f21a1bfd2d6ea8b1e234befbcc187111cee6.tar.gz git-7d66f21a1bfd2d6ea8b1e234befbcc187111cee6.tar.xz |
for-each-ref: `:short` format for `refname`
Tries to shorten the refname to a non-ambiguous name.
Szeder Gábor noticed that the git bash completion takes a
tremendous amount of time to strip leading components from
heads and tags refs (i.e. refs/heads, refs/tags, ...). He
proposed a new atom called 'refbasename' which removes at
most two leading components from the ref name.
I myself, proposed a more dynamic solution, which strips off
common leading components with the matched pattern.
But the current bash solution and both proposals suffer from
one mayor problem: ambiguous refs.
A ref is ambiguous, if it resolves to more than one full refs.
I.e. given the refs refs/heads/xyzzy and refs/tags/xyzzy. The
(short) ref xyzzy can point to both refs.
( Note: Its irrelevant whether the referenced objects are the
same or not. )
This proposal solves this by checking for ambiguity of the
shorten ref name.
The shortening is done with the same rules for resolving refs
but in the reverse order. The short name is checked if it
resolves to a different ref.
To continue the above example, the output would be like this:
heads/xyzzy
xyzzy
So, if you want just tags, xyzzy is not ambiguous, because it
will resolve to a tag. If you need the heads you get a also
a non-ambiguous short form of the ref.
To integrate this new format into the bash completion to get
only non-ambiguous refs is beyond the scope of this patch.
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'rerere.h')
0 files changed, 0 insertions, 0 deletions