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

2017-08-09 Thread Jeff King
On Wed, Aug 09, 2017 at 08:02:33PM +0100, Ian Campbell wrote:

> > > Should we instead make git-mktag more lenient (possibly with a
> > > command-line option to reduce accidental omissions)?
> > 
> > That sounds sensible. Thanks for injecting a dose of sanity.
> 
> Indeed. I'll add a --allow-missing-tagger option (suggestions for a
> snappier name accepted!) and pass it unconditionally from the filter-
> branch script.

I think that name is the right amount of snappy. It's not meant to be
used very often. :)

-Peff


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

2017-08-09 Thread Junio C Hamano
Ian Campbell  writes:

> Indeed. I'll add a --allow-missing-tagger option (suggestions for a
> snappier name accepted!) and pass it unconditionally from the filter-
> branch script.

Thanks.  That's much better.


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

2017-08-09 Thread Ian Campbell
On Wed, 2017-08-09 at 08:50 -0700, Junio C Hamano wrote:
> Jeff King  writes:
> 
> > On Tue, Aug 08, 2017 at 09:06:20AM +0100, Ian Campbell wrote:
> >
> >> 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:
> >
> > Hmm. Now your resulting tag will have this crufty "unknown@example.
> com"
> > header baked into it, won't it?
> >
> > Should we instead make git-mktag more lenient (possibly with a
> > command-line option to reduce accidental omissions)?
> 
> That sounds sensible. Thanks for injecting a dose of sanity.

Indeed. I'll add a --allow-missing-tagger option (suggestions for a
snappier name accepted!) and pass it unconditionally from the filter-
branch script.

Ian.



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

2017-08-09 Thread Junio C Hamano
Jeff King  writes:

> On Tue, Aug 08, 2017 at 09:06:20AM +0100, Ian Campbell wrote:
>
>> 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:
>
> Hmm. Now your resulting tag will have this crufty "unkn...@example.com"
> header baked into it, won't it?
>
> Should we instead make git-mktag more lenient (possibly with a
> command-line option to reduce accidental omissions)?

That sounds sensible. Thanks for injecting a dose of sanity.


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

2017-08-09 Thread Jeff King
On Tue, Aug 08, 2017 at 09:06:20AM +0100, Ian Campbell wrote:

> 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:

Hmm. Now your resulting tag will have this crufty "unkn...@example.com"
header baked into it, won't it?

Should we instead make git-mktag more lenient (possibly with a
command-line option to reduce accidental omissions)?

-Peff


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

2017-08-09 Thread Ian Campbell
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  0 +" } ; 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  0 +" } ; header=0 }

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

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

Ian.


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

2017-08-08 Thread Junio C Hamano
Ian Campbell  writes:

> 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 
> ---
>  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  0 +" } ; 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?




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

2017-08-08 Thread Ian Campbell
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 
---
 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  0 +" } ; done=1 }
+// { print }' |
sed -n \
-e '1,/^$/{
  /^object /d
-- 
2.11.0