@@ -97,11 +97,11 @@ func (g *GitcliCloner) CloneRepo(ctx plugin.SubTaskContext, localDir string) err
9797 if since != nil {
9898 // fixes error described on https://stackoverflow.com/questions/63878612/git-fatal-error-in-object-unshallow-sha-1
9999 // It might be casued by the commit which being deepen has mulitple parent(e.g. a merge commit), not sure.
100- if err := g .execGitCommand (ctx , "-C" , localDir , "repack" , "-d" ); err != nil {
100+ if err := g .execGitCommandIn (ctx , localDir , "repack" , "-d" ); err != nil {
101101 return errors .Default .Wrap (err , "failed to repack the repo" )
102102 }
103103 // deepen would fail on a EMPTY repo, ignore the error
104- if err := g .execGitCommand (ctx , "-C" , localDir , "fetch" , "--deepen=1" ); err != nil {
104+ if err := g .execGitCommandIn (ctx , localDir , "fetch" , "--deepen=1" ); err != nil {
105105 g .logger .Error (err , "failed to deepen the cloned repo" )
106106 }
107107 }
@@ -141,7 +141,10 @@ func (g *GitcliCloner) execGitCloneCommand(ctx plugin.SubTaskContext, localDir s
141141 }
142142 // 3. fetch all new commits from all branches since the given time
143143 args = append ([]string {"fetch" , "--progress" , fmt .Sprintf ("--shallow-since=%s" , since .Format (time .RFC3339 ))}, args ... )
144- return g .execGitCommandIn (ctx , localDir , args ... )
144+ if err := g .execGitCommandIn (ctx , localDir , args ... ); err != nil {
145+ g .logger .Warn (err , "shallow fetch failed" )
146+ }
147+ return nil
145148 } else {
146149 args = append ([]string {"clone" , taskData .Options .Url , localDir , "--progress" , "--bare" }, args ... )
147150 return g .execGitCommand (ctx , args ... )
0 commit comments