From: Stephen Rothwell Date: Mon, 21 Jul 2025 22:00:45 +0000 (+1000) Subject: make the dup checking more realistic X-Git-Url: http://git.ozlabs.org/?a=commitdiff_plain;h=HEAD;p=next-scripts make the dup checking more realistic remove dups we have already seen in earlier trees --- diff --git a/check_dups.sh b/check_dups.sh index 85e716e..ac1cb35 100644 --- a/check_dups.sh +++ b/check_dups.sh @@ -1,21 +1,20 @@ # -# shared check_dups funciont +# shared check_dups funcion # check_dups() { # "In POSIX sh, 'local' is undefined." # shellcheck disable=SC3043 - local name base sha dfile + local name base sha dfile o ol oh name="$1" base="$2" sha="$3" - dlfile="$top_dir/duplicates/linus/$name" if [ "$base" = "HEAD" ]; then dfile="$top_dir/duplicates/next/$name" else - dfile="$dlfile" + dfile="$top_dir/duplicates/linus/$name" fi # if there is anything in this tree, then check for duplicates @@ -26,8 +25,34 @@ check_dups() dups=$(git cherry "$base" "$sha" | sed -n 's/^- //p' | xargs -r -n 1 "$tools_dir"/clog | sort) - if [ "$base" = "HEAD" ] && [ -f "$dlfile" ]; then - dups=$(printf '%s\n' "$dups" | comm -23 - "$dlfile") + + if ! [ -z "$dups" ]; then + for o in $(get_branches "$name"); do + ol="$top_dir/duplicates/linus/$o" + if [ -f "$ol" ]; then + dups=$(printf '%s\n' "$dups" | comm -23 - "$ol") + fi + if [ -z "$dups" ]; then + break + fi + if ! [ "$base" = "HEAD" ]; then + continue + fi + ol="$top_dir/duplicates/linus/$name" + if [ -f "$ol" ]; then + dups=$(printf '%s\n' "$dups" | comm -23 - "$ol") + fi + if [ -z "$dups" ]; then + break + fi + oh="$top_dir/duplicates/next/$o" + if [ -f "$oh" ]; then + dups=$(printf '%s\n' "$dups" | comm -23 - "$oh") + fi + if [ -z "$dups" ]; then + break + fi + done fi if [ -z "$dups" ]; then rm -f "$dfile" diff --git a/common.sh b/common.sh index 272d269..e352901 100644 --- a/common.sh +++ b/common.sh @@ -82,7 +82,7 @@ get_control_field() get_branches() { - awk -F "$_TAB" '/^[^-#]/ && $2=="git"{ print $3; }' "$CTRL_FILE" + awk -F "$_TAB" -v stop="$1" '/^[^-#]/ && $2=="git" { if ($3==stop) { exit 0 }; print $3 }' "$CTRL_FILE" } get_pending_branches()