Thread (24 messages) 24 messages, 3 authors, 2017-02-16

Re: [PATCH 09/14] update submodules: add submodule_go_from_to

From: brian m. carlson <hidden>
Date: 2017-02-15 02:06:57

On Tue, Feb 14, 2017 at 04:34:18PM -0800, Stefan Beller wrote:
+	prepare_submodule_repo_env_no_git_dir(&cp.env_array);
+
+	cp.git_cmd = 1;
+	cp.no_stdin = 1;
+	cp.dir = path;
+
+	argv_array_pushf(&cp.args, "--super-prefix=%s/", path);
+	argv_array_pushl(&cp.args, "read-tree", NULL);
+
+	if (!dry_run)
+		argv_array_push(&cp.args, "-u");
+	else
+		argv_array_push(&cp.args, "-n");
I might write this as

	if (dry_run)
		argv_array_push(&cp.args, "-n");
	else
		argv_array_push(&cp.args, "-u");

In other words, avoiding the negation when you have an else branch.  I
can also see an argument for keeping the condition identical to the
other branches, though.
-- 
brian m. carlson / brian with sandals: Houston, Texas, US
+1 832 623 2791 | https://www.crustytoothpaste.net/~bmc | My opinion only
OpenPGP: https://keybase.io/bk2204

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help