mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-21 16:59:07 +08:00
sync: try harder when git am -3 fails
`git am -3` will give up frequently even in cases when patch can be auto-merged with: ``` Applying: libbpf: Unify low-level map creation APIs w/ new bpf_map_create() error: sha1 information is lacking or useless (src/libbpf.c). error: could not build fake ancestor Patch failed at 0001 libbpf: Unify low-level map creation APIs w/ new bpf_map_create() ``` But `git apply -3` in the same situation will succeed with three-way merge just fine: ``` error: patch failed: src/bpf_gen_internal.h:51 Falling back to three-way merge... Applied patch to 'src/bpf_gen_internal.h' cleanly. ``` So if git am fails, try git apply and if that succeeds, automatically `git am --continue`. If not, fallback to user actions. Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
This commit is contained in:
committed by
Andrii Nakryiko
parent
493bfa8a59
commit
3ef05a585e
@@ -263,8 +263,11 @@ cd_to ${LIBBPF_REPO}
|
||||
git checkout -b ${LIBBPF_SYNC_TAG}
|
||||
|
||||
for patch in $(ls -1 ${TMP_DIR}/patches | tail -n +2); do
|
||||
if ! git am --3way --committer-date-is-author-date "${TMP_DIR}/patches/${patch}"; then
|
||||
read -p "Applying ${TMP_DIR}/patches/${patch} failed, please resolve manually and press <return> to proceed..."
|
||||
if ! git am -3 --committer-date-is-author-date "${TMP_DIR}/patches/${patch}"; then
|
||||
if ! git apply -3 "${TMP_DIR}/patches/${patch}"; then
|
||||
read -p "Applying ${TMP_DIR}/patches/${patch} failed, please resolve manually and press <return> to proceed..."
|
||||
fi
|
||||
git am --continue
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user