aboutsummaryrefslogtreecommitdiffstats
path: root/repository_test.go
diff options
context:
space:
mode:
authorAnthony HAMON <antham@users.noreply.github.com>2017-12-01 16:27:52 +0100
committerMáximo Cuadros <mcuadros@gmail.com>2017-12-01 16:27:52 +0100
commit44c364fe3b7b8cdc0f9623afe870d6781a97ebb4 (patch)
tree03284e910c75da7c896381b439c04498eabe63db /repository_test.go
parente20d3347d26f0b7193502e2ad7386d7c504b0cde (diff)
downloadgo-git-44c364fe3b7b8cdc0f9623afe870d6781a97ebb4.tar.gz
Fix revision solver for branch and tag (#660)
fix Repository.ResolveRevision for branch and tag
Diffstat (limited to 'repository_test.go')
-rw-r--r--repository_test.go45
1 files changed, 26 insertions, 19 deletions
diff --git a/repository_test.go b/repository_test.go
index 2ebc597..cf0805a 100644
--- a/repository_test.go
+++ b/repository_test.go
@@ -1265,24 +1265,32 @@ func (s *RepositorySuite) TestWorktreeBare(c *C) {
}
func (s *RepositorySuite) TestResolveRevision(c *C) {
- url := s.GetLocalRepositoryURL(
- fixtures.ByURL("https://github.com/git-fixtures/basic.git").One(),
- )
-
- r, _ := Init(memory.NewStorage(), nil)
- err := r.clone(context.Background(), &CloneOptions{URL: url})
+ f := fixtures.ByURL("https://github.com/git-fixtures/basic.git").One()
+ sto, err := filesystem.NewStorage(f.DotGit())
+ c.Assert(err, IsNil)
+ r, err := Open(sto, f.DotGit())
c.Assert(err, IsNil)
datas := map[string]string{
- "HEAD": "6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
- "refs/heads/master~2^^~": "b029517f6300c2da0f4b651b8642506cd6aaf45d",
- "HEAD~2^^~": "b029517f6300c2da0f4b651b8642506cd6aaf45d",
- "HEAD~3^2": "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69",
- "HEAD~3^2^0": "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69",
- "HEAD~2^{/binary file}": "35e85108805c84807bc66a02d91535e1e24b38b9",
- "HEAD~^{!-some}": "1669dce138d9b841a518c64b10914d88f5e488ea",
- "HEAD@{2015-03-31T11:56:18Z}": "918c48b83bd081e863dbe1b80f8998f058cd8294",
- "HEAD@{2015-03-31T11:49:00Z}": "1669dce138d9b841a518c64b10914d88f5e488ea",
+ "HEAD": "6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
+ "heads/master": "6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
+ "heads/master~1": "918c48b83bd081e863dbe1b80f8998f058cd8294",
+ "refs/heads/master": "6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
+ "refs/heads/master~2^^~": "b029517f6300c2da0f4b651b8642506cd6aaf45d",
+ "refs/tags/v1.0.0": "6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
+ "refs/remotes/origin/master": "6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
+ "refs/remotes/origin/HEAD": "6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
+ "HEAD~2^^~": "b029517f6300c2da0f4b651b8642506cd6aaf45d",
+ "HEAD~3^2": "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69",
+ "HEAD~3^2^0": "a5b8b09e2f8fcb0bb99d3ccb0958157b40890d69",
+ "HEAD~2^{/binary file}": "35e85108805c84807bc66a02d91535e1e24b38b9",
+ "HEAD~^{/!-some}": "1669dce138d9b841a518c64b10914d88f5e488ea",
+ "master": "6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
+ "branch": "e8d3ffab552895c19b9fcf7aa264d277cde33881",
+ "v1.0.0": "6ecf0ef2c2dffb796033e5a02219af86ec6584e5",
+ "branch~1": "918c48b83bd081e863dbe1b80f8998f058cd8294",
+ "v1.0.0~1": "918c48b83bd081e863dbe1b80f8998f058cd8294",
+ "master~1": "918c48b83bd081e863dbe1b80f8998f058cd8294",
}
for rev, hash := range datas {
@@ -1303,10 +1311,9 @@ func (s *RepositorySuite) TestResolveRevisionWithErrors(c *C) {
c.Assert(err, IsNil)
datas := map[string]string{
- "efs/heads/master~": "reference not found",
- "HEAD^3": `Revision invalid : "3" found must be 0, 1 or 2 after "^"`,
- "HEAD^{/whatever}": `No commit message match regexp : "whatever"`,
- "HEAD@{2015-03-31T09:49:00Z}": `No commit exists prior to date "2015-03-31 09:49:00 +0000 UTC"`,
+ "efs/heads/master~": "reference not found",
+ "HEAD^3": `Revision invalid : "3" found must be 0, 1 or 2 after "^"`,
+ "HEAD^{/whatever}": `No commit message match regexp : "whatever"`,
}
for rev, rerr := range datas {