git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH, v2] tag: implement --[no-]strip option
Date: Tue, 15 Nov 2011 00:39:03 +0200	[thread overview]
Message-ID: <20111114223903.GA5751@shutemov.name> (raw)
In-Reply-To: <7vipmmibx4.fsf@alter.siamese.dyndns.org>

On Mon, Nov 14, 2011 at 02:20:23PM -0800, Junio C Hamano wrote:
> "Kirill A. Shutemov" <kirill@shutemov.name> writes:
> 
> > From: "Kirill A. Shutemov" <kirill@shutemov.name>
> >
> > --strip::
> > 	Remove from tag message lines staring with '#', trailing spaces
> > 	from every line and empty lines from the beginning and end.
> > 	Enabled by default. Use --no-strip to overwrite the behaviour.
> >
> > --no-strip is useful if you want to take a tag message as-is, without
> > any stripping.
> 
> That is not a commit log message ;-)

Ok, I'll fix.

> > Signed-off-by: Kirill A. Shutemov <kirill@shutemov.name>
> 
> > diff --git a/Documentation/git-tag.txt b/Documentation/git-tag.txt
> > index c83cb13..dbb76a6 100644
> > --- a/Documentation/git-tag.txt
> > +++ b/Documentation/git-tag.txt
> > @@ -99,6 +99,11 @@ OPTIONS
> >  	Implies `-a` if none of `-a`, `-s`, or `-u <key-id>`
> >  	is given.
> >  
> > +--strip::
> > +	Remove from tag message lines staring with '#', trailing spaces
> > +	from every line and empty lines from the beginning and end.
> > +	Enabled by default. Use --no-strip to overwrite the behaviour.
> 
> s/overwrite/override/; or replace the last sentence with "With
> `--no-strip`, the tag message given by the user is used as-is".

Ok.

> > diff --git a/builtin/tag.c b/builtin/tag.c
> > index 9b6fd95..05a1fd4 100644
> > --- a/builtin/tag.c
> > +++ b/builtin/tag.c
> > ...
> > @@ -356,7 +362,7 @@ static void create_tag(const unsigned char *object, const char *tag,
> >  
> >  		if (!is_null_sha1(prev))
> >  			write_tag_body(fd, prev);
> > -		else
> > +		else if (opt->strip)
> >  			write_or_die(fd, _(tag_template), strlen(_(tag_template)));
> 
> Why are you not writing template when no strip is done? (Not an objection
> disguised as a rhetorical question, but a question).
> 
> The user who typed "tag -a v1.2.3 HEAD" that spawns an editor would still
> find it useful to have commented instructions, once we start filling the
> template with more useful information that is customized for the
> situation (e.g. "git show -s --oneline" output), no?

Yes. But in this case commented instructions will not be stripped and they
will go to the message. I think user will be confused.

We can show show some instructions before spawning the editor. What do
you think?

> > @@ -423,8 +430,13 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
> >  	const char *object_ref, *tag;
> >  	struct ref_lock *lock;
> >  
> > -	int annotate = 0, sign = 0, force = 0, lines = -1,
> > -		list = 0, delete = 0, verify = 0;
> > +	struct create_tag_options opt = {
> > +		.sign = 0,
> > +		.strip = 1,
> > +	};
> 
> Avoid doing this.  Even though these C99 initializers are nicer and more
> readable way to write this, we try to be gentle to people with older
> compilers that do not grok the syntax.

It's sad. Do you have a list of compilers which are important for the
project?

> Except for the above minor nits, the patch basically looks good. Please
> hold onto it and resubmit after 1.7.8 final ships.

Thanks.

-- 
 Kirill A. Shutemov

  reply	other threads:[~2011-11-14 22:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-14 21:43 [PATCH, v2] tag: implement --[no-]strip option Kirill A. Shutemov
2011-11-14 22:20 ` Junio C Hamano
2011-11-14 22:39   ` Kirill A. Shutemov [this message]
2011-11-14 23:04     ` Junio C Hamano
2011-11-15  6:42 ` Johannes Sixt
2011-11-15  7:17   ` Junio C Hamano

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=20111114223903.GA5751@shutemov.name \
    --to=kirill@shutemov.name \
    --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).