mirror of
https://github.com/netdata/libbpf.git
synced 2026-03-22 09:19:06 +08:00
sync: attempt to auto-resolve non-libbpf conflicts
If cherry-picked commit contains non-libbpf files, chances are high that this will result in conflict, because we are generally skipping commits that didn't touch libbpf files, which means that our working copy will not be up-to-date for non-libbpf files. This change checks if conflicts are only in non-libbpf files and marks them as resolved. This will work fine as long as we don't cherry-pick some more non-libbpf changes to same set of files that happen to conflict with not-so-resolved version of non-libbpf files. But anyways, this should help in a lot of cases. Signed-off-by: Andrii Nakryiko <andriin@fb.com>
This commit is contained in:
committed by
Andrii Nakryiko
parent
6227c6f8dd
commit
2c0e53cb08
@@ -104,6 +104,7 @@ cherry_pick_commits()
|
||||
local should_skip
|
||||
local synced_cnt
|
||||
local manual_check
|
||||
local libbpf_conflict_cnt
|
||||
local desc
|
||||
|
||||
new_commits=$(git rev-list --no-merges --topo-order --reverse ${baseline_tag}..${tip_tag} ${LIBBPF_PATHS[@]})
|
||||
@@ -139,6 +140,21 @@ cherry_pick_commits()
|
||||
# commit hasn't been synced into libbpf yet
|
||||
echo "Picking '${desc}'..."
|
||||
if ! git cherry-pick ${new_commit} &>/dev/null; then
|
||||
echo "Warning! Cherry-picking '${desc} failed, checking if it's non-libbpf files causing problems..."
|
||||
libbpf_conflict_cnt=$(git diff --name-only --diff-filter=U -- ${LIBBPF_PATHS[@]} | wc -l)
|
||||
|
||||
if ((${libbpf_conflict_cnt} == 0)); then
|
||||
echo "Looks like only non-libbpf files have conflicts, ignoring..."
|
||||
git add .
|
||||
# GIT_EDITOR=true to avoid editor popping up to edit commit message
|
||||
if ! GIT_EDITOR=true git cherry-pick --continue; then
|
||||
echo "Error! That still failed! Please resolve manually."
|
||||
else
|
||||
echo "Success! All cherry-pick conflicts were resolved for '${desc}'!"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
|
||||
read -p "Error! Cherry-picking '${desc}' failed, please fix manually and press <return> to proceed..."
|
||||
fi
|
||||
done
|
||||
|
||||
Reference in New Issue
Block a user