Skip to content

Check file is belong to repository#153

Open
mishazawa wants to merge 2 commits intopomber:masterfrom
mishazawa:master
Open

Check file is belong to repository#153
mishazawa wants to merge 2 commits intopomber:masterfrom
mishazawa:master

Conversation

@mishazawa
Copy link
Copy Markdown

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