Skip to content

Commit

Permalink
git tag reference supported
Browse files Browse the repository at this point in the history
  • Loading branch information
kawanet committed Aug 1, 2023
1 parent 1755ad9 commit df57534
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/kawanet/serve-static-git/issues"
},
"dependencies": {
"git-cat-file": "^0.2.0",
"git-cat-file": "^0.3.0",
"mime": "^1.6.0"
},
"devDependencies": {
Expand Down
6 changes: 5 additions & 1 deletion test/210.refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ describe(TITLE, () => {

await request.get("/foo.html?refs=main").then(res => assert.match(String(res.data), /Foo/))
await request.get("/foo.html?refs=upper").then(res => assert.match(String(res.data), /FOO/))
await request.get("/foo.html?refs=main-tag").then(res => assert.match(String(res.data), /Foo/))
await request.get("/foo.html?refs=upper-tag").then(res => assert.match(String(res.data), /FOO/))
await request.get("/foo.html").then(res => assert.equal(res.status, 404))
})

Expand All @@ -38,6 +40,8 @@ describe(TITLE, () => {

await request.get("/foo.html", {headers: {"X-Refs": "main"}}).then(res => assert.match(String(res.data), /Foo/))
await request.get("/foo.html", {headers: {"X-Refs": "upper"}}).then(res => assert.match(String(res.data), /FOO/))
await request.get("/foo.html", {headers: {"X-Refs": "main-tag"}}).then(res => assert.match(String(res.data), /Foo/))
await request.get("/foo.html", {headers: {"X-Refs": "upper-tag"}}).then(res => assert.match(String(res.data), /FOO/))
await request.get("/foo.html").then(res => assert.equal(res.status, 404))
})
})
})
3 changes: 3 additions & 0 deletions test/test-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ echo "<!-- Index -->" > htdocs/bar/buz/index.html
echo "# htaccess" > htdocs/.htaccess
git add htdocs
git commit -m 'main branch'
git tag -a main-tag -m 'main tag'

git switch -c upper
echo "<!-- FOO -->" > htdocs/foo.html
Expand All @@ -29,6 +30,8 @@ echo "# HTACCESS" > htdocs/.htaccess
echo "<!-- INDEX -->" > htdocs/bar/buz/index.html
git add htdocs
git commit -m 'upper branch'
git tag -a upper-tag -m 'upper tag'

git switch main

echo "==== packed1 ===="
Expand Down

0 comments on commit df57534

Please sign in to comment.