Currently, the command
git format-patch -1 e83c5163316f89bfbde
in the git repository creates an empty file. Instead, one is forced to do
git format-patch -1 --root e83c5163316f89bfbde
This seems arbitrary. This patch fixes this case, so that
git format-patch -1 e83c5163316f89bfbde
will produce an actual patch. --- builtin-log.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
Show changes to builtin-log.c +2 −0
diff --git a/builtin-log.c b/builtin-log.c index 4a02ee9..5e7b61f 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -977,6 +977,8 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix) list[nr - 1] = commit; } total = nr; + if (total == 1 && !list[0]->parents) + rev.show_root_diff=1; if (!keep_subject && auto_number && total > 1) numbered = 1; if (numbered)
-- 1.6.1.76.gc123b.dirty