Skip to content

Commit

Permalink
describe: allow more than one revs to be named.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Junio C Hamano committed Jan 8, 2006
1 parent 78c2cff commit f8f9c73
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
13 changes: 13 additions & 0 deletions commit.c
Expand Up @@ -352,6 +352,19 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
return ret; return ret;
} }


void clear_commit_marks(struct commit *commit, unsigned int mark)
{
struct commit_list *parents;

parents = commit->parents;
commit->object.flags &= ~mark;
while (parents) {
if (parents->item && parents->item->object.parsed)
clear_commit_marks(parents->item, mark);
parents = parents->next;
}
}

/* /*
* Generic support for pretty-printing the header * Generic support for pretty-printing the header
*/ */
Expand Down
2 changes: 2 additions & 0 deletions commit.h
Expand Up @@ -58,6 +58,8 @@ struct commit *pop_most_recent_commit(struct commit_list **list,


struct commit *pop_commit(struct commit_list **stack); struct commit *pop_commit(struct commit_list **stack);


void clear_commit_marks(struct commit *commit, unsigned int mark);

int count_parents(struct commit * commit); int count_parents(struct commit * commit);


/* /*
Expand Down
3 changes: 2 additions & 1 deletion describe.c
Expand Up @@ -124,9 +124,10 @@ static void describe(struct commit *cmit)
if (n) { if (n) {
printf("%s-g%s\n", n->path, printf("%s-g%s\n", n->path,
find_unique_abbrev(cmit->object.sha1, abbrev)); find_unique_abbrev(cmit->object.sha1, abbrev));
return; break;
} }
} }
clear_commit_marks(cmit, SEEN);
} }


int main(int argc, char **argv) int main(int argc, char **argv)
Expand Down

0 comments on commit f8f9c73

Please sign in to comment.