fi
}
+check_dups()
+{
+ # "In POSIX sh, 'local' is undefined."
+ # shellcheck disable=SC3043
+ local name base sha dfile
+
+ name="$1"
+ base="$2"
+ sha="$3"
+ if [ "$base" = "HEAD" ]; then
+ dfile="$top_dir/duplicates/next/$name"
+ else
+ dfile="$top_dir/duplicates/linus/$name"
+ fi
+
+ # if there is anything in this tree, then check for duplicates
+ if [ "$(git rev-list --count --no-merges "$base".."$sha")" -eq 0 ]; then
+ rm -f "$dfile"
+ return;
+ fi
+
+ dups=$(git cherry "$base" "$sha" | sed -n 's/^- //p' |
+ xargs -r -n 1 "$tools_dir"/clog | sort)
+ if [ -z "$dups" ]; then
+ rm -f "$dfile"
+ elif ! [ -f "$dfile" ]; then
+ printf '%s\n' "$dups" | tee "$dfile"
+ elif ! printf '%s\n' "$dups" | cmp -s - "$dfile"; then
+ printf '%s\n' "$dups" | comm -23 - "$dfile"
+ printf '%s\n' "$dups" >"$dfile"
+ fi
+}
+
true
done
shift $((OPTIND - 1))
-. "$(dirname "$0")/common.sh"
+tools_dir=$(dirname "$0")
+. "$tools_dir/common.sh"
log()
{
done 7<"../pre-merge/$tree"
fi
log Merging "$h" "($hlog)"
+ check_dups "$tree" HEAD "$h"
msg=$(printf "Merge branch '%s' of %s" "${h#*/}" "$(get_url "$tree")")
if ! execute git merge -m "$msg" "$h"; then
echo Merge failed 1>&2
old_sha=$(git rev-parse "$name/$branch")
"$fun" "$name"
new_sha=$(git rev-parse "$name/$branch")
+ check_dups "$name" origin/master "$new_sha"
if ! [ "$new_sha" = "$old_sha" ]; then
"$tools_dir"/check_commits ^origin/master "$old_sha..$new_sha"
fi
rsync -avHPSUXx --open-noatime --delete \
--exclude "gitk.cache" \
--exclude '.gitk-tmp**' \
+ --include '/duplicates/***' \
--include '/patches/***' \
--include '/mmotm/***' \
--include '/next/***' \