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

[PATCH 1/3] filter-branch: fix style of $((...) construct

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

In 6a9d16a (filter-branch: add passed/remaining seconds on progress, 2015-09-07) we introduced a new style to write $((...) expressions: with spaces in the arithmetic expression. We actually introduced *two* new styles, even: some of the $((...)) expressions had spaces after the two opening and before the two closing parentheses, but others did not.

There had been an arithmetic expression in that script, though, and it matched the coding style of the rest of Git's source code: $((...)) expressions simply do not contain spaces.

Let's adjust the style to the previously existing code.
Cc: Gabor Bernat <gabor.bernat@gravityrd.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
---
 git-filter-branch.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/git-filter-branch.sh b/git-filter-branch.sh
index 86b2ff1..1067785 100755
--- a/git-filter-branch.sh
+++ b/git-filter-branch.sh
@@ -283,13 +283,13 @@ report_progress ()
 		count=$git_filter_branch__commit_count
 
 		now=$(date +%s)
-		elapsed=$(($now - $start_timestamp))
-		remaining=$(( ($commits - $count) * $elapsed / $count ))
+		elapsed=$(($now-$start_timestamp))
+		remaining=$((($commits-$count)*$elapsed/$count))
 		if test $elapsed -gt 0
 		then
-			next_sample_at=$(( ($elapsed + 1) * $count / $elapsed ))
+			next_sample_at=$((($elapsed+1)*$count/$elapsed))
 		else
-			next_sample_at=$(($next_sample_at + 1))
+			next_sample_at=$(($next_sample_at+1))
 		fi
 		progress=" ($elapsed seconds passed, remaining $remaining predicted)"
 	fi
-- 
2.7.0.windows.1.7.g55a05c8
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 2 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.