From ede18f80d8f094b76d9fe686f757e525ad1c060f Mon Sep 17 00:00:00 2001 From: Andrii Nakryiko Date: Thu, 26 Sep 2019 12:52:09 -0700 Subject: [PATCH] scripts: fix empty cherry-pick handling, fix IGNORE_CONSISTENCY check Fix two issues I've encountered during latest bpf/bpf-next sync. Signed-off-by: Andrii Nakryiko --- scripts/sync-kernel.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/scripts/sync-kernel.sh b/scripts/sync-kernel.sh index 0866a99..fd9e2c4 100755 --- a/scripts/sync-kernel.sh +++ b/scripts/sync-kernel.sh @@ -165,9 +165,16 @@ cherry_pick_commits() 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) + conflict_cnt=$(git diff --name-only | wc -l) if ((${libbpf_conflict_cnt} == 0)); then echo "Looks like only non-libbpf files have conflicts, ignoring..." + if ((${conflict_cnt} == 0)); then + echo "Empty cherry-pick, skipping it..." + git cherry-pick --abort + continue + fi + git add . # GIT_EDITOR=true to avoid editor popping up to edit commit message if ! GIT_EDITOR=true git cherry-pick --continue &>/dev/null; then @@ -313,7 +320,7 @@ if ((${CONSISTENT} == 1)); then echo "Great! Content is identical!" else echo "Unfortunately, there are consistency problems!" - if ((${IGNORE_CONSISTENCY} != 1)); then + if ((${IGNORE_CONSISTENCY-0} != 1)); then exit 4 fi fi