{"thread":{"id":"6244","subject":"[PATCH 3/5] builtin-prune: separate ref walking from reflog walking.","startedAt":"2007-01-06T10:16:14Z","lastAt":"2007-01-06T10:16:14Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":5},"messages":[{"id":"30961","messageId":"7vzm8w5ukx.fsf@assigned-by-dhcp.cox.net","threadId":"6244","inReplyTo":null,"subject":"[PATCH 3/5] builtin-prune: separate ref walking from reflog walking.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2007-01-06T10:16:14Z","receivedAt":"2007-01-06T10:16:14Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"This is necessary for the next step, because the reason I am\nmaking the connectivity walker into a library is because I want\nto use it for cleaning up stale reflog entries.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n---\n builtin-prune.c |   11 +++++++++--\n 1 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/builtin-prune.c b/builtin-prune.c\nindex 9522864..cd079b4 100644\n--- a/builtin-prune.c\n+++ b/builtin-prune.c\n@@ -203,8 +203,12 @@ static int add_one_ref(const char *path, const unsigned char *sha1, int flag, vo\n \t\tdie(\"bad object ref: %s:%s\", path, sha1_to_hex(sha1));\n \tadd_pending_object(revs, object, \"\");\n \n-\tfor_each_reflog_ent(path, add_one_reflog_ent, cb_data);\n+\treturn 0;\n+}\n \n+static int add_one_reflog(const char *path, const unsigned char *sha1, int flag, void *cb_data)\n+{\n+\tfor_each_reflog_ent(path, add_one_reflog_ent, cb_data);\n \treturn 0;\n }\n \n@@ -267,12 +271,15 @@ int cmd_prune(int argc, const char **argv, const char *prefix)\n \trevs.blob_objects = 1;\n \trevs.tree_objects = 1;\n \n-\t/* Add all external refs, along with its reflog info */\n+\t/* Add all external refs */\n \tfor_each_ref(add_one_ref, &revs);\n \n \t/* Add all refs from the index file */\n \tadd_cache_refs(&revs);\n \n+\t/* Add all reflog info from refs */\n+\tfor_each_ref(add_one_reflog, &revs);\n+\n \t/*\n \t * Set up the revision walk - this will move all commits\n \t * from the pending list to the commit walking list.\n-- \n1.5.0.rc0.ge0f6\n"}]}