mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-17 00:47:03 +00:00
less confusing lint error msg when bumping to very recent commit (#5400)
When bumping to a more recent commit than the configured `branch`, currently the lint error message is confusing: ``` fatal: error processing shallow info: 4 Submodule 'vendor/nim-chronos': Failed to fetch 'master': ``` This happens when the selected commit is more recent than the latest one on the `branch`. Comparing the commit dates allows a better message.
This commit is contained in:
parent
89d133d0e5
commit
f420f09ac1
11
.github/workflows/ci.yml
vendored
11
.github/workflows/ci.yml
vendored
@ -225,15 +225,20 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
# Without the `--depth=1` fetch, may run into 'error processing shallow info: 4'
|
# Without the `--depth=1` fetch, may run into 'error processing shallow info: 4'
|
||||||
if ! error="$(git -C "$file" fetch -q --depth=1 origin "+refs/heads/${branch}:refs/remotes/origin/${branch}")"; then
|
if ! error="$(git -C "$file" fetch -q --depth=1 origin "+refs/heads/${branch}:refs/remotes/origin/${branch}")"; then
|
||||||
echo "Submodule '$file': Failed to fetch '$branch': $error"
|
echo "Submodule '$file': Failed to fetch '$branch': $error (1)"
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
branch_commit_date=$(git -C "$file" show -s --format='%ci' "refs/remotes/origin/${branch}")
|
||||||
|
if [[ "${commit_date}" > "${branch_commit_date}" ]]; then
|
||||||
|
echo "Submodule '$file': '$commit' ($commit_date) is more recent than latest '$branch' ($branch_commit_date) (branch config: '.gitmodules')"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
if ! error="$(git -C "$file" fetch -q --shallow-since="$commit_date" origin "+refs/heads/${branch}:refs/remotes/origin/${branch}")"; then
|
if ! error="$(git -C "$file" fetch -q --shallow-since="$commit_date" origin "+refs/heads/${branch}:refs/remotes/origin/${branch}")"; then
|
||||||
echo "Submodule '$file': Failed to fetch '$branch': $error"
|
echo "Submodule '$file': Failed to fetch '$branch': $error (2)"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
if ! git -C "$file" merge-base --is-ancestor "$commit" "refs/remotes/origin/$branch"; then
|
if ! git -C "$file" merge-base --is-ancestor "$commit" "refs/remotes/origin/$branch"; then
|
||||||
echo "Submodule '$file': '$commit' is not on '$branch' as of '$commit_date' (branch config: '.gitmodules')"
|
echo "Submodule '$file': '$commit' is not on '$branch' as of $commit_date (branch config: '.gitmodules')"
|
||||||
exit 2
|
exit 2
|
||||||
fi
|
fi
|
||||||
done < <(git diff --name-only --diff-filter=AM HEAD^ HEAD | grep -f <(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') || true)
|
done < <(git diff --name-only --diff-filter=AM HEAD^ HEAD | grep -f <(git config --file .gitmodules --get-regexp path | awk '{ print $2 }') || true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user