Skip to content

Commit 68c2ec7

Browse files
committed
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 <[email protected]>
1 parent 141201d commit 68c2ec7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

builtin-log.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -962,6 +962,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
962962
* get_revision() to do the usual traversal.
963963
*/
964964
}
965+
966+
/*
967+
* We cannot move this anywhere earlier because we do want to
968+
* know if --root was given explicitly from the comand line.
969+
*/
970+
rev.show_root_diff = 1;
971+
965972
if (cover_letter) {
966973
/* remember the range */
967974
int i;

0 commit comments

Comments
 (0)