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

[PATCH 2/3] rebase--interactive: adjust the coding style of $((...))

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Feb 4, 2016, 12:02 UTC
Message-ID
<dbd8ee3b1de55b7414c91bf203be2aaa77b78822.1454587284.git.johannes.schindelin@gmx.de>
In-Reply-To
<cover.1454587284.git.johannes.schindelin@gmx.de>

In 180bad3 (rebase -i: respect core.commentchar, 2013-02-11) we changed the coding style of an arithmetic expression to introduce spaces. The existing $((...)) expression did not use that convention, though, and neither was it the habit of the other shell scripts in Git's source code.

Later, 1db168e (rebase-i: loosen over-eager check_bad_cmd check, 2015-10-01) repeated the same coding style, again not matching the rest of the source code's style.

Let's make the coding style consistent again.
Cc: John Keeping <john@keeping.me.uk>
Cc: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-rebase--interactive.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index c0cfe88..3e2bd1b 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -122,7 +122,7 @@ mark_action_done () {
 	mv -f "$todo".new "$todo"
 	new_count=$(git stripspace --strip-comments <"$done" | wc -l)
 	echo $new_count >"$msgnum"
-	total=$(($new_count + $(git stripspace --strip-comments <"$todo" | wc -l)))
+	total=$(($new_count+$(git stripspace --strip-comments <"$todo" | wc -l)))
 	echo $total >"$end"
 	if test "$last_count" != "$new_count"
 	then
@@ -895,7 +895,7 @@ check_bad_cmd_and_sha () {
 	lineno=0
 	while read -r command rest
 	do
-		lineno=$(( $lineno + 1 ))
+		lineno=$(($lineno+1))
 		case $command in
 		"$comment_char"*|''|noop|x|exec)
 			# Doesn't expect a SHA-1
-- 
2.7.0.windows.1.7.g55a05c8
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 3 of 13 in “Fix $((...)) coding style”
  1. 0/3 Fix $((...)) coding styleJohannes Schindelin, Feb 4, 2016
  2. 1/3 filter-branch: fix style of $((...) constructJohannes Schindelin, Feb 4, 2016
  3. 2/3 rebase--interactive: adjust the coding style of $((...))Johannes Schindelin, Feb 4, 2016
  4. 3/3 rebase --merge: adjust $((...)) coding styleJohannes Schindelin, Feb 4, 2016
  5. John KeepingFeb 4, 2016
  6. Johannes SchindelinFeb 4, 2016
  7. John KeepingFeb 4, 2016
  8. Johannes SchindelinFeb 4, 2016
  9. John KeepingFeb 4, 2016
  10. Johannes SchindelinFeb 4, 2016
  11. John KeepingFeb 4, 2016
  12. Junio C HamanoFeb 4, 2016
  13. Junio C HamanoFeb 4, 2016

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.