Skip to content

Commit 34166db

Browse files
committed
Add more context to "git fetch" failures
This makes it a lot easier to see/debug what's going wrong: ```console $ BASHBREW_CACHE=/tmp/foo bashbrew fetch --arch-filter ubuntu:bionic failed fetching git repo for "ubuntu" (tags "18.04, bionic-20230126, bionic" on arch "amd64") failed fetching "f127810992c0981574cc137b9c83937ca1a304dc:refs/remotes/temp3848952252/temp": server does not support exact SHA1 refspec failed finding Git commit "f127810992c0981574cc137b9c83937ca1a304dc" after fetching "refs/tags/dist-bionic-amd64-20230126:refs/remotes/temp3848952252/temp": object not found ```
1 parent d5c8f9a commit 34166db

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cmd/bashbrew/git.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,13 +254,14 @@ func (r Repo) fetchGitRepo(arch string, entry *manifest.Manifest2822Entry) (stri
254254
//Progress: os.Stdout,
255255
})
256256
if err != nil {
257-
fetchErrors = append(fetchErrors, err)
257+
fetchErrors = append(fetchErrors, fmt.Errorf("failed fetching %q: %w", fetchString, err))
258258
continue
259259
}
260260

261-
commit, err = getGitCommit(entry.ArchGitCommit(arch))
261+
archCommit := entry.ArchGitCommit(arch)
262+
commit, err = getGitCommit(archCommit)
262263
if err != nil {
263-
fetchErrors = append(fetchErrors, err)
264+
fetchErrors = append(fetchErrors, fmt.Errorf("failed finding Git commit %q after fetching %q: %w", archCommit, fetchString, err))
264265
continue
265266
}
266267

0 commit comments

Comments
 (0)