{"thread":{"id":"2234","subject":"[PATCH] fetch-pack: avoid packing reachable objects.","startedAt":"2005-10-26T04:26:32Z","lastAt":"2005-10-26T05:07:11Z","messageCount":2,"participants":["Jan Harkes","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"10637","messageId":"20051026042632.GA3059@delft.aura.cs.cmu.edu","threadId":"2234","inReplyTo":null,"subject":"[PATCH] fetch-pack: avoid packing reachable objects.","fromName":"Jan Harkes","fromEmail":"jaharkes@cs.cmu.edu","sentAt":"2005-10-26T04:26:32Z","receivedAt":"2005-10-26T04:26:32Z","isPatch":true,"sender":{"key":"jaharkes@cs.cmu.edu","avatar":"https://gravatar.com/avatar/cf95aecd150ca8ef33d6edc337ac4bb9e13aa4246fc3679257d578c7fddc1633?d=mp&s=160"},"body":"Mark remote commits that were found in the alternate repository as\nCOMPLETE and avoid unnecessary packing of already available objects.\n\nSigned-off-by: Jan Harkes <jaharkes@cs.cmu.edu>\n---\n\nWhen we pull updates from a shared repository into a clone that was\ncreated with 'git clone -l -s', we pack objects that are already\nreachable. This was because we only marked local refs as COMPLETE.\n\ndiff --git a/fetch-pack.c b/fetch-pack.c\nindex 8566ab1..17524d8 100644\n--- a/fetch-pack.c\n+++ b/fetch-pack.c\n@@ -169,6 +169,7 @@ static int everything_local(struct ref *\n \t\t */\n \t\tif (o->type == commit_type) {\n \t\t\tstruct commit *commit = (struct commit *)o;\n+\t\t\tcommit->object.flags |= COMPLETE;\n \t\t\tif (!cutoff || cutoff < commit->date)\n \t\t\t\tcutoff = commit->date;\n \t\t}\n"},{"id":"10638","messageId":"7v7jc0c1ds.fsf@assigned-by-dhcp.cox.net","threadId":"2234","inReplyTo":"20051026042632.GA3059@delft.aura.cs.cmu.edu","subject":"Re: [PATCH] fetch-pack: avoid packing reachable objects.","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-10-26T05:07:11Z","receivedAt":"2005-10-26T05:07:11Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jan Harkes <jaharkes@cs.cmu.edu> writes:\n\n> Mark remote commits that were found in the alternate repository as\n> COMPLETE and avoid unnecessary packing of already available objects.\n\nSorry, this is wrong (we made this mistake twice already).  The\nmere existence of that object in the local repository does not\nnecessarily mean we have everything that is reachable from it.\n\nThe rule is that we only trust local refs.  Anything that are\nreachable from them are known to be complete.  And after a\nsuccessful fetch, we update local refs.  The existence of an\nobject is a strong _hint_ that it _might_ be complete, but\nnothing more.\n\nThink of a case where you tried to fetch via commit walker and\ngot things reachable from the then-current ref, and the \nobject you are marking as COMPLETE (maybe in pack) is a remnant\nof that failed fetch, which was killed before completing.  You\nmight have complete history starting from the then-current\ncommit back to that commit, but there is no guarantee that you\ncan further tangle the history back and find everything needed.\n"}]}