From 59cf706b2381d99b39c4d1daf62da9eeccf0ec13 Mon Sep 17 00:00:00 2001
From: Asheesh Laroia <asheesh@asheesh.org>
Date: Thu, 7 Feb 2013 17:16:24 -0800
Subject: [PATCH 1/2] git-mergetool: print filename when it contains %

If git-mergetool was invoked with 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

Do not pass random string to printf as if it were a valid format.
Use format string "%s" and pass the string as data to be formatted
instead.

Signed-off-by: Asheesh Laroia <asheesh@asheesh.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-mergetool.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index c50e18a8998..012afa55494 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -440,7 +440,7 @@ then
 fi
 
 printf "Merging:\n"
-printf "$files\n"
+printf "%s\n" "$files"
 
 IFS='
 '

From 2a9ccfff5553b8ab28eb5a172738cc9f3afadcd5 Mon Sep 17 00:00:00 2001
From: David Aguilar <davvid@gmail.com>
Date: Sat, 9 Feb 2013 17:21:25 -0800
Subject: [PATCH 2/2] difftool--helper: fix printf usage

Do not use a random string as if it is a format string for printf
when showing it literally; instead feed it to '%s' format.

Reported-by: Asheesh Laroia <asheesh@asheesh.org>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-difftool--helper.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-difftool--helper.sh b/git-difftool--helper.sh
index 3d0fe0cd93b..b00ed95dba9 100755
--- a/git-difftool--helper.sh
+++ b/git-difftool--helper.sh
@@ -40,7 +40,7 @@ launch_merge_tool () {
 	# the user with the real $MERGED name before launching $merge_tool.
 	if should_prompt
 	then
-		printf "\nViewing: '$MERGED'\n"
+		printf "\nViewing: '%s'\n" "$MERGED"
 		if use_ext_cmd
 		then
 			printf "Launch '%s' [Y/n]: " \