Re: git filter-branch doesn't dereference annotated tags
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jan 1, 2013, 21:04 UTC
- Message-ID
- <7vk3rwaa3r.fsf@alter.siamese.dyndns.org>
- In-Reply-To
- <CAC_01E3VWtsFd8ww+7W8DMhRAs4WgHf=bm+xoh9wszCkb-DfUA@mail.gmail.com>
Grégory Pakosz <gpakosz@visionobjects.com> writes:
Show 5 quoted lines
> Are you suggesting $sha1 should be obtained differently before > entering case "$rewritten" ? > That would mean changing sha1=$(git rev-parse "$ref"^0) at line 376 to > something like $(git cat-file -t "$ref") = 'tag' && sha1=$(git > rev-parse "$ref") || sha1=$(git rev-parse "$ref^0") ?
I was wondering if it should be
sha1=$(git rev-parse --verify "$ref")
or something that does not dereference a tag at all.
The way I read what that loop seems to want to do is:
Read each refname that was given originally from the file $tempdir/heads, find out the object it used to refer to and have it in $sha1, find out what new object the object was rewritten to and have it in $rewritten, and:
(1) if the rewrite left the object unchanged, do nothing but
warn users just in case this was a mistake;
(2) if the rewrite told us to remove it, then delete the
ref; or
(3) if the rewrite gave us a new object, replace the ref to
point to that new one.And in the latter two cases, save the original one in $orig_namespace so that the user can choose to recover if this filter-branch was done by mistake.
So I do not think unwraping the ref at that point makes any sense, unless it is not prepared to handle annotated tags at all by unwrapping tags too early.
What am I missing?