Thread (12 messages) flat view 12 messages, 4 authors, 2016-06-15
STALE3732d

[PATCH 3/4] Dont use the same variable for different things

From: Vasyl' Vavrychuk <hidden>
Date: 2016-06-15 22:50:33
Subsystem: the rest · Maintainer: Linus Torvalds

Signed-off-by: Vasyl' Vavrychuk <redacted>
---
 builtin/fetch.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 46d8fd6..ddb40c6 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -343,7 +343,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 	FILE *fp;
 	struct commit *commit;
 	int i, note_len, shown_url = 0, rc = 0;
-	char note[1024];
+	char note[1024], display[1024];
 	const char *what, *kind;
 	struct ref *rm;
 	char *url, *filename = dry_run ? "/dev/null" : git_path("FETCH_HEAD");
@@ -415,19 +415,20 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 		fputc('\n', fp);
 
 		if (ref) {
-			rc |= update_local_ref(ref, what, note);
+			rc |= update_local_ref(ref, what, display);
 			free(ref);
-		} else
-			sprintf(note, "* %-*s %-*s -> FETCH_HEAD",
+		} else {
+			sprintf(display, "* %-*s %-*s -> FETCH_HEAD",
 				TRANSPORT_SUMMARY_WIDTH, *kind ? kind : "branch",
 				 REFCOL_WIDTH, *what ? what : "HEAD");
-		if (*note) {
+		}
+		if (*display) {
 			if (verbosity >= 0 && !shown_url) {
 				fprintf(stderr, "From %s\n", url);
 				shown_url = 1;
 			}
 			if (verbosity >= 0)
-				fprintf(stderr, " %s\n", note);
+				fprintf(stderr, " %s\n", display);
 		}
 	}
 	free(url);
-- 
1.7.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help