Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example to do git.init on a local directory? #103

Open
0xgeert opened this issue Jun 13, 2014 · 6 comments
Open

example to do git.init on a local directory? #103

0xgeert opened this issue Jun 13, 2014 · 6 comments

Comments

@0xgeert
Copy link

0xgeert commented Jun 13, 2014

goes Js-Git support local filesystem directories? All I can find are some in-mem structures?

@creationix
Copy link
Owner

The fs-db backend can read and write disk repos. The node version is at https://github.com/creationix/git-node-fs

@codingisacopingstrategy
Copy link

Interesting stuff. That requires running a server process though. What I wanted to use js-git for, is to read in a local git repository so I can display its tree: given that I can read local files through ajax requests, I wouldn’t need anything beyond what’s already in the browser.

Would I need to write a special back-end for this?

Thanks,

@creationix
Copy link
Owner

Yes, you can read files from the browser, but you can't scan directories. Many files (pack files for example) are unguessable filenames. As long as your repo doesn't use pack-files (most do), it would be possible to write a custom backend using nothing than xhr requests.

@creationix
Copy link
Owner

Another option would be to add support for the metadata http://git-scm.com/docs/git-update-server-info provides. Then a "dumb" client could read the git repo with nothing more than xhr requests. You'd have to externally make sure the extra metadata is kept up to date whenever the git repo is modified.

@codingisacopingstrategy
Copy link

Hey,

Thanks for the swift reply + the insights in git internals. It’s true that it’s less useful if this metadata has to be kept up to date for each commit… do you know if this metadata is transferred when a repository is pushed to a remote, i.e. a github repository?

@codingisacopingstrategy
Copy link

The use case I imagined is for expanded README’s and other situations where code and documentation can be combined in novel ways.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants