Skip to content

Include a git distribution, as many packages on npm depend on it #67

Open

Description

@dbkaplun

npm depends on git in the following ways (credit to @isaacs):

  • Parsing out the git remote for npm init (see Implement git config --get remote.<remote>.url maryrosecook/gitlet#8)
  • Fetching dependencies that are listed as git urls (gitlet, possibly jsgit)
  • Verifying that the git repo is clean on npm version
  • Committing and tagging the local repo on npm version (and, optionally, signing said tag by passing the -s arg to git.)

The issue should be closed once a git is found that can run on NodeOS and can do all of these.

Activity

  1. piranna commented on Sep 16, 2014

    @piranna
    Member

    There are several pure-Javascript git client libraries (https://www.npmjs.org/package/git, https://www.npmjs.org/package/js-git), but seems none of them has a CLI... :-/

    Could you be able to point us why a git CLI command is needed? NPM should manage automatically git repositories and not depend on external tools, and if so, then it should be fixed...

  2. dbkaplun commented on Sep 17, 2014

    @dbkaplun
    Author

    @piranna see here. npm allows git dependencies, but requires a git command as an external tool in order to fetch them.

  3. piranna commented on Sep 17, 2014

    @piranna
    Member

    I know npm support git urls (we use them at work during development since we only publish on npm the stable releases), I'm only saying npm should use a Javascript library instead of a external command.

  4. seanewest commented on Sep 17, 2014

    @seanewest
    Contributor

    I think it would be cool to implement a minimal CLI on top of https://github.com/creationix/js-git . We could start by just implementing the functionality that npm requires out of the git command line tool.

  5. piranna commented on Sep 17, 2014

    @piranna
    Member

    It's not a bad idea...

  6. groundwater commented on Sep 22, 2014

    @groundwater
    Contributor

    I think in general, a git written in pure-js that fulfills all of npm's needs would be fantastic. Perhaps @othiym23 has a word on how useful that would be.

  7. othiym23 commented on Sep 22, 2014

    @othiym23

    It would be fantastic! Obviously! But the amount of git that npm uses is pretty hefty at this point. It's mostly git clone, git status, and git tag (with support for calling out to gpg --sign), but lots of different kinds of git URLS, lots of permissions logic, etc.

  8. dbkaplun commented on Sep 22, 2014

    @dbkaplun
    Author

    Would it be possible to package git as a binary that works in NodeOS? That would be a good way to get npm working without having to implement or extend a pure Node-based git replacement.

  9. piranna commented on Sep 22, 2014

    @piranna
    Member

    If they are so few commands, why npm doesn't use already a Javascript library? How does it do in Windows if there's no git command available, for example? Shouldn't it be better and easier add it to npm itself instead of add a git command to NodeOS?

  10. othiym23 commented on Sep 23, 2014

    @othiym23

    If they are so few commands, why npm doesn't use already a Javascript library?

    I bet @creationix would have a pithy answer to this; it turns out that supporting all of git's transport mechanisms in addition to dealing with packfiles and all of the file-manipulation magic necessary to check out a repo correctly isn't trivial business.

    How does it do in Windows if there's no git command available, for example?

    It fails miserably. npm on Windows requires Git just as much as it does on Unix.

    Shouldn't it be better and easier add it to npm itself instead of add a git command to NodeOS?

    We have to pick and choose our battles. Apparently, @isaacs chose the battle where he rewrote his own version of tar from the ground up to handle all of the many, many weird edge cases that can show up in tar files, and that's comparatively simple next to making a functional git client.

    As always, though: patches welcome!

  11. creationix commented on Sep 24, 2014

    @creationix

    Getting js-git to the point that it can be used internally by npm is closer. If someone wanted to take on this task, I could guide them. The main tasks are:

    • Clone over HTTPS. The actual clone is pretty much finished, you just need a node adapter to use node's https client (or use http-codec on top of node's tls module).
    • Check out files. Since npm doesn't need to create an actual git checkout complete with index, we can just export the files for a given commit/tag to disk. Trivial in current js-git
    • Clone over TCP, this is also easy, but only works for git:// read-only urls.
    • Clone over SSH. This is considerably harder, but much easier in node as opposed to in browser where raw TCP and TLS are harder to come by. The https://github.com/mscdex/ssh2 module would come in handy here.

    As far as tagging and writing to a git database, that's not implemented as a high-level API, but it's pretty trivial to import a directory into git, create a commit from it and tag that commit. You'd still need to shell out to gpg or find a JS implementation for that use case.

    Overall I think it's quite possible and just needs someone motivated and with time to finish it.

  12. creationix commented on Sep 24, 2014

    @creationix

    Also on my list of mad science experiments, fuse for node in pure js and zip for node in pure js. Though if you're willing to bundle node-fuse I have a library that lets you mount a git repo as a read-only filesystem that could be interesting for node_modules.

  13. piranna commented on Sep 25, 2014

    @piranna
    Member

    @creationix, these are great news if it could be so easy! :-)

    Clone over TCP, this is also easy, but only works for git:// read-only urls.

    Why is that? Shouldn't read-write urls fetched the same way? Only point you can't be able to push... And if you are talking about NPM GitHub repos, it should be managed by npm itself...

    You'd still need to shell out to gpg or find a JS implementation for that use case.

    Probably these two could be used:

    http://openpgpjs.org/
    https://www.npmjs.org/package/gpg

    Though if you're willing to bundle node-fuse I have a library that lets you mount a git repo as a read-only filesystem that could be interesting for node_modules.

    Current Ubuntu kernel has FUSE support, so node-fuse could be added when building the image, it's on the roadmap to be able to install on runtime compiled modules, but it's not easy seems it requires to have installed a toolchain, and we are trying to make NodeOS to be minmalistic and have a small footprint, and install only the required resources when needed by using `ǹpm install``. Could you be able to explain us how the mounted git repo could be used for node_modules?

    P.D.: greetings from an old Ubuntu-Tweak user ;-)

  14. creationix commented on Sep 26, 2014

    @creationix

    When I said "read-only urls" I meant you wouldn't be able to push to the remote, only read from it. This is fine for most npm actions, but npm does write for some things like auto tagging/publishing I think.

    The fuse idea is mad science. I wouldn't use node-fuse if you're going for minimal. Implementing fuse in JS isn't that terrible (it's easier than git or zlib). But the basic idea is instead of exporting the files to disk, mount the repos as subfolders under node_modules. This is probably not that good for npm's typical use case though.

  15. piranna commented on Sep 26, 2014

    @piranna
    Member

    When I said "read-only urls" I meant you wouldn't be able to push to the remote, only read from it. This is fine for most npm actions, but npm does write for some things like auto tagging/publishing I think.

    AFAIK, npm doesn't write to git never. When publishing, content is
    uploaded by simple HTTP POST to npm registry, and in fact there are
    published several packages without a repository at all, so I believe
    read-only git urls is just enough.

    Bower on the other hand, it use git repositories for publishing since
    it doesn't have a real registry (bower registry is mostly an url
    shortened, said by their developers themselves), but that's another
    story.

    The fuse idea is mad science. I wouldn't use node-fuse if you're going for minimal. Implementing fuse in JS isn't that terrible (it's easier than git or zlib). But the basic idea is instead of exporting the files to disk, mount the repos as subfolders under node_modules. This is probably not that good for npm's typical use case though.

    I would need to see the use case in detail, I don't finish to
    understand what you are trying to achieve. But it's true, fuse is
    ideal for mad science... :-D

    "Si quieres viajar alrededor del mundo y ser invitado a hablar en un
    monton de sitios diferentes, simplemente escribe un sistema operativo
    Unix."
    – Linus Tordvals, creador del sistema operativo Linux

  16. 149 remaining items

  17. creationix commented on Aug 5, 2017

    @creationix

    Now to just find time to glue this all together...

  18. piranna commented on Aug 5, 2017

    @piranna
    Member

    Now to just find time to glue this all together...

    Take your time :-) Maybe it would be a good idea to commit each one independently so we can review them :-)

  19. creationix commented on Aug 6, 2017

    @creationix

    I'm pretty busy for the next month with a deadline at my startup, feel free to ping me later if I forget about this.

  20. piranna commented on Aug 6, 2017

    @piranna
    Member
  21. creationix commented on Aug 7, 2017

    @creationix

    I'm Director of Engineering at https://daplie.com/. We're trying to decentralize the internet and put ownership of data and networks back in the hands of normal people.

  22. piranna commented on Aug 18, 2017

    @piranna
    Member

    I'm Director of Engineering at https://daplie.com/. We're trying to decentralize the internet and put ownership of data and networks back in the hands of normal people.

    I've seen your webpage, the easy to use home server concept sounds cool! :-)

  23. bogdanbiv commented on Oct 19, 2017

    @bogdanbiv

    @creationix: are there any smaller / junior jobs to be done for this remake of the JSgit project?

    UPDATE: would it be relevant to create an https://github.com/kripken/emscripten port of https://libgit2.github.com/ (Git library implemented in pure C)?
    LibGit2 already has NodeJS bindings, I wonder how hard would it be to replace the calls to the native C library with calls to the EmScripten compiled module.

  24. luii commented on Dec 22, 2017

    @luii
    Member

    @piranna I've got nodeos-git to compile flawlessly but i get a weird error somehow.
    Compilation is totally fine; Startup also; but right after the user init script is run i get
    bin/getty bin/logon: "bin/getty" exited with error code 1 its something like this and i tried to find and trace the error but i've found nothing

  25. luii commented on Jan 6, 2018

    @luii
    Member

    I've cross compiled the nodeos-nodegit package and this resolves the error from above.
    @piranna how do i can link nodeos-libcurl against nodegit
    because it only says that it needs this but cant find it. I know that nodegit has a flag (-lcurl) in the bindings.gyp file, but can i just say: -lcurl /lib for the libcurl (libcurl.so*) to find it later inside nodeos lib folder?

  26. bogdanbiv commented on May 17, 2018

    @bogdanbiv

    @luii, @piranna Stumbled upon this link on hacker news: https://isomorphic-git.github.io/ - A pure JavaScript implementation of git for node and browsers!
    Is this good enough for milestone 1.0.0 - /issues/37 ?

  27. luii commented on May 18, 2018

    @luii
    Member

    @bogdanbiv it looks promising i see if i can use it in nodeos-git, because nodegit is somewhat a dead end for me

  28. bogdanbiv commented on Jul 17, 2018

    @bogdanbiv

    Would it help to set up a bounty to get this ready this issue ready?

  29. bogdanbiv commented on Oct 9, 2018

    @bogdanbiv

    Is there a way I can contribute to implementing nodeos-nodegit? I'm not sure how to break down the tasks.
    use cases:

    Need some research to see how big a subset of the git protocol needs be implemented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions