Signed-off-by: Rogan Dawes <rogan@dawes.za.net>
---
Junio C Hamano wrote:
Yes, you are right. Maybe setting IFS to the empty string is better?
$ printf " ann 1\n ann 2\n" | while IFS="" read i j k ; do echo "<$i>
<$j> <$k>"; done
< ann 1> <> <>
< ann 2> <> <>
$
Admittedly, there are still problems with my version, as you say,
backslashes and newlines will not be handled correctly. My Perl-fu is
weak, however, and my revised solution (IFS="") works for me :-)
Rogan
P.S. Quoting "$files" stops the spaces from being eaten in the preceding
echo line.
diff --git a/git-mergetool.sh b/git-mergetool.sh
index 2f31fa2..facfbc8 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -393,8 +393,8 @@ if test $# -eq 0 ; then
echo "No files need merging"
exit 0
fi
- echo Merging the files: $files
- git ls-files -u | sed -e 's/^[^ ]* //' | sort -u | while read i
+ echo Merging the files: "$files"
+ git ls-files -u | sed -e 's/^[^ ]* //' | sort -u | while
IFS="" read i
do
printf "\n"
merge_file "$i" < /dev/tty > /dev/tty