Thread (7 messages) flat view 7 messages, 1 author, 2016-06-15

Re: [PATCH 3/5] Replace $((...)) with expr invocations.

From: Ralf Wildenhues <hidden>
Date: 2016-06-15 22:43:47
Subsystem: the rest · Maintainer: Linus Torvalds

---
 git-filter-branch.sh       |    4 ++--
 git-rebase--interactive.sh |    8 ++++----
 git-rebase.sh              |    8 ++++----
 3 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index ffcc408..2d5c247 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -253,7 +253,7 @@ test $commits -eq 0 && die "Found nothing to rewrite"
 
 i=0
 while read commit parents; do
-	i=$(($i+1))
+	i=$(expr $i + 1)
 	printf "\rRewrite $commit ($i/$commits)"
 
 	case "$filter_subdir" in
@@ -374,7 +374,7 @@ do
 	;;
 	esac
 	git update-ref -m "filter-branch: backup" "$orig_namespace$ref" $sha1
-	count=$(($count+1))
+	count=$(expr $count + 1)
 done < "$tempdir"/heads
 
 # TODO: This should possibly go, with the semantics that all positive given
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index ecc6778..da48aaf 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -71,8 +71,8 @@ mark_action_done () {
 	sed -e 1q < "$TODO" >> "$DONE"
 	sed -e 1d < "$TODO" >> "$TODO".new
 	mv -f "$TODO".new "$TODO"
-	count=$(($(grep -ve '^$' -e '^#' < "$DONE" | wc -l)))
-	total=$(($count+$(grep -ve '^$' -e '^#' < "$TODO" | wc -l)))
+	count=$(grep -ve '^$' -e '^#' < "$DONE" | wc -l)
+	total=$(expr $count + $(grep -ve '^$' -e '^#' < "$TODO" | wc -l))
 	printf "Rebasing (%d/%d)\r" $count $total
 	test -z "$VERBOSE" || echo
 }
@@ -205,8 +205,8 @@ nth_string () {
 
 make_squash_message () {
 	if test -f "$SQUASH_MSG"; then
-		COUNT=$(($(sed -n "s/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p" \
-			< "$SQUASH_MSG" | tail -n 1)+1))
+		COUNT=$(expr $(sed -n "s/^# This is [^0-9]*\([1-9][0-9]*\).*/\1/p" \
+			< "$SQUASH_MSG" | tail -n 1) + 1)
 		echo "# This is a combination of $COUNT commits."
 		sed -n "2,\$p" < "$SQUASH_MSG"
 	else
diff --git a/git-rebase.sh b/git-rebase.sh
index 224cca9..daa347a 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -79,7 +79,7 @@ continue_merge () {
 	echo "$prev_head" > "$dotest/prev_head"
 
 	# onto the next patch:
-	msgnum=$(($msgnum + 1))
+	msgnum=$(expr $msgnum + 1)
 	echo "$msgnum" >"$dotest/msgnum"
 }
 
@@ -90,7 +90,7 @@ call_merge () {
 	cmt_name=$(git symbolic-ref HEAD)
 	msgnum=$(cat "$dotest/msgnum")
 	end=$(cat "$dotest/end")
-	eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(($end - $msgnum))"'
+	eval GITHEAD_$cmt='"${cmt_name##refs/heads/}~$(expr $end - $msgnum)"'
 	eval GITHEAD_$hd='$(cat "$dotest/onto_name")'
 	export GITHEAD_$cmt GITHEAD_$hd
 	git-merge-$strategy "$cmt^" -- "$hd" "$cmt"
@@ -163,7 +163,7 @@ do
 			prev_head=$(cat "$dotest/prev_head")
 			end=$(cat "$dotest/end")
 			msgnum=$(cat "$dotest/msgnum")
-			msgnum=$(($msgnum + 1))
+			msgnum=$(expr $msgnum + 1)
 			onto=$(cat "$dotest/onto")
 			while test "$msgnum" -le "$end"
 			do
@@ -349,7 +349,7 @@ echo "$prev_head" > "$dotest/prev_head"
 msgnum=0
 for cmt in `git rev-list --reverse --no-merges "$upstream"..ORIG_HEAD`
 do
-	msgnum=$(($msgnum + 1))
+	msgnum=$(expr $msgnum + 1)
 	echo "$cmt" > "$dotest/cmt.$msgnum"
 done
 
-- 
1.5.3.5.561.g140d
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help