diff --git a/fast-import.c b/fast-import.c index fff285cd0f..47f61f3cba 100644 --- a/fast-import.c +++ b/fast-import.c @@ -1640,6 +1640,8 @@ static int tree_content_get( n = slash1 - p; else n = strlen(p); + if (!n) + die("Empty path component found in input"); if (!root->tree) load_tree(root); diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 6b1ba6c858..2cd0f0614d 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -1087,6 +1087,45 @@ test_expect_success \ M 040000 $subdir file3/ INPUT_END' +test_expect_success \ + 'N: reject foo/ syntax in copy source' \ + 'test_must_fail git fast-import <<-INPUT_END + commit refs/heads/N5C + committer $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> $GIT_COMMITTER_DATE + data < $GIT_COMMITTER_DATE + data < $GIT_COMMITTER_DATE + data <expect.foo &&