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

[PATCH 1/2] rebase-i: style fix

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 6, 2010, 06:27 UTC
Message-ID
<1278397631-20658-2-git-send-email-gitster@pobox.com>
In-Reply-To
<1278397631-20658-1-git-send-email-gitster@pobox.com>
Case arms should align with "case" and "esac".

Do not cat a file into a pipeline; just make the downstream command read from the file.

Having a while statement as a downstream of a pipe is fine, but the loop should begin on its own line.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 git-rebase--interactive.sh |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 6b86abc..ed57552 100755
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -263,10 +263,10 @@ pick_one_preserving_merges () {
 	then
 		if test "$fast_forward" = t
 		then
-			cat "$DOTEST"/current-commit | while read current_commit
+			while read current_commit
 			do
 				git rev-parse HEAD > "$REWRITTEN"/$current_commit
-			done
+			done <"$DOTEST"/current-commit
 			rm "$DOTEST"/current-commit ||
 			die "Cannot write current commit's replacement sha1"
 		fi
@@ -440,9 +440,9 @@ record_in_rewritten() {
 	echo "$oldsha1" >> "$REWRITTEN_PENDING"
 
 	case "$(peek_next_command)" in
-	    squash|s|fixup|f)
+	squash|s|fixup|f)
 		;;
-	    *)
+	*)
 		flush_rewritten_pending
 		;;
 	esac
@@ -890,7 +890,8 @@ first and then run 'git rebase --continue' again."
 		git rev-list $MERGES_OPTION --pretty=oneline --abbrev-commit \
 			--abbrev=7 --reverse --left-right --topo-order \
 			$REVISIONS | \
-			sed -n "s/^>//p" | while read shortsha1 rest
+			sed -n "s/^>//p" |
+		while read shortsha1 rest
 		do
 			if test t != "$PRESERVE_MERGES"
 			then
-- 
1.7.2.rc1.209.g3868f
Previous: Junio C HamanoNext: Junio C Hamano
Message 2 of 4 in “rebase-i minifixes”
  1. 0/2 rebase-i minifixesJunio C Hamano, Jul 6, 2010
  2. 1/2 rebase-i: style fixJunio C Hamano, Jul 6, 2010
  3. 2/2 rebase-i: do not get fooled by a log message ending with backslashJunio C Hamano, Jul 6, 2010
  4. Jonathan NiederJul 6, 2010

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.