{"thread":{"id":"2818","subject":"qgit reports errors in the git repository","startedAt":"2005-12-13T00:24:00Z","lastAt":"2005-12-20T02:11:56Z","messageCount":9,"participants":["Pavel Roskin","Linus Torvalds","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"13539","messageId":"1134433440.3798.27.camel@dv","threadId":"2818","inReplyTo":null,"subject":"qgit reports errors in the git repository","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-12-13T00:24:00Z","receivedAt":"2005-12-13T00:24:00Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Hello!\n\nqgit reports an error from git-cat-file when run in the git repository.\nThe error shown in a message box with the text:\n\nGit says:\nfatal: git-cat-file 23ea3e201cea0deea909569e08e950a9ec2345f7: bad file\n\nI believe qgit runs \"git-cat-file -t tag\" on in, but it's a commit.  If\nI change the git-cat-file invocation in  src/git_startup.cpp to use\n\"commit\" instead of \"tag\", qgit complains about\n0918385dbd9656cab0d1d81ba7453d49bbc16250.\n\nMaybe qgit should check the type of the object first?  Or maybe there\nshould another type for git-cat-file that would match both tag and\ncommit?\n\n-- \nRegards,\nPavel Roskin\n"},{"id":"13542","messageId":"Pine.LNX.4.64.0512121700010.15597@g5.osdl.org","threadId":"2818","inReplyTo":"1134433440.3798.27.camel@dv","subject":"Re: qgit reports errors in the git repository","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2005-12-13T01:06:47Z","receivedAt":"2005-12-13T01:06:47Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Mon, 12 Dec 2005, Pavel Roskin wrote:\n>\n> Git says:\n> fatal: git-cat-file 23ea3e201cea0deea909569e08e950a9ec2345f7: bad file\n> \n> I believe qgit runs \"git-cat-file -t tag\" on in, but it's a commit.  If\n> I change the git-cat-file invocation in  src/git_startup.cpp to use\n> \"commit\" instead of \"tag\", qgit complains about\n> 0918385dbd9656cab0d1d81ba7453d49bbc16250.\n> \n> Maybe qgit should check the type of the object first?  Or maybe there\n> should another type for git-cat-file that would match both tag and\n> commit?\n\nUsing \"git-cat-file commit <object>\" already works for both real commits \nand for tags that point to commits.\n\nHowever, the \"0918385dbd9656cab0d1d81ba7453d49bbc16250\" object is a tag \nthat points to a blob (Junios public gpg key), so you can't use that.\n\nBasically, qgit should do either:\n\n - check the type of the object by hand first (using \"git-cat-file -t\" and \n   then follow any tags it finds by hand)\n\n_or_ \n\n - just use \"git-cat-file commit\" and if an error occurs, just silently \n   ignore that ref since it doesn't understand them.\n\nwhich one is the right strategy depends on usage.\n\n\t\tLinus\n"},{"id":"13667","messageId":"1134624477.5360.6.camel@dv","threadId":"2818","inReplyTo":"Pine.LNX.4.64.0512121700010.15597@g5.osdl.org","subject":"Re: qgit reports errors in the git repository","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-12-15T05:27:57Z","receivedAt":"2005-12-15T05:27:57Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"On Mon, 2005-12-12 at 17:06 -0800, Linus Torvalds wrote:\n> \n> Basically, qgit should do either:\n> \n>  - check the type of the object by hand first (using \"git-cat-file -t\" and \n>    then follow any tags it finds by hand)\n\nI'm a complete Qt newbie, but this patch seems to work for me.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\ndiff --git a/src/git_startup.cpp b/src/git_startup.cpp\nindex e08d466..1f6e9ad 100644\n--- a/src/git_startup.cpp\n+++ b/src/git_startup.cpp\n@@ -111,6 +111,10 @@ bool Git::getRefs() {\n \n \t\tif (itNext != rLst.constEnd() && (*itNext).right(3) == \"^{}\") {\n \t\t\tsignedTag = true;\n+\t\t\tif (!run(\"git-cat-file -t \" + refSha, &runOutput))\n+\t\t\t\tcontinue; // invalid SHA1\n+\t\t\tif (runOutput != \"tag\\n\")\n+\t\t\t\tcontinue; // not a tag\n \t\t\tif (run(\"git-cat-file tag \" + refSha, &runOutput)) {\n \t\t\t\tQString msg(runOutput.section(\"\\n\\n\", 1));\n \t\t\t\tif (!msg.isEmpty())\n\n\n-- \nRegards,\nPavel Roskin\n"},{"id":"13694","messageId":"1134665095.27212.22.camel@dv","threadId":"2818","inReplyTo":"e5bfff550512150501v48bb65abwf44b3fc21f33bdf6@mail.gmail.com","subject":"Re: qgit reports errors in the git repository","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-12-15T16:44:55Z","receivedAt":"2005-12-15T16:44:55Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Hello, Marco.\n\nOn Thu, 2005-12-15 at 14:01 +0100, Marco Costalba wrote:\n> Just one quickly note. The error report says:\n> git-cat-file 23ea3e201cea0deea909569e08e950a9ec2345f7\n\nIt's stderr from git-cat-file.  I guess git-cat-file could be improved.\n\n> the error message should be:\n> git-cat-file tag 23ea3e201cea0deea909569e08e950a9ec2345f7\n> \n> because it is just the print out of the command line. Or we have 2 bugs ;-)\n\nqgit doesn't print its command line at all when running commands\nsynchronously.\n\nSigned-off-by: Pavel Roskin <proski@gnu.org>\n\ndiff --git a/src/myprocess.cpp b/src/myprocess.cpp\nindex 5eee6e1..baae026 100644\n--- a/src/myprocess.cpp\n+++ b/src/myprocess.cpp\n@@ -49,6 +49,7 @@ int MyProcess::runAsync(SCRef rc, QObjec\n \n bool MyProcess::runSync(SCRef runCmd, QString* ro) {\n \n+\tthis->runCmd = runCmd;\n \trunOutput = ro;\n \tif (runOutput != NULL)\n \t\t*runOutput = \"\";\n\n\n\n-- \nRegards,\nPavel Roskin\n"},{"id":"13712","messageId":"1134693349.22652.22.camel@dv","threadId":"2818","inReplyTo":"e5bfff550512151100k33a66db5tdb2eb1ff2da10a59@mail.gmail.com","subject":"Re: qgit reports errors in the git repository","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-12-16T00:35:49Z","receivedAt":"2005-12-16T00:35:49Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"On Thu, 2005-12-15 at 20:00 +0100, Marco Costalba wrote:\n\n>  Yes! this is a bug.\n> Thanks  for the patch, applied.\n\nActually, the qgit git repository appear to be broken right now.  First\nof all, requests to missing files return code 200 rather that 404.\ngit-http-fetch crashes trying to parse the returned page as alternates.\nI've fixed it.\n\nIt's a hack, not a signed patch, please be cautious:\n\ndiff --git a/http-fetch.c b/http-fetch.c\nindex ad59f1c..2767676 100644\n--- a/http-fetch.c\n+++ b/http-fetch.c\n@@ -520,6 +520,8 @@ static void process_alternates_response(\n \t\t\t\t}\n \t\t\t}\n \t\t\t// skip 'objects' at end\n+\t\t\tokay &= (posn - i > 8);\n+\t\t\tokay &= (strncmp(data + posn - 8, \"/objects\", 8) == 0);\n \t\t\tif (okay) {\n \t\t\t\ttarget = xmalloc(serverlen + posn - i - 6);\n \t\t\t\tstrncpy(target, base, serverlen);\n@@ -601,7 +603,7 @@ static void fetch_alternates(char *base)\n \telse\n \t\tgot_alternates = -1;\n \n-\tfree(data);\n+//\tfree(data);\n \tfree(url);\n }\n \n\nThe free() was commented out because glibc detects double free and\nprints backtrace.  It's Fedora Core 4 on x86_64, all up-to-date.  I\ndon't see where \"data\" is freed, maybe it's a bug in glibc.\n\nEven clean fetch of qgit doesn't work:\n\n$ cg-clone http://digilander.libero.it/mcostalba/qgit.git\ndefaulting to local storage area\nFetching head...\nFetching objects...\nprogress: 8 objects, 12858 bytes\nerror: File 8fef66ee82bcbbc26426d21e537478867f648e12 (http://digilander.libero.it/mcostalba/qgit.git/objects/fc/0712e55de18eda32aee44bd7863fee37fc83aa) corrupt\n\nGetting pack list for http://digilander.libero.it/mcostalba/qgit.git/\nprogress: 11 objects, 76091 bytes\nGetting alternates list for http://digilander.libero.it/mcostalba/qgit.git/\nerror: Unable to find fc0712e55de18eda32aee44bd7863fee37fc83aa under http://digilander.libero.it/mcostalba/qgit.git/\n\nCannot obtain needed commit fc0712e55de18eda32aee44bd7863fee37fc83aa\nwhile processing commit 5013d718eea0b19a28faebf93eade68127f4b2b4.\nWaiting for http://digilander.libero.it/mcostalba/qgit.git/objects/20/35781249a0d6c788e4aef07432c335d9694b9b\nprogress: 12 objects, 80655 bytes\ncg-fetch: objects fetch failed\ncg-clone: fetch failed\n\nAnyway, I'm using the latest revision I could get,\n9e5ccecbef2a9cb4b75887791b410c0e07d630cc.\n\n> Unfortunatly, regarding the main question on git-cat-file I cannot\n> reproduce the bug.\n\nI've made a clean checkout of git using git-fetch:\ngit-clone git://www.kernel.org/pub/scm/git/git.git\n\nNow qgit complains about 1ed91937e5cd59fdbdfa5f15f6fac132d2b21ce0.\n\n> The problem is that on my box the object\n> 23ea3e201cea0deea909569e08e950a9ec2345f7 is\n> _never_ fed to git-cat-file because is filtered out ending with \"^{}\"\n> git-ls-remote ./.git |grep 23ea3e201cea0deea909569e08e950a9ec2345f7\n> 23ea3e201cea0deea909569e08e950a9ec2345f7        refs/tags/v0.99.9g^{}\n\nSame for me.\n\n> The corresponding tag feeded to git-cat-file is \n> bd67d7d845eb5ae929306dadd3dff41cf04ce004\n> \n> I have just made a\n> git pull\n> git fetch --tags\n> \n> from git repository.\n\nOK, \"git fetch --tags\" made the difference for the old repository!  Now\nit also complains about 1ed91937e5cd59fdbdfa5f15f6fac132d2b21ce0.\n\nI was using cogito only on the old repository.  I think cogito doesn't\nrun \"git fetch --tags\" or anything equivalent.\n\n> So, please, test with this:\n> \n> --- a/src/git_startup.cpp\n> +++ b/src/git_startup.cpp\n> @@ -111,6 +111,7 @@ bool Git::getRefs() {\n>  \n>          if (itNext != rLst.constEnd() && (*itNext).right(3) == \"^{}\")\n> {\n>              signedTag = true;\n> +            dbg(refSha);\n>              if (run(\"git-cat-file tag \" + refSha, &runOutput)) {\n>                  QString msg(runOutput.section(\"\\n\\n\", 1));\n>                  if (!msg.isEmpty())\n> \n> and send me the output. Mine is\n[skip]\n\nBoth are attached.\n\n-- \nRegards,\nPavel Roskin\n\n\nrefSha is <a0e7d36193b96f552073558acf5fcc1f10528917>\nrefSha is <f25a265a342aed6041ab0cc484224d9ca54b6f41>\nrefSha is <c5db5456ae3b0873fc659c19fafdde22313cc441>\nrefSha is <7ceca275d047c90c0c7d5afb13ab97efdf51bd6e>\nrefSha is <b3e9704ecdf48869f635f0aa99ddfb513f885aff>\nrefSha is <07e38db6a5a03690034d27104401f6c8ea40f1fc>\nrefSha is <f12e22d4c12c3d0263fa681f25c06569f643da0f>\nrefSha is <f8696fcd2abc446a5ccda3e414b731eff2a7e981>\nrefSha is <1094cf40f7029f803421c1dcc971238507c830c5>\nrefSha is <da30c6c39cd3b048952a15929c5440acfd71b912>\nrefSha is <9165ec17fde255a1770886189359897dbb541012>\nrefSha is <02b2acff8bafb6d73c6513469cdda0c6c18c4138>\nrefSha is <b041895af323bdef10cc9a718bda468ba3622bc0>\nrefSha is <cfc2ea6116410a545573d5fa5311d3c3b2df69d1>\nrefSha is <0b122201af0afb6a6a8059ff446a1e26b1d0c823>\nrefSha is <d186f3d21148f373a5ea5e43804f5f6707670a87>\nrefSha is <48055bb38d650ab39957ed07d640469176c12419>\nrefSha is <b79a5a49c9e412e27a336e705fb7b462367f4c16>\nrefSha is <ebd5d002da3f6cfbd0aa3ff5b5c4a9d9eeee630d>\nrefSha is <08f9f32076455ff75b59b41d7003927869082a3f>\nrefSha is <67b4b78858d9d9dd044f758a90a4270e48543cf1>\nrefSha is <c512b0344196931ad3a9a049eb3f5d3f05b09328>\nrefSha is <3d65a838c77f816527acf84c899419eb6825dcee>\nrefSha is <3521017556c5de4159da4615a39fa4d5d2c279b5>\nrefSha is <107e3d2b4d5b9ecd9a15a23ad1c64652b8b67ba9>\nrefSha is <10e5ae69eb6cdcdd149bb23e1e73131adf4ab3b7>\nrefSha is <b685b14cd9385e8b0f5742ebcd35ef8c8c12ec4d>\nrefSha is <bd67d7d845eb5ae929306dadd3dff41cf04ce004>\nrefSha is <5c857638d55bdd575d3f38bf3b99f1a2f99d3e46>\nrefSha is <4a6a394c62f33a3bf94badd6b14bc1f48647905f>\nrefSha is <c0f7d44ecba75d54a73ba542adde0ff80d2da03a>\nrefSha is <0c675e9d0b5f5d1fbb7b0169d71769993b225701>\nrefSha is <ca6cec9c5843d85d23b1184d584a11699d92e927>\nrefSha is <93ea4a9599564101be20507a3a756d38427a70ac>\nrefSha is <71c1a700da60da8cf99d586cc618c46fef201ed1>\nrefSha is <1ed91937e5cd59fdbdfa5f15f6fac132d2b21ce0>\nrefSha is <5f4cd4ca015dc795b9f7f4fed11b3f80a60ac175>\nrefSha is <112c4fd6b3fe400a075d575c0fe1a583aafe8f2c>\nrefSha is <dcd118f6b933d7a81739c3c4269e2bf4654e4a99>\nrefSha is <055e4ae3ae6eb344cbabf2a5256a49ea66040131>\nrefSha is <2d2846cd06fce719c35b58a8b81f7ae42f1986ca>\nrefSha is <781aab17fe544cbfcaba0f0ea5cacf7672717236>\n"},{"id":"13745","messageId":"7virtoenar.fsf@assigned-by-dhcp.cox.net","threadId":"2818","inReplyTo":"e5bfff550512161247v4c187cc0gedae8234d454c3b6@mail.gmail.com","subject":"Re: qgit reports errors in the git repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-16T21:37:16Z","receivedAt":"2005-12-16T21:37:16Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Costalba <mcostalba@gmail.com> writes:\n\n> Type information is already available in git-ls-remote.sh...\n\n???? is it ???? where and how ????\n\nThe only thing you know is where things are, and optionally if\nthat thing is a tag object or not (by presense or lack of\ncorresponding \"it^{}\").\n"},{"id":"13761","messageId":"7virto9pr0.fsf@assigned-by-dhcp.cox.net","threadId":"2818","inReplyTo":"e5bfff550512161247v4c187cc0gedae8234d454c3b6@mail.gmail.com","subject":"Re: qgit reports errors in the git repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-17T06:55:31Z","receivedAt":"2005-12-17T06:55:31Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Costalba <mcostalba@gmail.com> writes:\n\n>> > So perpahs this assumption is broken and works only on my box.\n>> >\n>> > Can you please send me also the git-ls-remote ./.git output?\n>>\n>> Attached.  Apparently my sort (coreutils 5.2.1) thinks that caret\n>> follows period in C locale, so v0.99^{} goes after v0.99.9n^{}.  Since\n>> there should be a reason for sort in git-ls-remote.sh, I assume it's the\n>> script that should be fixed.\n>>\n>> Not that I would object against qgit being more robust :-)\n\nSomehow I am getting your message without the message your\nmessage is a reply to, but anyway, guessing without having\naccess to qgit source [*1*], you seem to be running ls-remote\nagainst the local repository, reading its output and deciding if\n\"xyzzy\" is followed immediately by \"xyzzy^{}\" then it is a tag\notherwise it is a non tag object?\n\nIf you are always doing that against the local repository, then\npeek-remote would be more efficient, does not sort, and\n\"xyzzy^{}\" comes immediately after \"xyzzy\", which I do not see\nan immediate need of changing.\n\n\n[Footnote]\n\n*1* Why is that http:// URL does not work is mystery to me which\nI do not particularly interested in figuring out myself.  Maybe\nthe site is trying to be too helpful and showing \"Oh where do\nyou want to go\" page with status 200 which confuses the h*ck out\nof downloaders?\n"},{"id":"13764","messageId":"7vu0d812vf.fsf@assigned-by-dhcp.cox.net","threadId":"2818","inReplyTo":"e5bfff550512170044v59f96262ica6511e981889ea9@mail.gmail.com","subject":"Re: qgit reports errors in the git repository","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-12-17T09:36:52Z","receivedAt":"2005-12-17T09:36:52Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marco Costalba <mcostalba@gmail.com> writes:\n\n> Using\n>\n> git-clone http://digilander.libero.it/mcostalba/qgit.git qgit_test\n>\n> does not work (never did). Peraphs it's time I dig a little bit deeper.\n\nDo you keep qgit.git/info/refs, qgit.git/objects/info/packs, and\npossibly qgit.git/objects/info/alternates up-to-date under\nhttp://digilander.libero.it/mcostalba/?  Your server seems to\ngive friendly \"no such page\" instead of usual 404 not found for\nnonexisting paths, which means that you would probably need to\nhave an empty info/alternates file there, and if you do not have\npacks then empty info/packs files as well.\n\nAlso I suspect once you start packing your repository the\ndownloaders would have a hard time --- instead of getting \"not\nfound\" as a cue to switch to fetching packs they would get the\n\"friendly page\" and mistakenly think the loose object stored in\nyour repository is corrupt.\n"},{"id":"13832","messageId":"1135044716.2259.24.camel@dv","threadId":"2818","inReplyTo":"e5bfff550512170044v59f96262ica6511e981889ea9@mail.gmail.com","subject":"Re: qgit reports errors in the git repository","fromName":"Pavel Roskin","fromEmail":"proski@gnu.org","sentAt":"2005-12-20T02:11:56Z","receivedAt":"2005-12-20T02:11:56Z","isPatch":false,"sender":{"key":"proski@gnu.org","avatar":null},"body":"Hello, Marco!\n\nOn Sat, 2005-12-17 at 09:44 +0100, Marco Costalba wrote:\n> On 12/17/05, Junio C Hamano <junkio@cox.net> wrote:\n> > Marco Costalba <mcostalba@gmail.com> writes:\n> Pavel, please, test the following patch. If it works I will push the change.\n\nI could not apply your patch (it got mangled), but the git server for\nqgit is working now, so I updated from it, and it looks like your patch\nis already there.\n\nI don't see any error messages from any git repository I'm using.  Thank\nyou for the fix!\n\n-- \nRegards,\nPavel Roskin\n"}]}