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

From: Cesar Eduardo Barros <[email-masked]>
Date: Mon, 12 Jan 2009 20:04:32 -0200

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
[email-masked]
[email-masked]