Re: [PATCH] Teach git-commit about commit message templates.

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

 



Hi,

On Mon, 23 Jul 2007, Steven Grimm wrote:

> Johannes Schindelin wrote:
> > Up until here, I was with you.  But this feels very wrong.
> > 
> > Why not compare COMMIT_MSG to the templatefile, if there is one?  I.e.
> > 
> > test ! -z "$templatefile" && cmp "$GIT_DIR"/COMMIT_MSG "$templatefile" &&
> > 	die "Unchanged message; will not commit"
> >   
> 
> The template can itself have comments -- instructions or explanations of
> fields to fill in, for example -- and since comments have been stripped 
> from COMMIT_MSG at this point, a comparison against such a template 
> would always fail.

Ah, I missed that.  But IIRC your patch does not wrap that logic behind 
test ! -z "$templatefile", right?  So this is my modified suggestion:

test ! -z "$templatefile" && {
	grep -vie '^Signed-off-by:' < "$GIT_DIR"/COMMIT_MSG" > "$GIT_DIR"/tmp1
	grep -ve '^#' < "$templatefile" > "$GIT_DIR"/tmp1
	trap 'rm "$GIT_DIR"/tmp[12]' 0
	cmp "$GIT_DIR"/tmp[12] &&
	die "Unchanged message; will not commit"
}

Ciao,
Dscho

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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