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

git-format-patch with -o ../ in subdir of working copy writes output in wrong place

From
Cesar Eduardo Barros <cesarb@cesarb.net>
Date
Jan 12, 2009, 22:04 UTC
Message-ID
<496BBE70.9060405@cesarb.net>

If you are in a subdirectory of your working copy (for instance, linux-2.6/drivers/net) and use git-format-patch with -o to a sequence of ../ (for instance, -o ../../../) to write to the working copy's parent directory, it instead interprets the directory passed to -o as relative to the root of the working copy, instead of the expected current directory.

Testcase: mkdir a cd a git init mkdir b touch b/c git add b/c git commit -m 'test' cd b echo 'test' > c git commit -a -m 'test' git format-patch -o ../ HEAD^..HEAD

Expected result: put the patch within the "a" directory Result with v1.6.1: put the patch within the parent of the "a" directory

(This testcase uses ../ instead of ../../ to avoid putting the patch file in an unexpected place, like in your home directory, which is what would happen in practice.)

-- 
Cesar Eduardo Barros
cesarb@cesarb.net
cesar.barros@gmail.com
Next: Junio C Hamano
Message 1 of 5 in “git-format-patch with -o ../ in subdir of working copy writes output in wrong place”
  1. Cesar Eduardo BarrosJan 12, 2009
  2. Teach format-patch to handle output directory relative to cwdJunio C Hamano, Jan 12, 2009
  3. Cesar Eduardo BarrosJan 12, 2009
  4. Junio C HamanoJan 13, 2009
  5. Cesar Eduardo BarrosJan 13, 2009

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.