describe: allow more than one revs to be named.
The main loop was prepared to take more than one revs, but the actual naming logic wad not (it used pop_most_recent_commit while forgetting that the commit marks stay after it's done). Signed-off-by: Junio C Hamano <junkio@cox.net>
Junio C Hamano committed
Jan 7, 2006 at 18:52 UTC
f8f9c73c7d835ec1e5b665c66623aed49fcd4888
3 files changed
+17
-1
commit.c
+13
@@ -352,6 +352,19 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
352
return ret;
353
}
354
355
+void clear_commit_marks(struct commit *commit, unsigned int mark)
356
+{
357
+ struct commit_list *parents;
358
+
359
+ parents = commit->parents;
360
+ commit->object.flags &= ~mark;
361
+ while (parents) {
362
+ if (parents->item && parents->item->object.parsed)
363
+ clear_commit_marks(parents->item, mark);
364
+ parents = parents->next;
365
+ }
366
+}
367
+
368
/*
369
* Generic support for pretty-printing the header
370
*/
commit.h
+2
@@ -58,6 +58,8 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
58
59
struct commit *pop_commit(struct commit_list **stack);
60
61
+void clear_commit_marks(struct commit *commit, unsigned int mark);
62
+
63
int count_parents(struct commit * commit);
64
65
/*
describe.c
+2
-1
@@ -124,9 +124,10 @@ static void describe(struct commit *cmit)
124
if (n) {
125
printf("%s-g%s\n", n->path,
126
find_unique_abbrev(cmit->object.sha1, abbrev));
127
- return;
127
+ break;
128
}
129
}
130
+ clear_commit_marks(cmit, SEEN);
131
}
132
133
int main(int argc, char **argv)