Diff options
| author | Bryce Kwon <bryce@brycekwon.com> | |
|---|---|---|
| committer | Bryce Kwon <bryce@brycekwon.com> | |
| commit | ||
| parent | ||
| tree | ||
| download | ||
Link snapshots of a slash ref by a dashed name
The snapshot page refuses to work a revision out of a name holding a
slash, since that name becomes the top directory of the archive, so
every link for a ref like release/2.0 answered 404. The ref now goes
in the link as the id, and the archive unpacks into the repository's
own prefix, as any snapshot asked for by id does.
Diffstat (limited to 'tests')
| -rwxr-xr-x | tests/t0110-snapshot.sh | 19 |
1 file changed, 19 insertions, 0 deletions
diff --git a/tests/t0110-snapshot.sh b/tests/t0110-snapshot.sh index faebf5e..0f1ca21 100755 --- a/tests/t0110-snapshot.sh +++ b/tests/t0110-snapshot.sh @@ -227,4 +227,23 @@ test_expect_success 'a snapshot and its signature are linked as one unit' ' grep "<span class=.snapshot.><a href=./signed/snapshot/signed-one.tar.gz.>signed-one.tar.gz</a> (<a href=./signed/snapshot/signed-one.tar.gz.asc.>sig</a>)</span>" tmp ' +# A snapshot name is never worked back to a ref holding a slash, so such a +# ref is offered under a dashed name and passed along with it, even from a +# page whose own head is that ref. +test_expect_success 'a ref with a slash is linked under a dashed name' ' + git -C repos/vtags tag release/2.0 HEAD && + git -C repos/vtags branch topic/x HEAD && + cgit_rc vtagsrc "url=vtags/refs/" >tmp && + grep "<a href=./vtags/snapshot/vtags-release-2.0.tar.gz?id=release/2.0.>vtags-release-2.0.tar.gz</a>" tmp && + cgit_rc vtagsrc "url=vtags/commit/&h=topic/x" >tmp && + grep "<a href=./vtags/snapshot/vtags-topic-x.tar.gz?id=topic/x.>vtags-topic-x.tar.gz</a>" tmp +' + +test_expect_success GZIP 'the dashed name serves the ref' ' + cgit_rc vtagsrc "url=vtags/snapshot/vtags-release-2.0.tar.gz&id=release/2.0" >tmp && + grep "^Status: 200" tmp && + strip_headers <tmp >slash.tar.gz && + test "$(gzip -dc slash.tar.gz | git -C repos/vtags get-tar-commit-id)" = "$(git -C repos/vtags rev-parse release/2.0^{commit})" +' + test_done |
