From: Catalin Marinas Date: Tue, 9 Sep 2008 22:11:16 +0000 (+0100) Subject: Fix import to work properly in subdirectories X-Git-Tag: v0.15-rc1~49^2~5 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/stgit/commitdiff_plain/47d51d91ed814d31e00e62e5fc4ea8ea5d98eab4 Fix import to work properly in subdirectories Signed-off-by: Catalin Marinas --- 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' \ '