Skip to contentSkip to conversation

Remove unnecessary found variable from describe.

PATCH In review Shawn O. Pearce 1 participant 1 message Jun 15, 2016 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): 2d9c5cd428a8962a64628a4e429263576bc46762.1169746766.git.spearce@spearce.org

#1 lore raw

PATCH 2/2 Remove unnecessary found variable from describe.

Junio added the found variable to enforce commit date order when two tags have the same distance from the requested commit. Except it is unnecessary as match_cnt is already used to record how many possible tags have been identified thus far.

---
 builtin-describe.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)
builtin-describe.c +1 -2
index d8ff621..14c712a 100644
@@ -101,7 +101,6 @@ static void describe(const char *arg, int last_one)
 	struct possible_tag all_matches[MAX_TAGS];
 	unsigned int match_cnt = 0, annotated_cnt = 0, cur_match;
 	unsigned long seen_commits = 0;
-	int found = 0;
 
 	if (get_sha1(arg, sha1))
 		die("Not a valid object name %s", arg);
@@ -137,7 +136,7 @@ static void describe(const char *arg, int last_one)
 				t->name = n;
 				t->depth = seen_commits - 1;
 				t->flag_within = 1u << match_cnt;
-				t->found_order = found++;
+				t->found_order = match_cnt;
 				c->object.flags |= t->flag_within;
 				if (n->prio == 2)
 					annotated_cnt++;
Signature · 1 line
1.5.0.rc2.g18af