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
Dec 31, 2012, 18:31 UTC
Message-ID
<7vsj6mdqeo.fsf@alter.siamese.dyndns.org>
In-Reply-To
<CAC_01E174m_6tDwPKZ5P0BUxnLNWUf9p+VkECFosPTzip0sYsA@mail.gmail.com>
Grégory Pakosz <gpakosz@visionobjects.com> writes:
Show 11 quoted lines
>   1) either make git-filter-branch dereference annotated tags and do
> the verification itself then use the two arguments version of git
> update-ref
>   2) in the case of an annotated tag, pass another <old value> to git update-ref
>
> Please find below a patch that implements solution 1).
> ...
>  		echo "Ref '$ref' was deleted"
> -		git update-ref -m "filter-branch: delete" -d "$ref" $sha1 ||
> +		test $(git rev-parse --verify "$ref^{commit}") = $sha1 && git
> update-ref -m "filter-branch: delete" -d "$ref" ||
Thanks.  A few comments.

At the design level. Where does this $sha1 come from in the first place? If a ref that named the annotated tag was deleted, shouldn't we arrange things so this part of the code receives the $sha1 of the tag that corresponds to the $ref so that "update-ref -d" can check that nobody tampered with the repository while the script was working?

At the implementation level. When the ref being deleted pointed at a tree or a blob, the original would have correctly removed it, but will the updated one?

Previous: Grégory PakoszNext: Grégory Pakosz
Message 2 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.