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

Improve is_git_repo() function mechanism of checking git repo to support newest git behavior #35

Open
TemaSM opened this issue Apr 26, 2022 · 0 comments

Comments

@TemaSM
Copy link

TemaSM commented Apr 26, 2022

Description:
If you run git redate inside directory owned by another user, git will exit with error and printing message like this:

fatal: unsafe repository ('/path/to/project/folder' is owned by someone else)
To add an exception for this directory, call:

        git config --global --add safe.directory /path/to/project/folder

- that's new behavior of git, more info:
https://github.blog/2022-04-12-git-security-vulnerability-announced/
https://stackoverflow.com/questions/71849415/i-cannot-add-the-parent-directory-to-safe-directory-in-git

Proposal:
Improve is_git_repo function to handle this type of error

git-redate/git-redate

Lines 3 to 10 in 843b964

is_git_repo() {
git rev-parse --show-toplevel > /dev/null 2>&1
result=$?
if test $result != 0; then
>&2 echo 'Not a git repo!'
exit $result
fi
}

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

No branches or pull requests

1 participant