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

[PATCH] style: indent multiline "if" conditions by 4 spaces

From
Jeff King <peff@peff.net>
Date
Dec 3, 2020, 08:00 UTC
Message-ID
<X8ibEpkel8OMS/hV@coredump.intra.peff.net>

Commit 6dc905d974 (config: split repo scope to local and worktree, 2020-02-10) made some "if" statements multiline, but didn't indent the second lines in our usual way.

Signed-off-by: Jeff King <peff@peff.net>
---
I just happened to be reading nearby code and saw this.
 remote.c      | 2 +-
 upload-pack.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/remote.c b/remote.c
index 8a6dbbb903..8b9d090ae5 100644
--- a/remote.c
+++ b/remote.c
@@ -355,7 +355,7 @@ static int handle_config(const char *key, const char *value, void *cb)
 	remote = make_remote(name, namelen);
 	remote->origin = REMOTE_CONFIG;
 	if (current_config_scope() == CONFIG_SCOPE_LOCAL ||
-	current_config_scope() == CONFIG_SCOPE_WORKTREE)
+	    current_config_scope() == CONFIG_SCOPE_WORKTREE)
 		remote->configured_in_repo = 1;
 	if (!strcmp(subkey, "mirror"))
 		remote->mirror = git_config_bool(key, value);
diff --git a/upload-pack.c b/upload-pack.c
index 5dc8e1f844..a85d4ec502 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -1302,7 +1302,7 @@ static int upload_pack_config(const char *var, const char *value, void *cb_data)
 	}
 
 	if (current_config_scope() != CONFIG_SCOPE_LOCAL &&
-	current_config_scope() != CONFIG_SCOPE_WORKTREE) {
+	    current_config_scope() != CONFIG_SCOPE_WORKTREE) {
 		if (!strcmp("uploadpack.packobjectshook", var))
 			return git_config_string(&data->pack_objects_hook, var, value);
 	}
-- 
2.29.2.896.g080220a959
Next: Junio C Hamano
Message 1 of 5 in “style: indent multiline "if" conditions by 4 spaces”
  1. style: indent multiline "if" conditions by 4 spacesJeff King, Dec 3, 2020
  2. Junio C HamanoDec 3, 2020
  3. Jeff KingDec 3, 2020
  4. Junio C HamanoDec 3, 2020
  5. Jeff KingDec 3, 2020

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.