From 68c2ec7f43c4dc16833ff58af76ab20e9cdfad17 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Sat, 10 Jan 2009 12:41:33 -0800 Subject: [PATCH] format-patch: show patch text for the root commit Even without --root specified, if the range given on the command line happens to include a root commit, we should include its patch text in the output. This fix deliberately ignores log.showroot configuration variable because "format-patch" and "log -p" can and should behave differently in this case, as the former is about exporting a part of your history in a form that is replayable elsewhere and just giving the commit log message without the patch text does not make any sense for that purpose. Noticed and fix originally attempted by Nathan W. Panike; credit goes to Alexander Potashev for injecting sanity to my initial (broken) fix that used the value from log.showroot configuration, which was misguided. Signed-off-by: Junio C Hamano --- builtin-log.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/builtin-log.c b/builtin-log.c index db71e0da74..5e302906fb 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -962,6 +962,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) * get_revision() to do the usual traversal. */ } + + /* + * We cannot move this anywhere earlier because we do want to + * know if --root was given explicitly from the comand line. + */ + rev.show_root_diff = 1; + if (cover_letter) { /* remember the range */ int i; -- 2.11.4.GIT