Find commit that blob belongs to

14 views
Skip to first unread message

Daniel Sheppard

unread,
Nov 22, 2021, 3:13:23 PM11/22/21
to dulwich-discuss
Hello,

I am wondering if there is a way to get the commit a blob belongs to.

Thanks

Jelmer Vernooij

unread,
Nov 22, 2021, 9:41:06 PM11/22/21
to dans...@gmail.com, dulwich-discuss
Hi Daniel,

Unfortunately there isn't any way other than scanning history (though depending on the situation you can probably do this in a clever way). This is an inherent consequence of the git data model.

Jelmer

--
You received this message because you are subscribed to the Google Groups "dulwich-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to dulwich-discu...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/dulwich-discuss/5b3f23ef-b7b6-48ff-b5c0-9f3fd2be87a0n%40googlegroups.com.

Daniel Sheppard

unread,
Nov 23, 2021, 10:33:10 AM11/23/21
to dulwich-discuss
Thanks, kind of figured that.

I am trying to diff against the last object and I was doing it using a custom diff function that needs the indexes but I realised I can just take the change object and diff against that.

I also decided to store a cache of the sha's in the database (for both the commits and the objects) so that makes things easier too.  Thanks for the quick response.

Reply all
Reply to author
Forward
0 new messages