git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ijc@hellion.org.uk>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] filter-branch: Handle rewritting (very) old style tags which lack tagger
Date: Wed, 09 Aug 2017 08:43:18 +0100	[thread overview]
Message-ID: <1502264598.2735.30.camel@hellion.org.uk> (raw)
In-Reply-To: <xmqqzib9ai63.fsf@gitster.mtv.corp.google.com>

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@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.

  reply	other threads:[~2017-08-09  7:43 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-08  8:06 [PATCH 0/2] filter-branch: support for incremental update + fix for ancient tag format Ian Campbell
2017-08-08  8:06 ` [PATCH 1/2] filter-branch: Add --state-branch to hold pickled copy of ref map Ian Campbell
2017-08-08 20:56   ` Junio C Hamano
2017-08-09  7:57     ` Ian Campbell
2017-08-08  8:06 ` [PATCH 2/2] filter-branch: Handle rewritting (very) old style tags which lack tagger Ian Campbell
2017-08-08 21:00   ` Junio C Hamano
2017-08-09  7:43     ` Ian Campbell [this message]
2017-08-09 10:20   ` Jeff King
2017-08-09 15:50     ` Junio C Hamano
2017-08-09 19:02       ` Ian Campbell
2017-08-09 19:10         ` Junio C Hamano
2017-08-09 20:23         ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502264598.2735.30.camel@hellion.org.uk \
    --to=ijc@hellion.org.uk \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).