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

Re: [PATCH 2/2] filter-branch: Handle rewritting (very) old style tags which lack tagger

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 8, 2017, 21:00 UTC
Message-ID
<xmqqzib9ai63.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170808080620.9536-2-ijc@hellion.org.uk>
Ian Campbell <ijc@hellion.org.uk> writes:
Show 44 quoted lines
> Such as v2.6.12-rc2..v2.6.13-rc3 in the Linux kernel source tree.
>
> Insert a fake tag header, since newer `git mktag` wont accept the input
> otherwise:
>
>     $ git cat-file tag v2.6.12-rc2
>     object 1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
>     type commit
>     tag v2.6.12-rc2
>
>     Linux v2.6.12-rc2 release
>     -----BEGIN PGP SIGNATURE-----
>     Version: GnuPG v1.2.4 (GNU/Linux)
>
>     iD8DBQBCbW8ZF3YsRnbiHLsRAgFRAKCq/TkuDaEombFABkPqYgGCgWN2lQCcC0qc
>     wznDbFU45A54dZC8RZ5JxyE=
>     =ESRP
>     -----END PGP SIGNATURE-----
>
>     $ git cat-file tag v2.6.12-rc2 | git mktag
>     error: char76: could not find "tagger "
>     fatal: invalid tag signature file
>     $ git cat-file tag v2.6.13-rc4 | git mktag
>     7eab951de91d95875ba34ec4c599f37e1208db93
>
> Signed-off-by: Ian Campbell <ijc@hellion.org.uk>
> ---
>  git-filter-branch.sh | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/git-filter-branch.sh b/git-filter-branch.sh
> index d07db3fee..6927aa2da 100755
> --- a/git-filter-branch.sh
> +++ b/git-filter-branch.sh
> @@ -540,6 +540,9 @@ if [ "$filter_tag_name" ]; then
>  			new_sha1=$( ( printf 'object %s\ntype commit\ntag %s\n' \
>  						"$new_sha1" "$new_ref"
>  				git cat-file tag "$ref" |
> +				awk '/^tagger/	{ tagged=1 }
> +				     /^$/	{ if (!tagged && !done) { print "tagger Unknown <unknown@example.com> 0 +0000" } ; done=1 }
> +				     //		{ print }' |
>  				sed -n \
>  				    -e '1,/^$/{
>  					  /^object /d

What the change wants to do makes perfect sense, but piping output from awk into sed looks somewhat gross. Perhaps we'd want to roll what the existing sed script is trying to do into this new awk script?

Previous: Ian CampbellNext: Ian Campbell
Message 6 of 12 in “filter-branch: support for incremental update + fix for ancient tag format”
  1. 0/2 filter-branch: support for incremental update + fix for ancient tag formatIan Campbell, Aug 8, 2017
  2. 1/2 filter-branch: Add --state-branch to hold pickled copy of ref mapIan Campbell, Aug 8, 2017
  3. Junio C HamanoAug 8, 2017
  4. Ian CampbellAug 9, 2017
  5. 2/2 filter-branch: Handle rewritting (very) old style tags which lack taggerIan Campbell, Aug 8, 2017
  6. Junio C HamanoAug 8, 2017
  7. Ian CampbellAug 9, 2017
  8. Jeff KingAug 9, 2017
  9. Junio C HamanoAug 9, 2017
  10. Ian CampbellAug 9, 2017
  11. Junio C HamanoAug 9, 2017
  12. Jeff KingAug 9, 2017

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.