Skip to content

Commit 20b85b3

Browse files
committed
test: Test stg import --directory
1 parent ad4e0dd commit 20b85b3

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

t/t1800-import.sh

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,21 @@ test_expect_success 'Import empty patch with sign-off' '
213213
stg top | grep -v -e "empty"
214214
'
215215

216+
test_expect_success 'Import with root directory' '
217+
mkdir -p dir0/dir1/dir2 &&
218+
echo "hello" >dir0/dir1/dir2/file.txt &&
219+
stg add dir0/dir1/dir2/file.txt &&
220+
stg new -rm "dirs" &&
221+
echo "bye" >>dir0/dir1/dir2/file.txt &&
222+
git diff --relative=dir0/dir1 >relative.diff &&
223+
stg reset --hard &&
224+
command_error stg import --directory=dir0/dir1/dir2 <relative.diff 2>err &&
225+
grep "error: dir0/dir1/dir2/dir2/file.txt: does not exist in index" err &&
226+
stg import --name from-relative --3way --directory=dir0/dir1 <relative.diff &&
227+
stg show from-relative | grep "bye" &&
228+
stg delete dirs from-relative
229+
'
230+
216231
test_expect_success 'Import series from stdin' '
217232
echo "some.patch" |
218233
stg import --series &&

0 commit comments

Comments
 (0)