threads / patch / 45000

patchreceive-pack: call string_list_clear() unconditionally

Subject: [PATCH] receive-pack: call string_list_clear() unconditionally

## tl;dr

One message between Jan 29, 2017 and Jan 29, 2017. Diffs are folded; open one to read it.

replies: 0people: 1as markdown or json

René Scharfe· Jan 29, 2017, 13:09 UTC · lore

string_list_clear() handles empty lists just fine, so remove the redundant check.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
---
 builtin/receive-pack.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
Show changes to builtin/receive-pack.c +1 −2
diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c
index 6b97cbdbe..1dbb8a069 100644
--- a/builtin/receive-pack.c
+++ b/builtin/receive-pack.c
@@ -1942,8 +1942,7 @@ int cmd_receive_pack(int argc, const char **argv, const char *prefix)
 		run_receive_hook(commands, "post-receive", 1,
 				 &push_options);
 		run_update_post_hook(commands);
-		if (push_options.nr)
-			string_list_clear(&push_options, 0);
+		string_list_clear(&push_options, 0);
 		if (auto_gc) {
 			const char *argv_gc_auto[] = {
 				"gc", "--auto", "--quiet", NULL,
-- 
2.11.0

← back to recent threads