[PATCH 3/5] reset --hard: skip blank lines when reporting the commit subject
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Jun 29, 2016, 14:14 UTC
- Message-ID
- <fd3b5aee740e88ceff0fbe77c61a10767c4f8622.1467209576.git.johannes.schindelin@gmx.de>
- In-Reply-To
- <cover.1467209576.git.johannes.schindelin@gmx.de>
When there are blank lines at the beginning of a commit message, the pretty printing machinery already skips them when showing a commit subject (or the complete commit message). We shall henceforth do the same when reporting the commit subject after the user called
git reset --hard <commit>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- builtin/reset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/reset.c b/builtin/reset.c index acd6278..5c6206b 100644 --- a/builtin/reset.c +++ b/builtin/reset.c @@ -103,7 +103,7 @@ static void print_new_head_line(struct commit *commit) if (body) { const char *eol; size_t len; - body += 2; + body = skip_blank_lines(body + 2); eol = strchr(body, '\n'); len = eol ? eol - body : strlen(body); printf(" %.*s\n", (int) len, body);
-- 2.9.0.270.g810e421