Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1884 from weaveworks/bug/support-git-221
Browse files Browse the repository at this point in the history
Support Git >=2.21
  • Loading branch information
hiddeco authored Apr 1, 2019
2 parents 1916fe8 + 94b74d5 commit bd7a91e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion git/operations.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,12 @@ func push(ctx context.Context, workingDir, upstream string, refs []string) error
// fetch updates refs from the upstream.
func fetch(ctx context.Context, workingDir, upstream string, refspec ...string) error {
args := append([]string{"fetch", "--tags", upstream}, refspec...)
// In git <=2.20 the error started with an uppercase, in 2.21 this
// was changed to be consistent with all other die() and error()
// messages, cast to lowercase to support both versions.
// Ref: https://github.com/git/git/commit/0b9c3afdbfb62936337efc52b4007a446939b96b
if err := execGitCmd(ctx, args, gitCmdConfig{dir: workingDir}); err != nil &&
!strings.Contains(err.Error(), "Couldn't find remote ref") {
!strings.Contains(strings.ToLower(err.Error()), "couldn't find remote ref") {
return errors.Wrap(err, fmt.Sprintf("git fetch --tags %s %s", upstream, refspec))
}
return nil
Expand Down

0 comments on commit bd7a91e

Please sign in to comment.