buildscript: fix fetch step

git pull combines two steps: fetch and merge. When checking out
another revision into an existing build directory, git pull tries to merge
the changes from the new revision into the current HEAD, before checking
out the new revision with git checkout. Because we apply various patches
to OpenWrt, the merge step almost certainly fails, so the new revision
is not checked out.

As the merge isn't needed anyway, use git fetch instead, which only
fetches updates from the remote without actually applying them.

Signed-off-by: Fabian Bläse <fabian@blaese.de>
This commit is contained in:
Fabian Bläse 2021-06-04 00:27:22 +02:00
parent 68ec1a616b
commit 08626f9e96
1 changed files with 1 additions and 1 deletions

View File

@ -62,7 +62,7 @@ checkout_git(){
# Select desired commit and remove local changes (-f)
if ! $MYGIT checkout -f "$COMMITID" ; then
echo "commitid not found trying to fetch new commits"
$MYGIT pull && $MYGIT checkout "$COMMITID"
$MYGIT fetch --all && $MYGIT checkout "$COMMITID"
fi
else
echo "wrong remote or not an git repo at all -> deleting whole directory"