mirror of
https://github.com/mickael-kerjean/filestash
synced 2026-01-06 07:50:40 +01:00
fix (git): fix issue while trying to connect to an empty repo
This commit is contained in:
parent
595eff4015
commit
d0f1e59782
2 changed files with 5 additions and 2 deletions
|
|
@ -277,7 +277,6 @@ func (this *Configuration) Debug() *FormElement {
|
|||
}
|
||||
|
||||
func (this *Configuration) Initialise() {
|
||||
Log.Stdout("CONFIG INIT ADMIN PASSWORD '%s'", os.Getenv("ADMIN_PASSWORD"))
|
||||
if env := os.Getenv("ADMIN_PASSWORD"); env != "" {
|
||||
this.Get("auth.admin").Set(env)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,13 +328,17 @@ func (g *GitLib) open(params *GitParams, path string) (*git.Repository, error) {
|
|||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return git.PlainClone(path, false, &git.CloneOptions{
|
||||
g, err := git.PlainClone(path, false, &git.CloneOptions{
|
||||
URL: g.params.repo,
|
||||
Depth: 1,
|
||||
ReferenceName: plumbing.ReferenceName(fmt.Sprintf("refs/heads/%s", g.params.branch)),
|
||||
SingleBranch: true,
|
||||
Auth: auth,
|
||||
})
|
||||
if err == transport.ErrEmptyRemoteRepository {
|
||||
return g, nil
|
||||
}
|
||||
return g, err
|
||||
}
|
||||
return git.PlainOpen(g.params.basePath)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue