Hi,
Is it possible via the git: protocol to do a git-cat-file?
To download just one object by its ID?
Thanks for your help.
Elrond
Hi,
Is it possible via the git: protocol to do a git-cat-file?
To download just one object by its ID?
Thanks for your help.
Elrond
Re: Remote git-cat-file?
On Sat, 27 May 2006, Elrond wrote:
> > Is it possible via the git: protocol to do a git-cat-file? > > To download just one object by its ID?
Nope.
Well, depending on just how much you know about the object, you can fake it. For example, if you already know it's a commit, and you know the parents, then yes, you can download it by basically saying that you want that particular object and you already have the parents.
But in the general case, the answer is no. Set up a gitweb thing, and look up the objects that way. Or just pull the repo, and look at it locally.
Just out of interest, why would you ever want to just look at a single object?
Linus
Re: Remote git-cat-file?
On Sat, 27 May 2006, Linus Torvalds wrote:
> > Well, depending on just how much you know about the object, you can fake > it. For example, if you already know it's a commit, and you know the > parents, then yes, you can download it by basically saying that you want > that particular object and you already have the parents.
The other (similar) case is for tag objects. When you do "git ls-remote" on the remote repo, it will tell you both the tag object SHA and the object SHA of the thing it points to, so you can then do a git protocol exchange where you do a
for_each_tag "want <tagsha1>"
for_each_tag "have <objectitpointstosha1>"
and you'll get just the tag object back.
Linus
Re: Remote git-cat-file?
Linus Torvalds <torvalds <at> osdl.org> writes: [...]
> But in the general case, the answer is no. Set up a gitweb thing, and look > up the objects that way. Or just pull the repo, and look at it locally.
I ended up doing that (clone whole remote repo).
> Just out of interest, why would you ever want to just look at a single > object?
Well... I screwed up my local clone of a repo. git-fsck told me what objects I needed. So I finally ended up downloading the whole repo again to extract 16 objects. ;)
The other possible use for remote git-cat-file: It might be useful in shallow repos to selectively load objects "on demand". (In fact, I screwed my repo by trying to make it shallow.)
Elrond
Re: Remote git-cat-file?
Elrond wrote:
> Linus Torvalds <torvalds <at> osdl.org> writes: >> >> Just out of interest, why would you ever want to just look at a single >> object?
[...]
> > The other possible use for remote git-cat-file: > It might be useful in shallow repos to selectively load objects "on demand". > (In fact, I screwed my repo by trying to make it shallow.)
It would be nice I think to be able to have remote alternatives, loading (downloading and saving) objects "on demand" ("lazy alternatives"). Not necessary only with "shallow repo"/"shallow clone".
-- Jakub Narebski Warsaw, Poland
Re: Remote git-cat-file?
Jakub Narebski <jnareb@gmail.com> writes:
> It would be nice I think to be able to have remote alternatives,...
Yup, I think I've mentioned that one as one of "the mostly unimplementable but would be very nice to have crazy wishlist items" some time ago. What people would want is not a "shallow" clone, but a "lazy" clone, and in the ideal world that would obviously be a nice thing to have.
Re: Remote git-cat-file?
Junio C Hamano wrote:
> Jakub Narebski <jnareb@gmail.com> writes: > >> It would be nice I think to be able to have remote alternatives,... > > Yup, I think I've mentioned that one as one of "the mostly > unimplementable but would be very nice to have crazy wishlist > items" some time ago. What people would want is not a "shallow" > clone, but a "lazy" clone, and in the ideal world that would > obviously be a nice thing to have.
I think that it should be only "commit-lazy", i.e. downloading whole trees, subtrees, and objects pointed by tags, only not following the parent links of commits; perhaps also other links to commits (branches, tags, tag objects).
-- Jakub Narebski Warsaw, Poland