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
Ian Campbell <ijc@hellion.org.uk>
Date
Aug 9, 2017, 07:43 UTC
Message-ID
<1502264598.2735.30.camel@hellion.org.uk>
In-Reply-To
<xmqqzib9ai63.fsf@gitster.mtv.corp.google.com>
On Tue, 2017-08-08 at 14:00 -0700, Junio C Hamano wrote:
Show 15 quoted lines
> > @@ -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?

I'm far from an awk guru but I think (unit tested in isolation only) that such script would look something like (I also inverted/renamed done into header since it seemed clearer):

    BEGIN    	    	    	    	    	    { header=1 }
    /^tagger /    	    	    	    	    { tagged=1 }
    /^$/    	    	    	    	    	    { if (!tagged && header) { print "tagger Unknown <    unknown@example.com    > 0 +0000" } ; header=0 }
    /^-----BEGIN PGP SIGNATURE-----/    	    { exit(0) }
    //    	    	    	    	    	    { if (!header || $0 !~ /^(object|type|tag )/) { print } }
    Ian.
Previous: Junio C HamanoNext: Jeff King
Message 7 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.