# Remote git-cat-file?

7 messages from 2006-05-27 to 2006-05-28. Participants: Elrond, Linus Torvalds, Jakub Narebski, Junio C Hamano.
Thread: https://gitlist.dev/t/4314

## Elrond, 2006-05-27 22:26

Subject: Remote git-cat-file?
Message-ID: <loom.20060528T002420-957@post.gmane.org>
URL: https://gitlist.dev/e/loom.20060528T002420-957%40post.gmane.org

```
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

```

## Linus Torvalds, 2006-05-28 00:29

Subject: Re: Remote git-cat-file?
Message-ID: <Pine.LNX.4.64.0605271727110.5623@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0605271727110.5623%40g5.osdl.org
In-Reply-To: <loom.20060528T002420-957@post.gmane.org>

```


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

```

## Linus Torvalds, 2006-05-28 00:32

Subject: Re: Remote git-cat-file?
Message-ID: <Pine.LNX.4.64.0605271729440.5623@g5.osdl.org>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0605271729440.5623%40g5.osdl.org
In-Reply-To: <Pine.LNX.4.64.0605271727110.5623@g5.osdl.org>

```


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

```

## Elrond, 2006-05-28 10:57

Subject: Re: Remote git-cat-file?
Message-ID: <loom.20060528T124835-757@post.gmane.org>
URL: https://gitlist.dev/e/loom.20060528T124835-757%40post.gmane.org
In-Reply-To: <Pine.LNX.4.64.0605271727110.5623@g5.osdl.org>

```
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

```

## Jakub Narebski, 2006-05-28 12:00

Subject: Re: Remote git-cat-file?
Message-ID: <e5c3c5$i47$1@sea.gmane.org>
URL: https://gitlist.dev/e/e5c3c5%24i47%241%40sea.gmane.org
In-Reply-To: <loom.20060528T124835-757@post.gmane.org>

```
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

```

## Junio C Hamano, 2006-05-28 17:38

Subject: Re: Remote git-cat-file?
Message-ID: <7vu07acanv.fsf@assigned-by-dhcp.cox.net>
URL: https://gitlist.dev/e/7vu07acanv.fsf%40assigned-by-dhcp.cox.net
In-Reply-To: <e5c3c5$i47$1@sea.gmane.org>

```
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.

```

## Jakub Narebski, 2006-05-28 18:34

Subject: Re: Remote git-cat-file?
Message-ID: <e5cqg5$om2$1@sea.gmane.org>
URL: https://gitlist.dev/e/e5cqg5%24om2%241%40sea.gmane.org
In-Reply-To: <7vu07acanv.fsf@assigned-by-dhcp.cox.net>

```
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

```
