On 27 May 2013, at 15:15, David Portabella wrote:
Thanks for the answer.
ok for doing a depth1.
according to the protocol, is is possible to just download the name of the files,
or it is required to download all the content of the files as well?
There isn't a 'server' side of the process/protocol, so none of the commands are executable remotely. The only things that are possible are listing the values of the references and a conversation about what objects are/aren't needed.
> A better question might be "why are you trying to get a list of files" ...
I agree ;)
we have many projects which dependencies among them, and sometimes it is a bit difficult to find the real source of a class or xsd.
having a list of all the files from all the projects/repositories helped a bit; i did that with a cron job with svn list -r url, for each repository.
So the SVN repository has a more heavyweight server process that does a bunch of things for you, like check in, check out, diff, log etc. Git really just has 'What are the current refs?' and 'Give me the objects'. I imagine that you could try and work through the protocol to just get the 'tree' object of the root commit, then go back and get the 'tree' of the children's objects and so on. (Underneath the covers, the clone 1 gets all the trees and all the child objects as well).
It sounds like what you're trying to do is build an index of files in a repository though. For that you might want to either run (a) the indexing on the server side, which will have access to the Git repositories, or (b) if that's not possible build up a list of repositories checked out locally so that you can do a git pull to bring your copy up to date. If you want the latter, the git clone --depth 1 won't really help.
On Mon, May 27, 2013 at 3:50 PM, Alex Blewitt <alex.blewitt@xxxxxxxxx>
You are correct that the Git protocol does not do this.
However you could clone with a depth of 1 which would allow you to iterate through the tree and save downloading the history.
git clone --depth 1 url
I don't think that the JGit API supports a depth restriction.
You could speed it up a little by not doing a checkout afterwards, but that's about it for speeding it up.
A better question might be "why are you trying to get a list of files" ...
Sent from my iPhone 5
On 27 May 2013, at 13:39, David Portabella <david.portabella@xxxxxxxxx
> with svn we can get a list of all the files in a remote repository without checking out the contents locally, with svn list <url>.
> if i understood it correctly, the git client/protocol does not allow this possibility.
> so, i would need to do as follows:
> git clone <url>
> git ls-tree -r --name-only remotes/origin/master
> however, this means that I need to download all the files locally.
> is it possible create a program that lists all the files, without downloading all the files?
> or according to the git procotol, it is impossible to get such a list without downloading the content of all the files?
> if it is possible, can this be done with the JGit library?
> any help in this direction?
> jgit-dev mailing list