Skip to content

Commit

Permalink
git: Remove usage of git symbolic-ref.
Browse files Browse the repository at this point in the history
Not 100% sure why we were doing this before, but as of
git/git@9081a42
this is causing Git to return this error when trying to call `git
checkout -f FETCH_HEAD`:

```
BUG: builtin/checkout.c:1102: should be able to skip past 'refs/heads/' in 'refs/remotes/origin/HEAD'!
```

IIUC, the symbolic-ref command isn't necessary so we can safely remove
it. Local HEAD will be set on the final `git checkout` call.

New command flow:

```
[git init /tmp/git-init-3587814010]
[git remote add origin /tmp/git-init-3399927535]
[git config http.sslVerify false]
[git fetch origin --force ]
[git show -q --pretty=format:%H FETCH_HEAD]
[git checkout -f FETCH_HEAD]
```
  • Loading branch information
wlynch authored and tekton-robot committed Jan 12, 2022
1 parent b701798 commit 097eeb4
Showing 1 changed file with 0 additions and 6 deletions.
6 changes: 0 additions & 6 deletions pkg/git/git.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,12 +119,6 @@ func Fetch(logger *zap.SugaredLogger, spec FetchSpec) error {
logger.Warnf("Failed to set http.sslVerify in git config: %s", err)
return err
}
if spec.Revision == "" {
spec.Revision = "HEAD"
if _, err := run(logger, "", "symbolic-ref", spec.Revision, "refs/remotes/origin/HEAD"); err != nil {
return err
}
}

fetchArgs := []string{"fetch"}
if spec.Submodules {
Expand Down

0 comments on commit 097eeb4

Please sign in to comment.