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?