{"thread":{"id":"2179","subject":"[PATCH] cg-fetch: retrieve missing commits with a smarter optimization","startedAt":"2005-10-21T05:31:31Z","lastAt":"2005-10-21T12:47:11Z","messageCount":2,"participants":["Martin Langhoff","Petr Baudis"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"10413","messageId":"11298726913836-git-send-email-martin@catalyst.net.nz","threadId":"2179","inReplyTo":null,"subject":"[PATCH] cg-fetch: retrieve missing commits with a smarter optimization","fromName":"Martin Langhoff","fromEmail":"martin@catalyst.net.nz","sentAt":"2005-10-21T05:31:31Z","receivedAt":"2005-10-21T05:31:31Z","isPatch":true,"sender":{"key":"martin@laptop.org","avatar":null},"body":"I've actually rebased this one so Petr doesn't have to deal\nwith the silly conflicts. It also turns out that my repo got\nfsck'd in one of the last updates, and cg-merge was seriously\nbroken. I guess did an update in the middle of the transition \nbetween positional parameters and named parameters, and got stuck.\n\nActual commit message follows.\n \n---\n\n + will check tagrefs, trying to ensure it actually has the relevant\n   commits. If the commits are missing, it'll go out and fetch them.\n + if the tagref points to a blob and we have it, it'll skip it\n\nThis isn't a complete solution for cg-fetch -- git-fetch is actually\nmuch smarter now, and cg-fetch should perhaps be a thin wrapper\naround it, dropping all the duplicate code.\n\nThis version uses ^0 instead of ^{commit} which does a more thorough check,\nso we don't need to call git-cat-file.\n\n---\n\n cg-fetch |    3 ++-\n 1 files changed, 2 insertions(+), 1 deletions(-)\n\napplies-to: e6fab694ece986de77f6e17c16df9f17276c6666\ne2cf1ab9b594d3d12655dd93377dfea03247379e\ndiff --git a/cg-fetch b/cg-fetch\nindex b004ab3..f0c11aa 100755\n--- a/cg-fetch\n+++ b/cg-fetch\n@@ -377,7 +377,8 @@ $get -i -s -u -d \"$uri/refs/tags\" \"$_git\n \tfor tag in *; do\n \t\t[ \"$tag\" = \"*\" ] && break\n \t\ttagid=\"$(cat \"$tag\")\"\n-\t\tGIT_DIR=../.. git-cat-file -t \"$tagid\" >/dev/null 2>&1 && continue\n+\t\tGIT_DIR=../.. git-rev-parse --verify \"$tag\"^0 2>/dev/null >> /dev/null && continue\n+\t\tGIT_DIR=../.. git-cat-file blob `git-rev-parse --verify \"$tag\"^{blob} 2>/dev/null` 2>/dev/null >> /dev/null && continue\n \t\techo -n \"Missing object of tag $tag... \"\n \t\tif [ \"$fetch\" != \"fetch_rsync\" ] && GIT_DIR=../.. $fetch \"$tagid\" \"$uri\" 2>/dev/null >&2; then\n \t\t\techo \"retrieved\"\n---\n0.99.8.GIT\n"},{"id":"10423","messageId":"20051021124711.GG30889@pasky.or.cz","threadId":"2179","inReplyTo":"11298726913836-git-send-email-martin@catalyst.net.nz","subject":"Re: [PATCH] cg-fetch: retrieve missing commits with a smarter optimization","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-10-21T12:47:11Z","receivedAt":"2005-10-21T12:47:11Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Could you please resend your patches signed off? Thanks.\n\nDear diary, on Fri, Oct 21, 2005 at 07:31:31AM CEST, I got a letter\nwhere Martin Langhoff <martin@catalyst.net.nz> told me that...\n>  + will check tagrefs, trying to ensure it actually has the relevant\n>    commits. If the commits are missing, it'll go out and fetch them.\n\nI'd prefer the approach to throw away the tag. Otherwise we get into\nproblems when we want to grab only a single branch from multi-branch\nrepository.\n\n>  + if the tagref points to a blob and we have it, it'll skip it\n\nThe problem is that the ^{blob} syntax is not in 0.98, so this would\nmake Cogito depend on a yet unreleased GIT version, which is\ntroublesome.\n\nSo I guess this patch will end up in my post-0.99/1.0 queue for now.\nBut by that time, this part of cg-fetch will be probably already totally\nrewritten. ;-)\n\n> This isn't a complete solution for cg-fetch -- git-fetch is actually\n> much smarter now, and cg-fetch should perhaps be a thin wrapper\n> around it, dropping all the duplicate code.\n\nI'm still thinking about it. I will certainly try to at least somehow\nreuse git-fetch's remote parser, if not anything else - reimplementing\nthat would be just stupid.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nVI has two modes: the one in which it beeps and the one in which\nit doesn't.\n"}]}