@@ -38,7 +38,7 @@ func RepositoryClone(directory, url, commitId, accessToken string) error {
38
38
Hash : plumbing .NewHash (commitId ),
39
39
})
40
40
if err != nil {
41
- return fmt .Errorf ("Cannot checkout the commit ID %s: '%s'" , commitId , err )
41
+ return fmt .Errorf ("cannot checkout the commit ID %s: '%s'" , commitId , err )
42
42
}
43
43
return nil
44
44
}
@@ -66,7 +66,7 @@ func hasNotBeenHardReset(r repository, branchName string, currentMainHash *plumb
66
66
return err
67
67
}
68
68
if ! ok {
69
- return fmt .Errorf ("This branch has been hard reset: its head '%s' is not on top of '%s'" ,
69
+ return fmt .Errorf ("this branch has been hard reset: its head '%s' is not on top of '%s'" ,
70
70
remoteMainHead .String (), currentMainHash .String ())
71
71
}
72
72
}
@@ -77,7 +77,7 @@ func getHeadFromRemoteAndBranch(r repository, remoteName, branchName, currentMai
77
77
var currentMainHash * plumbing.Hash
78
78
head := getRemoteCommitHash (r , remoteName , branchName )
79
79
if head == nil {
80
- return newHead , "" , fmt .Errorf ("The branch '%s/%s' doesn't exist" , remoteName , branchName )
80
+ return newHead , "" , fmt .Errorf ("the branch '%s/%s' doesn't exist" , remoteName , branchName )
81
81
}
82
82
if currentMainCommitId != "" {
83
83
c := plumbing .NewHash (currentMainCommitId )
@@ -100,7 +100,7 @@ func hardReset(r repository, newHead plumbing.Hash) error {
100
100
var w * git.Worktree
101
101
w , err := r .Repository .Worktree ()
102
102
if err != nil {
103
- return fmt .Errorf ("Failed to get the worktree" )
103
+ return fmt .Errorf ("failed to get the worktree" )
104
104
}
105
105
err = w .Checkout (& git.CheckoutOptions {
106
106
Hash : newHead ,
@@ -154,7 +154,7 @@ func isAncestor(r *git.Repository, base, top plumbing.Hash) (found bool, err err
154
154
155
155
// To skip the first commit
156
156
isFirst := true
157
- iter .ForEach (func (commit * object.Commit ) error {
157
+ _ = iter .ForEach (func (commit * object.Commit ) error {
158
158
if ! isFirst && commit .Hash == base {
159
159
found = true
160
160
// This error is ignored and used to terminate early the loop :/
@@ -223,9 +223,9 @@ func manageRemote(r *git.Repository, remote types.Remote) error {
223
223
}
224
224
225
225
func headSignedBy (r * git.Repository , publicKeys []string ) (signedBy * openpgp.Entity , err error ) {
226
- head , err := r .Head ()
226
+ head , _ := r .Head ()
227
227
if head == nil {
228
- return nil , fmt .Errorf ("Repository HEAD should not be nil" )
228
+ return nil , fmt .Errorf ("repository HEAD should not be nil" )
229
229
}
230
230
commit , err := r .CommitObject (head .Hash ())
231
231
if err != nil {
@@ -238,5 +238,5 @@ func headSignedBy(r *git.Repository, publicKeys []string) (signedBy *openpgp.Ent
238
238
return entity , nil
239
239
}
240
240
}
241
- return nil , fmt .Errorf ("Commit %s is not signed" , head .Hash ())
241
+ return nil , fmt .Errorf ("commit %s is not signed" , head .Hash ())
242
242
}
0 commit comments