{"thread":{"id":"39383","subject":"corrupt repos does not return error with `git fsck`","startedAt":"2015-05-20T16:17:15Z","lastAt":"2015-05-21T08:09:45Z","messageCount":19,"participants":["Faheem Mitha","Matthieu Moy","Johannes Schindelin","Stefan Beller","Jeff King","John Keeping","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"261664","messageId":"alpine.DEB.2.11.1505202142540.9343@orwell.homelinux.org","threadId":"39383","inReplyTo":null,"subject":"corrupt repos does not return error with `git fsck`","fromName":"Faheem Mitha","fromEmail":"faheem@faheem.info","sentAt":"2015-05-20T16:17:15Z","receivedAt":"2015-05-20T16:17:15Z","isPatch":false,"sender":{"key":"faheem@faheem.info","avatar":null},"body":"\nHi,\n\nClone the repos https://github.com/fmitha/SICL.\n\nThen\n\n     git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n\ngives\n\n     fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n\nBut\n\n     git fsck\n\ngives\n\n     Checking object directories: 100% (256/256), done.\n     Checking objects: 100% (49356/49356), done.\n\nSo `git fsck` does not return an error, though the repos is corrupt. This \nmay be of interest to the developers.\n\nPlease CC me on any reply, I'm not subscribed to the list. Thanks.\n\n                                             Regards, Faheem Mitha\n"},{"id":"261673","messageId":"vpq382rkvzf.fsf@anie.imag.fr","threadId":"39383","inReplyTo":"alpine.DEB.2.11.1505202142540.9343@orwell.homelinux.org","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-05-20T17:19:16Z","receivedAt":"2015-05-20T17:19:16Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Faheem Mitha <faheem@faheem.info> writes:\n\n> Hi,\n>\n> Clone the repos https://github.com/fmitha/SICL.\n>\n> Then\n>\n>     git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n>\n> gives\n>\n>     fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n\nIt seems 280c12ab49223c64c6f914944287a7d049cf4dd0 is not an object in\nyour repository. The good news it: I don't think you have a corrupt\nrepository. What makes you think you have an object with identifier\n280c12ab49223c64c6f914944287a7d049cf4dd0?\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"261676","messageId":"d21002e0fa92b03c3d417c8996328563@www.dscho.org","threadId":"39383","inReplyTo":"vpq382rkvzf.fsf@anie.imag.fr","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2015-05-20T17:40:57Z","receivedAt":"2015-05-20T17:40:57Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn 2015-05-20 19:19, Matthieu Moy wrote:\n> Faheem Mitha <faheem@faheem.info> writes:\n> \n>> Clone the repos https://github.com/fmitha/SICL.\n>>\n>> Then\n>>\n>>     git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n>>\n>> gives\n>>\n>>     fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n> \n> It seems 280c12ab49223c64c6f914944287a7d049cf4dd0 is not an object in\n> your repository. The good news it: I don't think you have a corrupt\n> repository. What makes you think you have an object with identifier\n> 280c12ab49223c64c6f914944287a7d049cf4dd0?\n\nI had a similar problem some time ago and tracked it down to a graft that was active while pushing to the public repository. Maybe it's the same problem here?\n\nCiao,\nJohannes\n"},{"id":"261677","messageId":"alpine.DEB.2.11.1505202256330.9343@orwell.homelinux.org","threadId":"39383","inReplyTo":"vpq382rkvzf.fsf@anie.imag.fr","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Faheem Mitha","fromEmail":"faheem@faheem.info","sentAt":"2015-05-20T17:58:15Z","receivedAt":"2015-05-20T17:58:15Z","isPatch":false,"sender":{"key":"faheem@faheem.info","avatar":null},"body":"\nOn Wed, 20 May 2015, Matthieu Moy wrote:\n\n> Faheem Mitha <faheem@faheem.info> writes:\n\n>> Hi,\n\n>> Clone the repos https://github.com/fmitha/SICL.\n\n>> Then\n\n>>     git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n\n>> gives\n\n>>     fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n\n> It seems 280c12ab49223c64c6f914944287a7d049cf4dd0 is not an object in\n> your repository. The good news it: I don't think you have a corrupt\n> repository. What makes you think you have an object with identifier\n> 280c12ab49223c64c6f914944287a7d049cf4dd0?\n\nI was going by the answer (by CodeWizard) in \nhttp://stackoverflow.com/q/30348615/350713\n\nThe question there also gives the context of this question.\n\nThe repos I referenced in my post to the git mailing list just now, is \njust a clone of https://github.com/drmeister/SICL.\n\nIf I just give a random hash to `git show` in that repos, I get\n\n     fatal: ambiguous argument '...': unknown revision or path not in the working tree.\n\nIt seemed reasonable to assume (based on what little knowledge I had \nabout) that the 280c12ab49223c64c6f914944287a7d049cf4dd0 commit was the \nproblem.\n\nHowever, this repos is a fork of another repos, namely \nhttps://github.com/robert-strandh/SICL\n\nThat repos contains more recent commits than the fork does.\n\nIf I take any of the more recent commits from that repos, and try the hash \nwith `git show`, i.e.\n\n     git show <hash>\n\nin the fork, I get the same error, which makes to me think something else \nmust be going on.\n\nChris (drmeister) has modified the path the submodule is obtained from, so \nthe instructions in the SO question won't work as a reproduction recipe \nany more, but if you want to take a look I could clone his repos and set \nit up the same way it was. Let me know.\n\n                                                     Regards, Faheem Mitha\n"},{"id":"261679","messageId":"CAGZ79kZY68HFDipxLVas9Dg9+NfpOGmywpWfwFL31A0EpLmJFw@mail.gmail.com","threadId":"39383","inReplyTo":"d21002e0fa92b03c3d417c8996328563@www.dscho.org","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2015-05-20T18:02:14Z","receivedAt":"2015-05-20T18:02:14Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"$ git clone https://github.com/fmitha/SICL\ncd SICL\n$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0\nfatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n$ git show 12323213123 # just to be sure to have a different error\nmessage for non existing objects.\nfatal: ambiguous argument '12323213123': unknown revision or path not\nin the working tree.\n\n$ mv .git/objects/pack/pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.pack .\n$ rm .git/objects/pack/pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.idx\n$ git unpack-objects < pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.pack\n$ git show 280c12ab49223c64c6f914944287a7d049cf4dd0\nfatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n$ ls .git/objects/28/0*\n.git/objects/28/01fef08b1dccf9725dde919a7373748a046cb7\n.git/objects/28/03d8c1cb3275979ff2d8408450844f6a78a70d\n.git/objects/28/0663a93d702a7fcb0dd36f461397f6b50ba01e\n.git/objects/28/068e2656dd4bac61050e870712578032af9144\n.git/objects/28/074e890d6ff2bb61eb7796bc500b6d8e344ad2\n.git/objects/28/08596ac465cf8a819a9b13ad2f855e9a8a3235\n.git/objects/28/098184d1ba97453227c18628cdf13087b6bce2\n.git/objects/28/0ba19c68b26ee7c799ef8ca09d540a5ad7a5b2\n.git/objects/28/0d66213173f0ae7aaae8684f3efcb1f8790792\n.git/objects/28/0da35374c32303cbd726bef9847f18d7428d5e\n\nThere is no file 28/0c... however.\n"},{"id":"261683","messageId":"20150520181944.GA1537@serenity.lan","threadId":"39383","inReplyTo":"CAGZ79kZY68HFDipxLVas9Dg9+NfpOGmywpWfwFL31A0EpLmJFw@mail.gmail.com","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"John Keeping","fromEmail":"john@keeping.me.uk","sentAt":"2015-05-20T18:19:44Z","receivedAt":"2015-05-20T18:19:44Z","isPatch":false,"sender":{"key":"john@keeping.me.uk","avatar":"https://avatars.githubusercontent.com/u/1702081?v=4"},"body":"On Wed, May 20, 2015 at 11:02:14AM -0700, Stefan Beller wrote:\n> $ git clone https://github.com/fmitha/SICL\n> cd SICL\n> $ git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n> fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n> $ git show 12323213123 # just to be sure to have a different error\n> message for non existing objects.\n> fatal: ambiguous argument '12323213123': unknown revision or path not\n> in the working tree.\n\nI think 40 hex characters is special cased.  Using CGit as a repository\nwith a submodule so I can easily get an unrelated SHA1 and short name:\n\ncgit $ git show $(git -C git rev-parse @)\nfatal: bad object bb8577532add843833ebf8b5324f94f84cb71ca0\ncgit $ git show $(git -C git rev-parse --short @)\nfatal: ambiguous argument 'bb85775': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\n"},{"id":"261681","messageId":"20150520182218.GD14561@peff.net","threadId":"39383","inReplyTo":"CAGZ79kZY68HFDipxLVas9Dg9+NfpOGmywpWfwFL31A0EpLmJFw@mail.gmail.com","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-20T18:22:19Z","receivedAt":"2015-05-20T18:22:19Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 20, 2015 at 11:02:14AM -0700, Stefan Beller wrote:\n\n> $ git clone https://github.com/fmitha/SICL\n> cd SICL\n> $ git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n> fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n> $ git show 12323213123 # just to be sure to have a different error\n> message for non existing objects.\n> fatal: ambiguous argument '12323213123': unknown revision or path not\n> in the working tree.\n\nYeah, this is well-known. If you give a partial hash, the error comes\nfrom get_sha1(), which says \"hey, this doesn't look like anything I know\nabout\". If you feed a whole hash, we skip all that and say \"well, you\n_definitely_ meant this sha1\", and then later code complains when it\ncannot be read.\n\nWe could add a has_sha1_file() check in get_sha1 for this case. I can't\nthink offhand of any reason it would need to be called with a\nnon-existent object, but there may be some lurking corner case (e.g.,\n\"cat-file -e\" or something).\n\n-Peff\n"},{"id":"261682","messageId":"alpine.DEB.2.11.1505202341170.9343@orwell.homelinux.org","threadId":"39383","inReplyTo":"CAGZ79kZY68HFDipxLVas9Dg9+NfpOGmywpWfwFL31A0EpLmJFw@mail.gmail.com","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Faheem Mitha","fromEmail":"faheem@faheem.info","sentAt":"2015-05-20T18:24:01Z","receivedAt":"2015-05-20T18:24:01Z","isPatch":false,"sender":{"key":"faheem@faheem.info","avatar":null},"body":"\nHi Stefan,\n\nThank you for the reply, but I don't follow what conclusion you are \ndrawing, if any.\n\nOn Wed, 20 May 2015, Stefan Beller wrote:\n\n> $ git clone https://github.com/fmitha/SICL\n> cd SICL\n> $ git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n> fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n> $ git show 12323213123 # just to be sure to have a different error\n> message for non existing objects.\n> fatal: ambiguous argument '12323213123': unknown revision or path not\n> in the working tree.\n>\n> $ mv .git/objects/pack/pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.pack .\n> $ rm .git/objects/pack/pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.idx\n> $ git unpack-objects < pack-d56da8c18f5aa915d7fe230efae7315a0101dc19.pack\n> $ git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n> fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n> $ ls .git/objects/28/0*\n> .git/objects/28/01fef08b1dccf9725dde919a7373748a046cb7\n> .git/objects/28/03d8c1cb3275979ff2d8408450844f6a78a70d\n> .git/objects/28/0663a93d702a7fcb0dd36f461397f6b50ba01e\n> .git/objects/28/068e2656dd4bac61050e870712578032af9144\n> .git/objects/28/074e890d6ff2bb61eb7796bc500b6d8e344ad2\n> .git/objects/28/08596ac465cf8a819a9b13ad2f855e9a8a3235\n> .git/objects/28/098184d1ba97453227c18628cdf13087b6bce2\n> .git/objects/28/0ba19c68b26ee7c799ef8ca09d540a5ad7a5b2\n> .git/objects/28/0d66213173f0ae7aaae8684f3efcb1f8790792\n> .git/objects/28/0da35374c32303cbd726bef9847f18d7428d5e\n>\n> There is no file 28/0c... however.\n\nSo, is the repos corrupt or not? Also, I don't understand why you say\n\n     There is no file 28/0c... however.\n\nWhy would you expect there to be? I don't see it mentioned in that list.\n\nI apologise for my ignorance. I don't really know anything about git. I \njust happened to encounter this error.\n\n                                                   Regards, Faheem Mitha\n"},{"id":"261684","messageId":"20150520183115.GB7142@peff.net","threadId":"39383","inReplyTo":"20150520182218.GD14561@peff.net","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-20T18:31:15Z","receivedAt":"2015-05-20T18:31:15Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 20, 2015 at 02:22:19PM -0400, Jeff King wrote:\n\n> On Wed, May 20, 2015 at 11:02:14AM -0700, Stefan Beller wrote:\n> \n> > $ git clone https://github.com/fmitha/SICL\n> > cd SICL\n> > $ git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n> > fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n> > $ git show 12323213123 # just to be sure to have a different error\n> > message for non existing objects.\n> > fatal: ambiguous argument '12323213123': unknown revision or path not\n> > in the working tree.\n> \n> Yeah, this is well-known. If you give a partial hash, the error comes\n> from get_sha1(), which says \"hey, this doesn't look like anything I know\n> about\". If you feed a whole hash, we skip all that and say \"well, you\n> _definitely_ meant this sha1\", and then later code complains when it\n> cannot be read.\n> \n> We could add a has_sha1_file() check in get_sha1 for this case. I can't\n> think offhand of any reason it would need to be called with a\n> non-existent object, but there may be some lurking corner case (e.g.,\n> \"cat-file -e\" or something).\n\nI should have looked before replying. It would indeed break \"cat-file\n-e\" horribly. So the right answer may be to just improve the \"bad\nobject\" message (probably by checking has_sha1_file there and diagnosing\nit either as missing or corrupted).\n\n-Peff\n"},{"id":"261685","messageId":"CAGZ79kb9xUZfa9923rrUP1x0T2=KzczmmNyYi5zD30mWKJ81KQ@mail.gmail.com","threadId":"39383","inReplyTo":"alpine.DEB.2.11.1505202341170.9343@orwell.homelinux.org","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2015-05-20T18:54:27Z","receivedAt":"2015-05-20T18:54:27Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, May 20, 2015 at 11:24 AM, Faheem Mitha <faheem@faheem.info> wrote:\n\n> So, is the repos corrupt or not? Also, I don't understand why you say\n>\n>     There is no file 28/0c... however.\n>\n> Why would you expect there to be? I don't see it mentioned in that list.\n>\n\nEach object is stored at .git/objects/<xz>/<tail> with <xz> being the first\n2 characters of the sha1 and the tail the remaining 38 characters of the sha1.\nI did not draw a conclusion yet, as I needed to run for a meeting.\n\nSo the object you're looking for is not there (stating this as a fact).\nBut why would you expect it to be there? At the time of sending the previous\nemail I tried to do a reverse search \"Give me all objects, which\nreference objectX\"\nbut did not succeed yet.\n\nStefan\n"},{"id":"261687","messageId":"alpine.DEB.2.11.1505210040570.9343@orwell.homelinux.org","threadId":"39383","inReplyTo":"CAGZ79kb9xUZfa9923rrUP1x0T2=KzczmmNyYi5zD30mWKJ81KQ@mail.gmail.com","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Faheem Mitha","fromEmail":"faheem@faheem.info","sentAt":"2015-05-20T19:13:17Z","receivedAt":"2015-05-20T19:13:17Z","isPatch":false,"sender":{"key":"faheem@faheem.info","avatar":null},"body":"\nOn Wed, 20 May 2015, Stefan Beller wrote:\n\n> On Wed, May 20, 2015 at 11:24 AM, Faheem Mitha <faheem@faheem.info> wrote:\n\n>> So, is the repos corrupt or not? Also, I don't understand why you say\n\n>>     There is no file 28/0c... however.\n\n>> Why would you expect there to be? I don't see it mentioned in that list.\n\n> Each object is stored at .git/objects/<xz>/<tail> with <xz> being the \n> first 2 characters of the sha1 and the tail the remaining 38 characters \n> of the sha1. I did not draw a conclusion yet, as I needed to run for a \n> meeting.\n\n> So the object you're looking for is not there (stating this as a fact). \n> But why would you expect it to be there? At the time of sending the \n> previous email I tried to do a reverse search \"Give me all objects, \n> which reference objectX\" but did not succeed yet.\n\nOk. See my reply to Matthieu Moy for context. I make have been taking too \nmuch for granted before posting to this list. Maybe I should have asked \nhere first.\n\nAs I wrote to him, I can reconstruct the original setup if anyone thinks \nit is worthwhile trying to investigate further.\n\n                                                    Regards, Faheem Mitha\n"},{"id":"261708","messageId":"xmqqpp5vm2cw.fsf@gitster.dls.corp.google.com","threadId":"39383","inReplyTo":"20150520182218.GD14561@peff.net","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-20T20:16:15Z","receivedAt":"2015-05-20T20:16:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> We could add a has_sha1_file() check in get_sha1 for this case.\n\nPlease don't.  get_sha1() is merely \"I have this string, which may\nbe a 40-hex or an extended SHA-1 expression.  Turn it into a 20-byte\nbinary\" and does not require you to have any such object.\n"},{"id":"261711","messageId":"xmqqlhgjm19z.fsf@gitster.dls.corp.google.com","threadId":"39383","inReplyTo":"20150520183115.GB7142@peff.net","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-20T20:39:36Z","receivedAt":"2015-05-20T20:39:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> I should have looked before replying. It would indeed break \"cat-file\n> -e\" horribly. So the right answer may be to just improve the \"bad\n> object\" message (probably by checking has_sha1_file there and diagnosing\n> it either as missing or corrupted).\n\nI should have looked before replying, too ;-)\n\nYeah, \"bad object\" sounds as if we tried to parse something that\nexists and it was corrupt.  So classifying \"a file or a pack index\nentry exists where a valid object with that name should reside in\"\nas \"bad object\" and \"there is no such file or a pack index entry\nthat would house the named object\" as \"missing object\" _might_ make\nthings better.\n\nBut let's think about it a bit more.  Would it have prevented the\noriginal confusion if we said \"missing object\"?  I have a feeling\nthat it wouldn't have.  Faheem was so convinced that the object\nnamed with the 40-hex *must* exist in the cloned repository, and if\nwe told \"missing object\" to such a person, it will just enforce the\n(mis)conception that the repository is somehow corrupt, when it is\nnot.\n\nSo...\n"},{"id":"261714","messageId":"CAGZ79kY7wg1JjshwZOtWhm_0qP=CBQqvhqayZpvhu35WuMhxWQ@mail.gmail.com","threadId":"39383","inReplyTo":"xmqqlhgjm19z.fsf@gitster.dls.corp.google.com","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2015-05-20T20:57:45Z","receivedAt":"2015-05-20T20:57:45Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, May 20, 2015 at 1:39 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>\n> So...\n\nmaybe we need a command:\n\nGiven this SHA1, tell me anything you know about it,\nIs it a {blob,tree,commit,tag}?\nIs it referenced from anywhere else in this repository and if so, which type?\nAnd if it is not referenced, nor an object, tell me so explicitely.\n\n\nThis would have helped a lot for this confusion:\n\n    $ git frotz 280c12...\n     No object exists with such a substring (either as prefix, postfix\nor in between)\n     No other object is referencing any object containing this\nsubstring as pre/post-fix\n\nand this issue would have been resolved in a heartbeat.\n\nSpecially the verbose feature is contradicting the terse unix style though\nand this command is tailored to this issue, so I don't know if it's any useful\noutside this specific problem.\n"},{"id":"261717","messageId":"938467222.2099913.1432155797402.JavaMail.zimbra@imag.fr","threadId":"39383","inReplyTo":"CAGZ79kZY68HFDipxLVas9Dg9+NfpOGmywpWfwFL31A0EpLmJFw@mail.gmail.com","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-05-20T21:03:17Z","receivedAt":"2015-05-20T21:03:17Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"sbeller@google.com writes:\n> $ git clone https://github.com/fmitha/SICL\n> cd SICL\n> $ git show 280c12ab49223c64c6f914944287a7d049cf4dd0\n> fatal: bad object 280c12ab49223c64c6f914944287a7d049cf4dd0\n> $ git show 12323213123 # just to be sure to have a different error message for non existing objects.\n\nI did the same, but the error message is different if you provide an abreviated sha1 or a full 40-chars sha1.\n\nAny full sha1 I tried gave the same error message.\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"},{"id":"261718","messageId":"xmqq4mn7m00c.fsf@gitster.dls.corp.google.com","threadId":"39383","inReplyTo":"CAGZ79kY7wg1JjshwZOtWhm_0qP=CBQqvhqayZpvhu35WuMhxWQ@mail.gmail.com","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2015-05-20T21:06:59Z","receivedAt":"2015-05-20T21:06:59Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Stefan Beller <sbeller@google.com> writes:\n\n> On Wed, May 20, 2015 at 1:39 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>\n>> So...\n>\n> maybe we need a command:\n>\n> Given this SHA1, tell me anything you know about it,\n> Is it a {blob,tree,commit,tag}?\n> Is it referenced from anywhere else in this repository and if so, which type?\n> And if it is not referenced, nor an object, tell me so explicitely.\n\nLet me add another to that list ;-)\n\n  I have this prefix; please enumerate all known objects that share it.\n\nI do not know the value of the first two in your list.  If it is a\nknown object, then you throw it at \"git show\", \"git cat-file -t\" and\ndig from there.  If it is not known, there is nothing more to do.\n\nI do not know if \"need\" is the right word, but I hope that you\nrealize the last two among the four you listed need the equivalent\nof \"git fsck\".  It is an expensive operation.\n"},{"id":"261719","messageId":"CAGZ79kab8a9H2SFaqi2PFLxhqH86wD35STPo0Jw7CyFe7e9tig@mail.gmail.com","threadId":"39383","inReplyTo":"xmqq4mn7m00c.fsf@gitster.dls.corp.google.com","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2015-05-20T21:13:19Z","receivedAt":"2015-05-20T21:13:19Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, May 20, 2015 at 2:06 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Stefan Beller <sbeller@google.com> writes:\n>\n>> On Wed, May 20, 2015 at 1:39 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>>>\n>>> So...\n>>\n>> maybe we need a command:\n>>\n>> Given this SHA1, tell me anything you know about it,\n>> Is it a {blob,tree,commit,tag}?\n>> Is it referenced from anywhere else in this repository and if so, which type?\n>> And if it is not referenced, nor an object, tell me so explicitely.\n>\n> Let me add another to that list ;-)\n>\n>   I have this prefix; please enumerate all known objects that share it.\n>\n> I do not know the value of the first two in your list.  If it is a\n> known object, then you throw it at \"git show\", \"git cat-file -t\" and\n> dig from there.  If it is not known, there is nothing more to do.\n\nRight, I just tried to think of all the questions which are relevant to answer\nin such a case, so probably this can be outside of\n\n>\n> I do not know if \"need\" is the right word, but I hope that you\n> realize the last two among the four you listed need the equivalent\n> of \"git fsck\".  It is an expensive operation.\n\nYes, I do realize that. The way I interpreted Faheems original message was:\n\n    git fsck tells me everything is alright, but I don't trust fsck.\nSo now I want\n    to find a way to ask Git about everything it knows about this\n$SHA1 and print\n    it for me so I can manually look at each entry and verify by hand.\n\nSo that's why I included the parts easily done with cat-file and show.\n"},{"id":"261725","messageId":"20150520215547.GD8421@peff.net","threadId":"39383","inReplyTo":"xmqqlhgjm19z.fsf@gitster.dls.corp.google.com","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-05-20T21:55:47Z","receivedAt":"2015-05-20T21:55:47Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 20, 2015 at 01:39:36PM -0700, Junio C Hamano wrote:\n\n> Yeah, \"bad object\" sounds as if we tried to parse something that\n> exists and it was corrupt.  So classifying \"a file or a pack index\n> entry exists where a valid object with that name should reside in\"\n> as \"bad object\" and \"there is no such file or a pack index entry\n> that would house the named object\" as \"missing object\" _might_ make\n> things better.\n> \n> But let's think about it a bit more.  Would it have prevented the\n> original confusion if we said \"missing object\"?  I have a feeling\n> that it wouldn't have.  Faheem was so convinced that the object\n> named with the 40-hex *must* exist in the cloned repository, and if\n> we told \"missing object\" to such a person, it will just enforce the\n> (mis)conception that the repository is somehow corrupt, when it is\n> not.\n> \n> So...\n\nI dunno. If it were phrased not as \"missing object\" but as \"there is no\nsuch object in the repository\", then it seems more clear to me that the\nerror is in the request, not in the repository (and hopefully the user\nwould examine their assumption that it should be).\n\nBut \"bad object\" is just a horrible error message. It actively implies\ncorruption. And I think if we do have corruption, then parse_object()\nalready reports it. For example:\n\n  # helpers\n  objfile() {\n    printf '.git/objects/%s' $(echo $1 | sed 's,..,&/,')\n  }\n  blob=$(echo content | git hash-object -w --stdin)\n\n  # object with a sha1 mismatch\n  mismatch=1234567890123456789012345678901234567890\n  mkdir .git/objects/12\n  cp $(objfile $blob) $(objfile $mismatch)\n\n  # plain old missing object\n  missing=1234abcdef1234abcdef1234abcdef1234abcdef\n\n  # object with data corruption\n  corrupt=$blob\n  chmod +w $(objfile $corrupt)\n  dd if=/dev/zero of=$(objfile $corrupt) bs=1 count=1 conv=notrunc seek=10\n\n  # now show each\n  for bad in corrupt mismatch missing; do\n    echo \"==> $bad\"\n    git --no-pager show $(eval \"echo \\$$bad\")\n  done\n\nproduces:\n\n  ==> corrupt\n  error: inflate: data stream error (invalid distance too far back)\n  error: unable to unpack d95f3ad14dee633a758d2e331151e950dd13e4ed header\n  error: inflate: data stream error (invalid distance too far back)\n  fatal: loose object d95f3ad14dee633a758d2e331151e950dd13e4ed (stored in .git/objects/d9/5f3ad14dee633a758d2e331151e950dd13e4ed) is corrupt\n  ==> mismatch\n  error: sha1 mismatch 1234567890123456789012345678901234567890\n  fatal: bad object 1234567890123456789012345678901234567890\n  ==> missing\n  fatal: bad object 1234abcdef1234abcdef1234abcdef1234abcdef\n\nNote that the \"missing\" case is the only one that _doesn't_ give further\nclarification, and it is likely to be the most common (however just\nchanging \"bad object\" to \"no such object\" would be a bad idea, as it\nmakes the second case harder to understand).\n\n-Peff\n"},{"id":"261760","messageId":"vpqd21ujqra.fsf@anie.imag.fr","threadId":"39383","inReplyTo":"alpine.DEB.2.11.1505202256330.9343@orwell.homelinux.org","subject":"Re: [PUB]corrupt repos does not return error with `git fsck`","fromName":"Matthieu Moy","fromEmail":"matthieu.moy@grenoble-inp.fr","sentAt":"2015-05-21T08:09:45Z","receivedAt":"2015-05-21T08:09:45Z","isPatch":false,"sender":{"key":"matthieu.moy@grenoble-inp.fr","avatar":"https://gravatar.com/avatar/72c8a2705971a25dfaff23cece15130d405685845d911aedd5667ace277f3fc5?d=mp&s=160"},"body":"Faheem Mitha <faheem@faheem.info> writes:\n\n> I was going by the answer (by CodeWizard) in\n> http://stackoverflow.com/q/30348615/350713\n\nOK, so the hash you got comes from a superproject which references it.\nMy guess is that the superproject did a private commit in a submodule,\nadded this submodule to the superproject, and forgot to push the\nsubmodule.\n\nIf so, it's a user error (that could arguably have been avoided with a\nbetter command-line interface, so Git is partly guilty), but not a\nrepository corruption.\n\n> If I just give a random hash to `git show` in that repos, I get\n>\n>     fatal: ambiguous argument '...': unknown revision or path not in the working tree.\n\nNot \"a random hash\", but a random abreviated hash. Look:\n\nChanging the last digit:\n\n$ git show 280c12ab49223c64c6f914944287a7d049cf4d23\nfatal: bad object 280c12ab49223c64c6f914944287a7d049cf4d23\n$ git show 280c12ab49223c64c6f914944287a7d049cf4d24\nfatal: bad object 280c12ab49223c64c6f914944287a7d049cf4d24\n$ git show 280c12ab49223c64c6f914944287a7d049cf4d25\nfatal: bad object 280c12ab49223c64c6f914944287a7d049cf4d25\n$ git show 280c12ab49223c64c6f914944287a7d049cf4d26\nfatal: bad object 280c12ab49223c64c6f914944287a7d049cf4d26\n\nRemoving the last digit:\n\n$ git show 280c12ab49223c64c6f914944287a7d049cf4d2 \nfatal: ambiguous argument '280c12ab49223c64c6f914944287a7d049cf4d2': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\n\n-- \nMatthieu Moy\nhttp://www-verimag.imag.fr/~moy/\n"}]}