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

GitBlame report requires a .git directory #1249

Closed
sbuzonas opened this issue Dec 18, 2016 · 7 comments
Closed

GitBlame report requires a .git directory #1249

sbuzonas opened this issue Dec 18, 2016 · 7 comments

Comments

@sbuzonas
Copy link

Using git-worktree has a file at .git pointing to the git directory, as well as the GIT_DIR environment variable that could change the location.

@gsherwood
Copy link
Member

I'm not really sure what you are describing here. Presumably, the git blame report isn't work for you because the git blame command has either failed or is always looking at the main working tree, but you'll have to explain things a bit more for me to know for sure.

@sbuzonas
Copy link
Author

sbuzonas commented Jan 4, 2017

The git blame command respects all the various ways to have a git repository. The report class only checks for the existence of a git directory, and quits otherwise. https://github.com/squizlabs/PHP_CodeSniffer/blob/master/CodeSniffer/Reports/Gitblame.php#L96

@gsherwood
Copy link
Member

@sbuzonas Thanks for the extra information. I understand your problem now.

@gsherwood
Copy link
Member

gsherwood commented Jan 4, 2017

It looks to me like a solution might be to just chdir into the same dir that the file exists within instead of trying to find a .git directory in the path. Presumably, git blame will work when run from within the same dir as the file, picking up the correct repo for more complex setups.

@gsherwood
Copy link
Member

@sbuzonas I've pushed a change to make the report more simple. Are you able to try out the code on master, or manually patch the Gitblame report class with this change: 9b5f4fb

@sbuzonas
Copy link
Author

sbuzonas commented Jan 5, 2017

That works

@gsherwood
Copy link
Member

@sbuzonas Thanks a lot for testing that for me.

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

No branches or pull requests

2 participants