I am supposed to debug an issue where prowjob have issue checking out to a specific commit f74e42a
prow script:
git init
git remote add origin <upstream repo>.git
if [ -z "$branch" ]; then
git fetch origin
git checkout -f $sha
elif [ -z "$sha" ]; then
git fetch origin +ref/heads/$branch
git checkout -b $branch origin/$branch
else
git fetch origin +refs/heads/$branch:
git checkout $sha -b $branch
fi
The issues comes from the checkout
prow log:
Initialized empty Git repository in /tmp/git/.git/
From <repo>
* branch master -> FETCH_HEAD
* [new branch] master -> origin/master
fatal: reference is not a tree : f74e42a
Note: the git commit f74e42a exist in the source code repo pr.
The commit f74e42a is a local fork repo commit.
Additional notes: I am new to git and have no idea where to start debugging. I have research and most possible reasons are:
- someone else force push, overriding the f74e42a commit.
- commit was squash
- Inside, out (ref)
I am tasked to edit the prow script, and I tried this where someone at the end mention a fix with git pull --all, I tried it but still face same error