git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Theodore Ts'o <tytso@mit.edu>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org, Theodore Ts'o <tytso@mit.edu>
Subject: [PATCH] mergetool: Replace use of "echo -n" with printf(3) to be more portable
Date: Thu, 29 Mar 2007 11:44:16 -0400	[thread overview]
Message-ID: <11751830651770-git-send-email-tytso@mit.edu> (raw)
In-Reply-To: <11751830653871-git-send-email-tytso@mit.edu>

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 git-mergetool.sh |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/git-mergetool.sh b/git-mergetool.sh
index 7942fd0..3cc428c 100755
--- a/git-mergetool.sh
+++ b/git-mergetool.sh
@@ -44,18 +44,18 @@ function describe_file () {
     branch="$2"
     file="$3"
 
-    echo -n "    "
+    printf "    "
     if test -z "$mode"; then
-	echo -n "'$path' was deleted"
+	printf  "'$path' was deleted"
     elif is_symlink "$mode" ; then
-	echo -n "'$path' is a symlink containing '"
+	printf "'$path' is a symlink containing '"
 	cat "$file"
-	echo -n "'"
+	printf "'"
     else
 	if base_present; then
-	    echo -n "'$path' was created"
+	    printf "'%s' was created" "$path"
 	else
-	    echo -n "'$path' was modified"
+	    printf "'%s' was modified" "$path"
 	fi
     fi
     echo " in the $branch branch"
@@ -64,7 +64,7 @@ function describe_file () {
 
 resolve_symlink_merge () {
     while /bin/true; do
-	echo -n "Use (r)emote or (l)ocal, or (a)bort? "
+	printf "Use (r)emote or (l)ocal, or (a)bort? "
 	read ans
 	case "$ans" in
 	    [lL]*)
@@ -88,7 +88,7 @@ resolve_symlink_merge () {
 
 resolve_deleted_merge () {
     while /bin/true; do
-	echo -n "Use (m)odified or (d)eleted file, or (a)bort? "
+	printf "Use (m)odified or (d)eleted file, or (a)bort? "
 	read ans
 	case "$ans" in
 	    [mM]*)
@@ -157,7 +157,7 @@ merge_file () {
     echo "Normal merge conflict for $path:"
     describe_file "$local_mode" "local" "$LOCAL"
     describe_file "$remote_mode" "remote" "$REMOTE"
-    echo -n "Hit return to start merge resolution tool ($merge_tool): "
+    printf "Hit return to start merge resolution tool ($merge_tool): "
     read ans
 
     case "$merge_tool" in
@@ -193,7 +193,7 @@ merge_file () {
 	    else
 		while true; do
 		    echo "$path seems unchanged."
-		    echo -n "Was the merge successful? [y/n] "
+		    printf "Was the merge successful? [y/n] "
 		    read answer < /dev/tty
 		    case "$answer" in
 			y*|Y*) status=0; break ;;
@@ -225,7 +225,7 @@ merge_file () {
 	    else
 		while true; do
 		    echo "$path seems unchanged."
-		    echo -n "Was the merge successful? [y/n] "
+		    printf "Was the merge successful? [y/n] "
 		    read answer < /dev/tty
 		    case "$answer" in
 			y*|Y*) status=0; break ;;
@@ -346,12 +346,12 @@ if test $# -eq 0 ; then
 	echo Merging the files: $files
 	git ls-files -u | sed -e 's/^[^	]*	//' | sort -u | while read i
 	do
-		echo ""
+		printf "\n"
 		merge_file "$i" < /dev/tty > /dev/tty
 	done
 else
 	while test $# -gt 0; do
-		echo ""
+		printf "\n"
 		merge_file "$1"
 		shift
 	done
-- 
1.5.1.rc2.1.g8afe-dirty

  reply	other threads:[~2007-03-29 15:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-29 15:44 [GIT PULL] git mergetool fixes Theodore Ts'o
2007-03-29 15:44 ` [PATCH] Fix minor formatting issue in man page for git-mergetool Theodore Ts'o
2007-03-29 15:44   ` Theodore Ts'o [this message]
2007-03-29 15:44     ` [PATCH] mergetool: Don't error out in the merge case where the local file is deleted Theodore Ts'o
2007-03-29 15:44       ` [PATCH] mergetool: portability fix: don't assume true is in /bin Theodore Ts'o
2007-03-29 15:44         ` [PATCH] mergetool: portability fix: don't use reserved word function Theodore Ts'o
2007-03-29 15:44           ` [PATCH] mergetool: factor out common code Theodore Ts'o
2007-03-29 15:44             ` [PATCH] mergetool: Remove spurious error message if merge.tool config option not set Theodore Ts'o
2007-03-29 15:44               ` [PATCH] mergetool: Fix abort command when resolving symlinks and deleted files Theodore Ts'o
2007-03-29 15:44                 ` [PATCH] mergetool: Add support for Apple Mac OS X's opendiff command Theodore Ts'o
2007-03-29 15:44                   ` [PATCH] mergetool: Make git-rm quiet when resolving a deleted file conflict Theodore Ts'o
2007-03-29 15:44                     ` [PATCH] mergetool: Clean up description of files and prompts for merge resolutions Theodore Ts'o
2007-03-29 22:29                       ` Matthias Lederhofer
2007-03-30  2:54                         ` Theodore Tso
2007-03-30 14:46                           ` Randal L. Schwartz
2007-03-29 15:57     ` [PATCH] mergetool: Replace use of "echo -n" with printf(3) to be more portable Matthias Lederhofer
2007-03-29 17:09       ` Theodore Tso
2007-03-29 22:02         ` Junio C Hamano
2007-03-29 22:15           ` 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=11751830651770-git-send-email-tytso@mit.edu \
    --to=tytso@mit.edu \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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).