git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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?
Previous: Grégory PakoszNext: Grégory Pakosz
Message 6 of 13 in “git filter-branch doesn't dereference annotated tags”
  1. Grégory PakoszDec 31, 2012
  2. Junio C HamanoDec 31, 2012
  3. Grégory PakoszJan 1, 2013
  4. Junio C HamanoJan 1, 2013
  5. Grégory PakoszJan 1, 2013
  6. Junio C HamanoJan 1, 2013
  7. Grégory PakoszJan 2, 2013
  8. Junio C HamanoJan 2, 2013
  9. Johannes SixtJan 3, 2013
  10. Grégory PakoszJan 3, 2013
  11. Johannes SixtJan 3, 2013
  12. Brandon CaseyJan 3, 2013
  13. Johannes SixtJan 1, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.