Re: [PATCH 6/6] Add git-rewrite-commits
On Thu, Jul 12, 2007 at 09:06:03PM +0200, skimo@liacs.nl wrote:
Show 14 quoted lines
> +static int rewrite_parents(struct commit *commit, int path_pruning)
> +{
> + int n;
> + struct commit_list *list, *parents, **prev;
> + unsigned char sha1[20];
> +
> + for (n = 0, prev = &commit->parents; *prev; ++n) {
> + list = *prev;
> +
> + rewrite_parents(list->item, path_pruning);
> + if (!is_pruned(list->item, path_pruning)) {
> + prev = &list->next;
> + continue;
> + }Oops... that should be the other way around...
diff --git a/builtin-rewrite-commits.c b/builtin-rewrite-commits.c
index d95a16c..4cd17ae 100644
--- a/builtin-rewrite-commits.c
+++ b/builtin-rewrite-commits.c
@@ -279,11 +279,11 @@ static int rewrite_parents(struct commit *commit, int path_pruning)
for (n = 0, prev = &commit->parents; *prev; ++n) {
list = *prev;
- rewrite_parents(list->item, path_pruning);
if (!is_pruned(list->item, path_pruning)) {
prev = &list->next;
continue;
}
+ rewrite_parents(list->item, path_pruning);
hashcpy(sha1, list->item->object.sha1);
get_rewritten_sha1(sha1);
I'll include it in my next version.
skimo