#
-# 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
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"