git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Allow git-mergetool to handle paths with a leading space

From
RDRogan Dawes <rogan@dawes.za.net>
Date
Jan 6, 2008, 09:25 UTC
Message-ID
<47809E7E.2090708@dawes.za.net>
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


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
Next: Junio C Hamano
Message 1 of 7 in “Allow git-mergetool to handle paths with a leading space”
  1. Allow git-mergetool to handle paths with a leading spaceRogan Dawes, Jan 6, 2008
  2. Junio C HamanoJan 6, 2008
  3. Rogan DawesJan 6, 2008
  4. Junio C HamanoJan 6, 2008
  5. Allow git-mergetool to handle paths with a leading spaceRogan Dawes, Jan 7, 2008
  6. Junio C HamanoJan 7, 2008
  7. Theodore TsoJan 8, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.