Remove private key requirement for tmpfs-mode

This commit is contained in:
Mustafa Gezen 2021-04-08 18:36:30 +02:00
parent 1a7b44d9f3
commit 4b798ecec8
2 changed files with 27 additions and 23 deletions

View File

@ -111,10 +111,16 @@ func mn(_ *cobra.Command, _ []string) {
}
lastKeyLocation = filepath.Join(usr.HomeDir, ".ssh/id_rsa")
}
// create ssh key authenticator
authenticator, err := ssh.NewPublicKeysFromFile(sshUser, lastKeyLocation, "")
if err != nil {
log.Fatalf("could not get git authenticator: %v", err)
var authenticator *ssh.PublicKeys
if tmpFsMode == "" {
var err error
// create ssh key authenticator
authenticator, err = ssh.NewPublicKeysFromFile(sshUser, lastKeyLocation, "")
if err != nil {
log.Fatalf("could not get git authenticator: %v", err)
}
}
fsCreator := func(branch string) billy.Filesystem {

View File

@ -119,27 +119,25 @@ func (g *GitMode) RetrieveSource(pd *data.ProcessData) *data.ModeData {
}
_ = tagIter.ForEach(tagAdd)
if len(latestTags) == 0 {
list, err := remote.List(&git.ListOptions{})
list, err := remote.List(&git.ListOptions{})
if err != nil {
log.Fatalf("could not list upstream: %v", err)
}
for _, ref := range list {
if ref.Hash().IsZero() {
continue
}
commit, err := repo.CommitObject(ref.Hash())
if err != nil {
log.Fatalf("could not list upstream: %v", err)
}
for _, ref := range list {
if ref.Hash().IsZero() {
continue
}
commit, err := repo.CommitObject(ref.Hash())
if err != nil {
log.Printf("could not get commit object for ref %s: %v", ref.Name().String(), err)
continue
}
_ = tagAdd(&object.Tag{
Name: strings.TrimPrefix(string(ref.Name()), "refs/tags/"),
Tagger: commit.Committer,
})
log.Printf("could not get commit object for ref %s: %v", ref.Name().String(), err)
continue
}
_ = tagAdd(&object.Tag{
Name: strings.TrimPrefix(string(ref.Name()), "refs/tags/"),
Tagger: commit.Committer,
})
}
for _, branch := range latestTags {