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

Check file is belong to repository #153

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mishazawa
Copy link

If I try to run git-history in folder outside of repository then git-history run server and throw exception.

$ git-file-history .
Running at http://localhost:5000
Server error { Error: Command failed: git log --max-count=10 --pretty=format:{"hash":"%h","author":{"login":"%aN"},"date":"%ad"}, --date=iso HEAD -- .
fatal: Not a git repository (or any parent up to mount point /home/misha)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).


    at makeError (/usr/lib/node_modules/git-file-history/node_modules/execa/index.js:174:9)
    at Promise.all.then.arr (/usr/lib/node_modules/git-file-history/node_modules/execa/index.js:278:16)
    at process._tickCallback (internal/process/next_tick.js:68:7)
  code: 128,
  stdout: '',
  stderr:
   'fatal: Not a git repository (or any parent up to mount point /home/misha)\nStopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).\n',
  failed: true,
  signal: null,
  cmd:
   'git log --max-count=10 --pretty=format:{"hash":"%h","author":{"login":"%aN"},"date":"%ad"}, --date=iso HEAD -- .',
  timedOut: false,
  killed: false }

I propose to check is command running inside folder that belong to repository by git rev-parse --is-inside-work-tree before running server

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

Successfully merging this pull request may close these issues.

1 participant