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

[PATCH] git-mergetool: print filename when it contains %

From
Asheesh Laroia <asheesh@asheesh.org>
Date
Feb 8, 2013, 01:16 UTC
Message-ID
<1360286184-14278-1-git-send-email-asheesh@asheesh.org>

Before this change, if git-mergetool was invoked with regard to files with a percent sign (%) in their names, it would print an error. For example, if you were calling mergetool on a file called "%2F":

    printf: %2F: invalid directive

This changes the behavior to pass "%s" to printf as its first argument to avoid processing the filename as a format string.

Signed-off-by: Asheesh Laroia <asheesh@asheesh.org>
---
 git-mergetool.sh |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/git-mergetool.sh b/git-mergetool.sh
index c50e18a..d2b9289 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -440,7 +440,7 @@ then
 fi
 
 printf "Merging:\n"
-printf "$files\n"
+printf "%s" "$files\n"
 
 IFS='
 '
-- 
1.7.10.4
Next: Junio C Hamano
Message 1 of 4 in “git-mergetool: print filename when it contains %”
  1. git-mergetool: print filename when it contains %Asheesh Laroia, Feb 8, 2013
  2. Junio C HamanoFeb 8, 2013
  3. Asheesh LaroiaFeb 8, 2013
  4. Junio C HamanoFeb 8, 2013

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.