git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rogan Dawes <rogan@dawes.za.net>
To: Git Mailing List <git@vger.kernel.org>
Subject: [PATCH] Allow git-mergetool to handle paths with a leading space
Date: Sun, 06 Jan 2008 11:25:18 +0200	[thread overview]
Message-ID: <47809E7E.2090708@dawes.za.net> (raw)

[-- Attachment #1: Type: text/plain, Size: 996 bytes --]

Signed-off-by: Rogan Dawes <rogan@dawes.za.net>

---
I am working on a project which has the root directory constructed with 
a leading space. i.e. ./ dir/. "read" skips the leading space char, and 
ends up with an incorrect filename, which can then not be found. Setting 
IFS=\n solves this problem.

Thanks to Mikachu and Tv on #git for assistance and suggestions.

Unfortunately, Thunderbird is not very easy to convince not to mangle 
patches, so I am attaching the patch as well. Sorry.

diff --git a/git-mergetool.sh b/git-mergetool.sh
index 2f31fa2..8521ca3 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -394,7 +394,7 @@ if test $# -eq 0 ; then
                 exit 0
         fi
         echo Merging the files: $files
-       git ls-files -u | sed -e 's/^[^ ]*      //' | sort -u | while read i
+       git ls-files -u | sed -e 's/^[^ ]*      //' | sort -u | while 
IFS=\n read i
         do
                 printf "\n"
                 merge_file "$i" < /dev/tty > /dev/tty

[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 417 bytes --]

diff --git a/git-mergetool.sh b/git-mergetool.sh
index 2f31fa2..8521ca3 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -394,7 +394,7 @@ if test $# -eq 0 ; then
 		exit 0
 	fi
 	echo Merging the files: $files
-	git ls-files -u | sed -e 's/^[^	]*	//' | sort -u | while read i
+	git ls-files -u | sed -e 's/^[^	]*	//' | sort -u | while IFS=\n read i
 	do
 		printf "\n"
 		merge_file "$i" < /dev/tty > /dev/tty

             reply	other threads:[~2008-01-06  9:29 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-06  9:25 Rogan Dawes [this message]
2008-01-06 10:18 ` [PATCH] Allow git-mergetool to handle paths with a leading space Junio C Hamano
2008-01-06 10:51   ` Rogan Dawes
2008-01-06 11:48     ` Junio C Hamano
2008-01-07  7:37       ` Rogan Dawes
2008-01-07  9:09         ` Junio C Hamano
2008-01-08  1:19           ` Theodore Tso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47809E7E.2090708@dawes.za.net \
    --to=rogan@dawes.za.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).