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

Get git repository from file path instead of current directory #22

Closed
sharkdp opened this issue Apr 30, 2018 · 2 comments
Closed

Get git repository from file path instead of current directory #22

sharkdp opened this issue Apr 30, 2018 · 2 comments
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@sharkdp
Copy link
Owner

sharkdp commented Apr 30, 2018

Inside the repo:

some/folder/repo > bat test.md

▶ bat test.md
───────┬─────────────────────────────────────────────────────────────────────
       │ File test.md
───────┼─────────────────────────────────────────────────────────────────────
...
  19   │ 
  20 + │ <div>
  21 + │ huhu
  22 + │ </div>
───────┴─────────────────────────────────────────────────────────────────────

Outside the repo:

some/folder > bat repo/test.md

▶ bat test.md
───────┬─────────────────────────────────────────────────────────────────────
       │ File test.md
───────┼─────────────────────────────────────────────────────────────────────
...
  19   │ 
  20   │ <div>
  21   │ huhu
  22   │ </div>
───────┴─────────────────────────────────────────────────────────────────────
@sharkdp sharkdp added bug Something isn't working good first issue Good for newcomers labels May 1, 2018
@jrunning
Copy link

jrunning commented May 4, 2018

This also seems to be an issue when you do bat ../test.md in some/folder/repo/subfolder.

some/folder/repo$ bat test.md
───────┬─────────────────────────────────────────────────────────────────────
       │ File test.md
───────┼─────────────────────────────────────────────────────────────────────
...
  19   │ 
  20 + │ <div>
  21 + │ huhu
  22 + │ </div>
───────┴─────────────────────────────────────────────────────────────────────

some/folder/repo$ cd subfolder

some/folder/repo/subfolder$ bat ../test.md
───────┬─────────────────────────────────────────────────────────────────────
       │ File test.md
───────┼─────────────────────────────────────────────────────────────────────
...
  19   │ 
  20   │ <div>
  21   │ huhu
  22   │ </div>
───────┴─────────────────────────────────────────────────────────────────────

@ghost
Copy link

ghost commented May 4, 2018

I'd like to try fixing this. From a quick look it looks changing to the Repository::discover call might fix it. But that didn't until I commented out the pathspec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants