{"thread":{"id":"14924","subject":"Git tree/blob and corresponding commit","startedAt":"2008-08-10T17:08:27Z","lastAt":"2008-08-15T19:39:14Z","messageCount":5,"participants":["Pascal Obry","Jonathan Nieder","Bryan Donlan"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"86691","messageId":"489F208B.2070006@obry.net","threadId":"14924","inReplyTo":null,"subject":"Git tree/blob and corresponding commit","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2008-08-10T17:08:27Z","receivedAt":"2008-08-10T17:08:27Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"\nSomething I'm trying to figure out and can't find the answer myself. I'm \nbrowsing a tree, for example:\n\n    $ git ls-tree HEAD~100\n\nThis list a set of files with the corresponding blob. Each blob has it's \nown SHA1. Fine.\n\nNow given a SHA1 I'd like to know which commit has created (was \ncontaining) this specific blob?\n\nWhat is the best way to achieve that?\n\nThanks.\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"86716","messageId":"Pine.GSO.4.62.0808101519220.16851@harper.uchicago.edu","threadId":"14924","inReplyTo":"489F208B.2070006@obry.net","subject":"Re: Git tree/blob and corresponding commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@uchicago.edu","sentAt":"2008-08-10T20:38:59Z","receivedAt":"2008-08-10T20:38:59Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Pascal Obry wrote:\n\n> Now given a SHA1 I'd like to know which commit has created (was containing)\n> this specific blob?\n\nWhy do you want to know?  The right method depends on your reason.  You\nprobably know more than I do about this, but here are my thoughts.\n\nIf some loose object of yours got corrupted and you are trying to\nsee what exactly is missing, then (for this task) you are in luck.  See\n<http://www.kernel.org/pub/software/scm/git/docs/howto/recover-corrupted-blob-object.txt>.\n\nIf some packed object got corrupted, I'd be interested to hear how\nthis is handled.  I think there was discussion recently of how to\nrecover from that situation.  If you have the luxury, it might be good\nto use unpack-objects to get to the first situation.\n\nBut I think that is not your situation.  I'll assume for definiteness\nthat some source file appeared out of thin air in your /lost+found and\nyou are trying to figure out what it is.  Then see\n<http://thread.gmane.org/gmane.comp.version-control.git/44750/focus=44754>\nand surrounding discussion.  You could use \"git ls-tree -r\" if you do\nnot have the filename.\n\nHope that helps,\nJonathan\n"},{"id":"86717","messageId":"Pine.GSO.4.62.0808101542140.17376@harper.uchicago.edu","threadId":"14924","inReplyTo":"Pine.GSO.4.62.0808101519220.16851@harper.uchicago.edu","subject":"Re: Git tree/blob and corresponding commit","fromName":"Jonathan Nieder","fromEmail":"jrnieder@uchicago.edu","sentAt":"2008-08-10T20:44:07Z","receivedAt":"2008-08-10T20:44:07Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"I wrote:\n\n> see\n> <http://thread.gmane.org/gmane.comp.version-control.git/44750/focus=44754>\n\nbut I actually meant\n<http://thread.gmane.org/gmane.comp.version-control.git/44750/focus=44849>.\nAnyway, the whole thread is interesting.  Sorry for the noise.\n\nSincerely,\nJonathan\n"},{"id":"87192","messageId":"48A43AEC.6000904@obry.net","threadId":"14924","inReplyTo":"Pine.GSO.4.62.0808101542140.17376@harper.uchicago.edu","subject":"Re: Git tree/blob and corresponding commit","fromName":"Pascal Obry","fromEmail":"pascal@obry.net","sentAt":"2008-08-14T14:02:20Z","receivedAt":"2008-08-14T14:02:20Z","isPatch":false,"sender":{"key":"pascal@obry.net","avatar":"https://avatars.githubusercontent.com/u/467069?v=4"},"body":"Jonathan,\n\n> but I actually meant\n> <http://thread.gmane.org/gmane.comp.version-control.git/44750/focus=44849>.\n> Anyway, the whole thread is interesting.  Sorry for the noise.\n\nThanks, I had a look. This is indeed giving some procedure... I was \nhopping for something faster (git rev-list takes some time!).\n\n-- \n\n--|------------------------------------------------------\n--| Pascal Obry                           Team-Ada Member\n--| 45, rue Gabriel Peri - 78114 Magny Les Hameaux FRANCE\n--|------------------------------------------------------\n--|              http://www.obry.net\n--| \"The best way to travel is by means of imagination\"\n--|\n--| gpg --keyserver wwwkeys.pgp.net --recv-key C1082595\n"},{"id":"87345","messageId":"3e8340490808151239u4572f5e4l11c16e0225509224@mail.gmail.com","threadId":"14924","inReplyTo":"48A43AEC.6000904@obry.net","subject":"Re: Git tree/blob and corresponding commit","fromName":"Bryan Donlan","fromEmail":"bdonlan@gmail.com","sentAt":"2008-08-15T19:39:14Z","receivedAt":"2008-08-15T19:39:14Z","isPatch":false,"sender":{"key":"bdonlan@gmail.com","avatar":null},"body":"On Thu, Aug 14, 2008 at 10:02 AM, Pascal Obry <pascal@obry.net> wrote:\n> Jonathan,\n>\n>> but I actually meant\n>>\n>> <http://thread.gmane.org/gmane.comp.version-control.git/44750/focus=44849>.\n>> Anyway, the whole thread is interesting.  Sorry for the noise.\n>\n> Thanks, I had a look. This is indeed giving some procedure... I was hopping\n> for something faster (git rev-list takes some time!).\n\nIt's not really meant to be a common case; if the same file is created\nunder different names by different commits that aren't ancestors of\neach other, then it's unclear which should be reported. As such,\nthere's no index or other such thing to quickly find the commits\ncorresponding to a blob, so you just have to walk the entire history.\n"}]}