vendor: update buildkit to v0.17.0-rc2

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
This commit is contained in:
Tonis Tiigi
2024-10-28 14:56:43 -07:00
parent 202c390fca
commit 6fcc6853d9
195 changed files with 3522 additions and 5281 deletions

View File

@ -218,6 +218,14 @@ func (cli *GitCLI) Run(ctx context.Context, args ...string) (_ []byte, err error
continue
}
}
if strings.Contains(errbuf.String(), "not our ref") || strings.Contains(errbuf.String(), "unadvertised object") {
// server-side error: https://github.com/git/git/blob/34b6ce9b30747131b6e781ff718a45328aa887d0/upload-pack.c#L811-L812
// client-side error: https://github.com/git/git/blob/34b6ce9b30747131b6e781ff718a45328aa887d0/fetch-pack.c#L2250-L2253
if newArgs := argsNoCommitRefspec(args); len(args) > len(newArgs) {
args = newArgs
continue
}
}
return buf.Bytes(), errors.Wrapf(err, "git stderr:\n%s", errbuf.String())
}
@ -244,3 +252,19 @@ func argsNoDepth(args []string) []string {
}
return out
}
func argsNoCommitRefspec(args []string) []string {
if len(args) <= 2 {
return args
}
if args[0] != "fetch" {
return args
}
// assume the refspec is the last arg
if IsCommitSHA(args[len(args)-1]) {
return args[:len(args)-1]
}
return args
}

View File

@ -0,0 +1,19 @@
package gitutil
func IsCommitSHA(str string) bool {
if len(str) != 40 {
return false
}
for _, ch := range str {
if ch >= '0' && ch <= '9' {
continue
}
if ch >= 'a' && ch <= 'f' {
continue
}
return false
}
return true
}