From: Junio C Hamano Date: Wed, 22 Jun 2011 21:33:12 GMT Subject: Re: [PATCH 2/2] mergetool: Don't assume paths are unmerged Message-ID: <7v1uyl5z6v.fsf@alter.siamese.dyndns.org> In-Reply-To: <92B6FB42-FE0D-48DC-ABD0-BA1903D842D2@JonathonMah.com> Jonathon Mah 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 -- "$@" |...)