From 47d51d91ed814d31e00e62e5fc4ea8ea5d98eab4 Mon Sep 17 00:00:00 2001 Message-Id: <47d51d91ed814d31e00e62e5fc4ea8ea5d98eab4.1746835505.git.mdw@distorted.org.uk> From: Mark Wooding Date: Tue, 9 Sep 2008 23:11:16 +0100 Subject: [PATCH] Fix import to work properly in subdirectories Organization: Straylight/Edgeware From: Catalin Marinas Signed-off-by: Catalin Marinas --- stgit/commands/imprt.py | 4 ++++ t/t1800-import.sh | 11 +++++++++++ 2 files changed, 15 insertions(+) diff --git a/stgit/commands/imprt.py b/stgit/commands/imprt.py index 1c21a74..cd44d3f 100644 --- a/stgit/commands/imprt.py +++ b/stgit/commands/imprt.py @@ -279,6 +279,10 @@ def func(parser, options, args): else: filename = None + if filename: + filename = os.path.abspath(filename) + directory.cd_to_topdir() + if options.series: __import_series(filename, options) elif options.mbox: diff --git a/t/t1800-import.sh b/t/t1800-import.sh index 8c8c9a0..624e51c 100755 --- a/t/t1800-import.sh +++ b/t/t1800-import.sh @@ -21,6 +21,17 @@ test_expect_success \ stg delete .. ' +test_expect_success \ + 'Apply a patch created with "git diff" from a subdirectory' \ + ' + mkdir subdir && cd subdir && + stg import ../../t1800-import/git-diff && + [ $(git cat-file -p $(stg id) \ + | grep -c "tree e96b1fba2160890ff600b675d7140d46b022b155") = 1 ] && + stg delete .. && + cd .. + ' + test_expect_success \ 'Apply a patch created with GNU diff' \ ' -- [mdw]