[PATCH] git-format-patch: fix bug using -o in subdirectories

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This was introduced by me in commit v1.4.2.1-gc08e524.

Signed-off-by: Matthias Lederhofer <matled@xxxxxxx>
---
Junio C Hamano <junkio@xxxxxxx> wrote:
> "Nguyen Thai Ngoc Duy" <pclouds@xxxxxxxxx> writes:
> 
> > This patch works great. I assume you forgot it?
> 
> Thanks for reminding.
Argh, there is a bug.  When prefix is not NULL and -o is specified
git-format-patch fails:
~/src/git/a% ../git-format-patch -o ./b HEAD~1
fatal: Two output directories?
---
 builtin-log.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/builtin-log.c b/builtin-log.c
index 130b53a..9d1ceae 100644
--- a/builtin-log.c
+++ b/builtin-log.c
@@ -270,8 +270,6 @@ int cmd_format_patch(int argc, const cha
 
 	rev.extra_headers = extra_headers;
 
-	output_directory = prefix;
-
 	/*
 	 * Parse the arguments before setup_revisions(), or something
 	 * like "git fmt-patch -o a123 HEAD^.." may fail; a123 is
@@ -350,6 +348,9 @@ int cmd_format_patch(int argc, const cha
 	if (!rev.diffopt.output_format)
 		rev.diffopt.output_format = DIFF_FORMAT_DIFFSTAT | DIFF_FORMAT_PATCH;
 
+	if (!output_directory)
+		output_directory = prefix;
+
 	if (output_directory) {
 		if (use_stdout)
 			die("standard output, or directory, which one?");
-- 
1.4.2.1.ge767

-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]