{"thread":{"id":"3872","subject":"[PATCH] rev-list --bisect: limit list before bisecting.","startedAt":"2006-04-14T22:40:13Z","lastAt":"2006-04-14T22:40:13Z","messageCount":1,"participants":["Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"18658","messageId":"7vhd4vok6q.fsf@assigned-by-dhcp.cox.net","threadId":"3872","inReplyTo":null,"subject":"[PATCH] rev-list --bisect: limit list before bisecting.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-04-14T22:40:13Z","receivedAt":"2006-04-14T22:40:13Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"I noticed bisect does not work well without both good and bad.\nRunning this script in git.git repository would give you quite\ndifferent results:\n\n\t#!/bin/sh\n        initial=e83c5163316f89bfbde7d9ab23ca2e25604af290\n\n        mid0=`git rev-list --bisect ^$initial --all`\n\n        git rev-list $mid0 | wc -l\n        git rev-list ^$mid0 --all | wc -l\n\n        mid1=`git rev-list --bisect --all`\n\n        git rev-list $mid1 | wc -l\n        git rev-list ^$mid1 --all | wc -l\n\nThe $initial commit is the very first commit you made.  The\nfirst midpoint bisects things evenly as designed, but the latter\ndoes not.\n\nThe reason I got interested in this was because I was wondering\nif something like the following would help people converting a\nhuge repository from foreign SCM, or preparing a repository to\nbe fetched over plain dumb HTTP only:\n\n        #!/bin/sh\n\n        N=4\n        P=.git/objects/pack\n        bottom=\n\n        while test 0 \\< $N\n        do\n                N=$((N-1))\n                if test -z \"$bottom\"\n                then\n                        newbottom=`git rev-list --bisect --all`\n                else\n                        newbottom=`git rev-list --bisect ^$bottom --all`\n                fi\n                if test -z \"$bottom\"\n                then\n                        rev_list=\"$newbottom\"\n                elif test 0 = $N\n                then\n                        rev_list=\"^$bottom --all\"\n                else\n                        rev_list=\"^$bottom $newbottom\"\n                fi\n                p=$(git rev-list --unpacked --objects $rev_list |\n                    git pack-objects $P/pack)\n                git show-index <$P/pack-$p.idx | wc -l\n                bottom=$newbottom\n        done\n\nThe idea is to pack older half of the history to one pack, then\nolder half of the remaining history to another, to continue a\nfew times, using finer granularity as we get closer to the tip.\n\nThis may not matter, since for a truly huge history, running\nbisect number of times could be quite time consuming, and we\nmight be better off running \"git rev-list --all\" once into a\ntemporary file, and manually pick cut-off points from the\nresulting list of commits.  After all we are talking about\n\"approximately half\" for such an usage, and older history does\nnot matter much.\n\nSigned-off-by: Junio C Hamano <junkio@cox.net>\n\n---\n\n rev-list.c |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/rev-list.c b/rev-list.c\nindex 963707a..cb67b39 100644\n--- a/rev-list.c\n+++ b/rev-list.c\n@@ -371,6 +371,8 @@ int main(int argc, const char **argv)\n \n \tsave_commit_buffer = verbose_header;\n \ttrack_object_refs = 0;\n+\tif (bisect_list)\n+\t\trevs.limited = 1;\n \n \tprepare_revision_walk(&revs);\n \tif (revs.tree_objects)\n"}]}