Skip to content

Update to latest go-git #316

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
smola opened this issue Aug 9, 2018 · 0 comments
Closed

Update to latest go-git #316

smola opened this issue Aug 9, 2018 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@smola
Copy link
Contributor

smola commented Aug 9, 2018

Let's keep up with go-git bugfixes and update it.

commit 12b1bd549630fb6f3ad2c7f22bdba1e55937534f
Author: Santiago M. Mola <[email protected]>
Date:   Thu Aug 9 11:19:10 2018 +0200

    test: ensure HEAD exists on fixtures

    Newer git versions give an error when trying to fetch a refspec that
    not use wildcard and does not match anything (as git itself does).

    Borges always asks for HEAD explicitely, so we need to create it on
    our fixtures.

    Signed-off-by: Santiago M. Mola <[email protected]>

diff --git a/fixtures_test.go b/fixtures_test.go
index 119f6c1..a1e3cef 100644
--- a/fixtures_test.go
+++ b/fixtures_test.go
@@ -238,6 +238,17 @@ func (f *ChangesFixture) setReferences(r *git.Repository, refs []*model.Referenc
                }
        }

+       // If there is no explicit HEAD, set it to the first reference.
+       // This will avoid errors on missing HEAD, since borges expects HEAD to
+       // exist.
+       if _, err := r.Storer.Reference(plumbing.HEAD); err != nil {
+               err := r.Storer.SetReference(plumbing.NewSymbolicReference(
+                       plumbing.HEAD, plumbing.ReferenceName(refs[0].Name)))
+               if err != nil {
+                       return err
+               }
+       }
+
        return nil
 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants