Skip to content

Commit

Permalink
builtin-prune: separate ref walking from reflog walking.
Browse files Browse the repository at this point in the history
This is necessary for the next step, because the reason I am
making the connectivity walker into a library is because I want
to use it for cleaning up stale reflog entries.

Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Junio C Hamano committed Jan 7, 2007
1 parent 2430481 commit ca4f293
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions builtin-prune.c
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,12 @@ static int add_one_ref(const char *path, const unsigned char *sha1, int flag, vo
die("bad object ref: %s:%s", path, sha1_to_hex(sha1));
add_pending_object(revs, object, "");

for_each_reflog_ent(path, add_one_reflog_ent, cb_data);
return 0;
}

static int add_one_reflog(const char *path, const unsigned char *sha1, int flag, void *cb_data)
{
for_each_reflog_ent(path, add_one_reflog_ent, cb_data);
return 0;
}

Expand Down Expand Up @@ -267,12 +271,15 @@ int cmd_prune(int argc, const char **argv, const char *prefix)
revs.blob_objects = 1;
revs.tree_objects = 1;

/* Add all external refs, along with its reflog info */
/* Add all external refs */
for_each_ref(add_one_ref, &revs);

/* Add all refs from the index file */
add_cache_refs(&revs);

/* Add all reflog info from refs */
for_each_ref(add_one_reflog, &revs);

/*
* Set up the revision walk - this will move all commits
* from the pending list to the commit walking list.
Expand Down

0 comments on commit ca4f293

Please sign in to comment.