Skip to contentSkip to conversation

rebase: standardize on $() for command substitution

PATCH In review Dan McGee 2 participants 3 messages Jun 15, 2016

lore
Share & tools
lore

Dan McGee

author
#0 lore raw

PATCH 1/1 rebase: standardize on $() for command substitution

Commit 889a50e909dba5f4416049afc5eeae601fe133bc changed several `` to $() format for command substitution, so we should standardize on one format for clarity.

---
 git-rebase.sh |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
git-rebase.sh +8 -8
index 224cca9..63dea56 100755
@@ -59,7 +59,7 @@ continue_merge () {
 		die "$RESOLVEMSG"
 	fi
 
-	cmt=`cat "$dotest/current"`
+	cmt=$(cat "$dotest/current")
 	if ! git diff-index --quiet HEAD
 	then
 		if ! git-commit -C "$cmt"
@@ -74,7 +74,7 @@ continue_merge () {
 	fi
 	git rev-list --pretty=oneline -1 "$cmt" | sed -e 's/^[^ ]* //'
 
-	prev_head=`git rev-parse HEAD^0`
+	prev_head=$(git rev-parse HEAD^0)
 	# save the resulting commit so we can read-tree on it later
 	echo "$prev_head" > "$dotest/prev_head"
 
@@ -203,7 +203,7 @@ do
 	-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
 		case "$#,$1" in
 		*,*=*)
-			strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
+			strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)'` ;)
 		1,*)
 			usage ;;
 		*)
@@ -265,7 +265,7 @@ esac
 
 # The upstream head must be given.  Make sure it is valid.
 upstream_name="$1"
-upstream=`git rev-parse --verify "${upstream_name}^0"` ||
+upstream=$(git rev-parse --verify "${upstream_name}^0") ||
     die "invalid upstream $upstream_name"
 
 # Make sure the branch to rebase onto is valid.
@@ -288,9 +288,9 @@ case "$#" in
 	git-checkout "$2" || usage
 	;;
 *)
-	if branch_name=`git symbolic-ref -q HEAD`
+	if branch_name=$(git symbolic-ref -q HEAD)
 	then
-		branch_name=`expr "z$branch_name" : 'zrefs/heads/\(.*\)'`
+		branch_name=$(expr "z$branch_name" : 'zrefs/heads/\(.*\)')
 	else
 		branch_name=HEAD ;# detached
 	fi
@@ -343,11 +343,11 @@ fi
 mkdir -p "$dotest"
 echo "$onto" > "$dotest/onto"
 echo "$onto_name" > "$dotest/onto_name"
-prev_head=`git rev-parse HEAD^0`
+prev_head=$(git rev-parse HEAD^0)
 echo "$prev_head" > "$dotest/prev_head"
 
 msgnum=0
-for cmt in `git rev-list --reverse --no-merges "$upstream"..ORIG_HEAD`
+for cmt in $(git rev-list --reverse --no-merges "$upstream"..ORIG_HEAD)
 do
 	msgnum=$(($msgnum + 1))
 	echo "$cmt" > "$dotest/cmt.$msgnum"
Signature · 1 line
1.5.3.5
#1 lore raw

git-rebase.sh do · line 209

Quoted 13 lines · Dan McGee

Commit 889a50e909dba5f4416049afc5eeae601fe133bc changed several `` to $() format for command substitution, so we should standardize on one format for clarity.
...

git-rebase.sh +1 -1
@@ -203,7 +203,7 @@ do
 	-s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
 		case "$#,$1" in
 		*,*=*)
-			strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
+			strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)'` ;)
 		1,*)
 			usage ;;
 		*)

The patch might have meant well, but it is a rather unnecessary code churn without fixing anything and introducing a bug X-<.

author
#2 lore raw
Quoted 18 lines · Junio C Hamano

git-rebase.sh do · line 209

Quoted 13 lines · Dan McGee

Commit 889a50e909dba5f4416049afc5eeae601fe133bc changed several `` to $() format for command substitution, so we should standardize on one format for clarity.
...

git-rebase.sh +1 -1
@@ -203,7 +203,7 @@ do
      -s|--s|--st|--str|--stra|--strat|--strate|--strateg|--strategy)
              case "$#,$1" in
              *,*=*)
-                     strategy=`expr "z$1" : 'z-[^=]*=\(.*\)'` ;;
+                     strategy=$(expr "z$1" : 'z-[^=]*=\(.*\)'` ;)
              1,*)
                      usage ;;
              *)

The patch might have meant well, but it is a rather unnecessary code churn without fixing anything and introducing a bug X-<.

Wow, back to the drawing board here. I've been up too long today.

-Dan