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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2017-08-08 at 14:00 -0700, Junio C Hamano wrote:
> > @@ -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@xxxxxxxxxxx> 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@xxxxxxxxxxx    > 0 +0000" } ; header=0 }

    /^-----BEGIN PGP SIGNATURE-----/    	    { exit(0) }

    //    	    	    	    	    	    { if (!header || $0 !~ /^(object|type|tag )/) { print } }

    Ian.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux