git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
MLMatthias Lederhofer <matled@gmx.net>
Date
Sep 28, 2006, 19:55 UTC
Message-ID
<20060928195535.GA25262@moooo.ath.cx>
In-Reply-To
<7vzmckufu0.fsf@assigned-by-dhcp.cox.net>
This was introduced by me in commit v1.4.2.1-gc08e524.
Signed-off-by: Matthias Lederhofer <matled@gmx.net>
---
Junio C Hamano <junkio@cox.net> wrote:
Show 5 quoted lines
> "Nguyen Thai Ngoc Duy" <pclouds@gmail.com> 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
Previous: Junio C HamanoNext: Matthias Lederhofer
Message 5 of 12 in “git commands that only work correctly at top directory”
  1. Nguyen Thai Ngoc DuySep 22, 2006
  2. format-patch: use cwd as default output directoryMatthias Lederhofer, Sep 22, 2006
  3. Nguyen Thai Ngoc DuySep 28, 2006
  4. Junio C HamanoSep 28, 2006
  5. git-format-patch: fix bug using -o in subdirectoriesMatthias Lederhofer, Sep 28, 2006
  6. Matthias LederhoferSep 22, 2006
  7. Nguyen Thai Ngoc DuySep 22, 2006
  8. Petr BaudisSep 23, 2006
  9. git-repack: allow git-repack to run in subdirectoryJeff King, Sep 22, 2006
  10. Thomas KolejkaSep 22, 2006
  11. git-repack: allow git-repack to run in subdirectoryJeff King, Sep 25, 2006
  12. Junio C HamanoSep 25, 2006

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.