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

use isomorphic-git to fetch origin, branch, etc instead of shell-js #29

Closed
tripodsan opened this issue Jan 15, 2019 · 4 comments
Closed
Assignees
Labels
enhancement New feature or request

Comments

@tripodsan
Copy link
Contributor

Is your feature request related to a problem? Please describe.
GitUtils uses shell-js to execute git commands to retrieve basic information like remote origin and current branch. this has certain drawbacks:

  • only operates on cwd. i.e. the function would need to change the cwd and restore it after executing
  • it relies on the existence of a git command
  • potentially slower than a native implementation
  • potential problems, if the git output changes

advantage:

  • no package dependency
  • git is very stable and robust, potential implementations might fail

Describe the solution you'd like
Use isomorphic-git (or similar). Since we currently only need a read-only operations, this might be overkill, as it comes with many dependencies. however, we use isomorphic-git also in git-server, so it would already be present in the cli.

Alternative

  • find different library
  • only use in helix-cli, so that helix-shared stays small

git information that is read during up, deploy, etc:

  • isDirty (git status --porcelain)
  • getBranch (git rev-parse --abbrev-ref HEAD)
  • getRepository (git config --get remote.origin.url)
  • getCurrentRevision (git rev-parse HEAD)
@tripodsan tripodsan added the enhancement New feature or request label Jan 15, 2019
@trieloff
Copy link
Contributor

I'm +1 for removing shelljs, but not super excited about adding the isomorphic-git dependency to helix-shared as I'm depending on it for helix-logging and have no need for Git operations there.

Maybe we can just add isomorphic-git as a peer dependency, which will be satisfied in helix-cli, but ignored in helix-logging.

@stefan-guggisberg
Copy link
Contributor

i suggest we add said functionality and the isomorphic-git dependency to helix-cli.

@tripodsan
Copy link
Contributor Author

it seems we don't need the GitUtils anywhere as in helix-cli. maybe we move it back?

also see my interim fix for the cwd problem:
https://github.com/adobe/helix-shared/blob/new-config/src/GitUtils.js

@stefan-guggisberg
Copy link
Contributor

resolved via PR #52

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

No branches or pull requests

3 participants