Skip to content

Commit

Permalink
Add test that copying a directory with empty sub-dirs should put empt…
Browse files Browse the repository at this point in the history
…y .gitignore files to empty directories with empty-dirs parameter
  • Loading branch information
Vampire authored and tnyblom committed Apr 20, 2020
1 parent 0498b68 commit 572a8ba
Showing 1 changed file with 48 additions and 0 deletions.
48 changes: 48 additions & 0 deletions test/empty-dirs.bats
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,54 @@ load 'common'
assert_equal "$(git -C git-repo show master:dir-b/.gitignore)" ''
}

@test 'copying a directory with empty sub-dirs should put empty .gitignore files to empty directories with empty-dirs parameter' {
svn mkdir --parents dir-a/subdir-a
svn commit -m 'add dir-a/subdir-a'
svn cp dir-a dir-b
svn commit -m 'copy dir-a to dir-b'

cd "$TEST_TEMP_DIR"
svn2git "$SVN_REPO" --empty-dirs --rules <(echo "
create repository git-repo
end repository
match /
repository git-repo
branch master
end match
")

assert git -C git-repo show master:dir-a/subdir-a/.gitignore
assert_equal "$(git -C git-repo show master:dir-a/subdir-a/.gitignore)" ''
assert git -C git-repo show master:dir-b/subdir-a/.gitignore
assert_equal "$(git -C git-repo show master:dir-b/subdir-a/.gitignore)" ''
}

@test 'copying a directory with empty sub-dirs should put empty .gitignore files to empty directories with empty-dirs parameter (nested)' {
svn mkdir project-a
cd project-a
svn mkdir --parents dir-a/subdir-a
svn commit -m 'add dir-a/subdir-a'
svn cp dir-a dir-b
svn commit -m 'copy dir-a to dir-b'

cd "$TEST_TEMP_DIR"
svn2git "$SVN_REPO" --empty-dirs --rules <(echo "
create repository git-repo
end repository
match /project-a/
repository git-repo
branch master
end match
")

assert git -C git-repo show master:dir-a/subdir-a/.gitignore
assert_equal "$(git -C git-repo show master:dir-a/subdir-a/.gitignore)" ''
assert git -C git-repo show master:dir-b/subdir-a/.gitignore
assert_equal "$(git -C git-repo show master:dir-b/subdir-a/.gitignore)" ''
}

@test 'branching with svn-branches and empty-dirs parameter should put empty .gitignore files to empty directories' {
svn mkdir --parents trunk/dir-a
svn commit -m 'add trunk/dir-a'
Expand Down

0 comments on commit 572a8ba

Please sign in to comment.