From: Jeff King Date: Thu, 11 Mar 2010 08:31:48 GMT Subject: Re: [PATCH] Do not strip empty lines / trailing spaces from a commit message template Message-ID: <20100311083148.GA13786@sigill.intra.peff.net> In-Reply-To: <20100311081213.GA13575@sigill.intra.peff.net> On Thu, Mar 11, 2010 at 03:12:13AM -0500, Jeff King wrote: > > if (fp == NULL) > > die_errno("could not open '%s'", git_path(commit_editmsg)); > > > > - if (cleanup_mode != CLEANUP_NONE) > > + if (cleanup_mode != CLEANUP_NONE && strcmp(hook_arg1, "template")) > > stripspace(&sb, 0); > > And the code looks OK, though admittedly I am not too familiar with this > chunk of code (at first I was confused that you would have to look at > hook_arg1, but apparently there is no other variable that contains the > result of that big if-else chain). BTW, a subtle point for anyone else reviewing this patch: we also call stripspace in message_is_empty to skip over an untouched template. But that code path is stil OK, because we stripspace the whole message that comes back from the user before calling message_is_empty(), so the result should be the same for an untouched template. -Peff