Jonathon Mah [off-list ref] writes:
if test $# -eq 0 ; then
cd_to_toplevel
if test -e "$GIT_DIR/MERGE_RR"
then
+ files=$(git rerere remaining)
+ else
+ files=$(git ls-files -u | sed -e 's/^[^ ]* //' | sort -u)
fi
else
while test $# -gt 0; do
+ matches=$(git ls-files -u -- "$1" | sed -e 's/^[^ ]* //' | sort -u)
+ if test -n "$matches"; then
+ if test -z "$files"; then
+ files=$matches
+ else
+ files=$(printf "%s\n%s" "$files" "$matches")
+ fi
fi
shift
done
+ files=$(printf "%s" "$files" | sort -u)
fi
Why do you need a loop here in the else clause, instead of just a single:
files=$(git ls-files -u -- "$@" |...)