Skip to content

Commit fec9ebf

Browse files
author
Junio C Hamano
committed
Merge fixes up to GIT 1.1.3
2 parents 0620db3 + 8a263ae commit fec9ebf

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

commit.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -359,8 +359,10 @@ void clear_commit_marks(struct commit *commit, unsigned int mark)
359359
parents = commit->parents;
360360
commit->object.flags &= ~mark;
361361
while (parents) {
362-
if (parents->item && parents->item->object.parsed)
363-
clear_commit_marks(parents->item, mark);
362+
struct commit *parent = parents->item;
363+
if (parent && parent->object.parsed &&
364+
(parent->object.flags & mark))
365+
clear_commit_marks(parent, mark);
364366
parents = parents->next;
365367
}
366368
}

describe.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static int compare_names(const void *_a, const void *_b)
9898
return (a_date > b_date) ? -1 : (a_date == b_date) ? 0 : 1;
9999
}
100100

101-
static void describe(char *arg)
101+
static void describe(char *arg, int last_one)
102102
{
103103
unsigned char sha1[20];
104104
struct commit *cmit;
@@ -132,7 +132,8 @@ static void describe(char *arg)
132132
if (n) {
133133
printf("%s-g%s\n", n->path,
134134
find_unique_abbrev(cmit->object.sha1, abbrev));
135-
clear_commit_marks(cmit, SEEN);
135+
if (!last_one)
136+
clear_commit_marks(cmit, SEEN);
136137
return;
137138
}
138139
}
@@ -162,10 +163,12 @@ int main(int argc, char **argv)
162163
}
163164

164165
if (i == argc)
165-
describe("HEAD");
166+
describe("HEAD", 1);
166167
else
167-
while (i < argc)
168-
describe(argv[i++]);
168+
while (i < argc) {
169+
describe(argv[i], (i == argc - 1));
170+
i++;
171+
}
169172

170173
return 0;
171174
}

0 commit comments

Comments
 (0)