Thread (50 messages) 50 messages, 6 authors, 2017-11-14

Re: [PATCH 3/7] builtin/describe.c: rename `oid` to avoid variable shadowing

From: Jacob Keller <hidden>
Date: 2017-10-31 08:15:35


On October 30, 2017 5:33:47 PM PDT, Stefan Beller [off-list ref] wrote:
The function `describe` has already a variable named `oid` declared at
the beginning of the function for an object id.  Do now shadow that
Nit, s/now/not/
quoted hunk ↗ jump to hunk
variable with a pointer to an object id.

Signed-off-by: Stefan Beller <redacted>
---
builtin/describe.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/describe.c b/builtin/describe.c
index 29075dbd0f..fd61f463cf 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -381,9 +381,9 @@ static void describe(const char *arg, int last_one)
	}

	if (!match_cnt) {
-		struct object_id *oid = &cmit->object.oid;
+		struct object_id *cmit_oid = &cmit->object.oid;
		if (always) {
-			printf("%s", find_unique_abbrev(oid->hash, abbrev));
+			printf("%s", find_unique_abbrev(cmit_oid->hash, abbrev));
			if (suffix)
				printf("%s", suffix);
			printf("\n");
@@ -392,11 +392,11 @@ static void describe(const char *arg, int
last_one)
		if (unannotated_cnt)
			die(_("No annotated tags can describe '%s'.\n"
			    "However, there were unannotated tags: try --tags."),
-			    oid_to_hex(oid));
+			    oid_to_hex(cmit_oid));
		else
			die(_("No tags can describe '%s'.\n"
			    "Try --always, or create some tags."),
-			    oid_to_hex(oid));
+			    oid_to_hex(cmit_oid));
	}

	QSORT(all_matches, match_cnt, compare_pt);
-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help