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

Running git hooks does not work for fresh git repos #4

Open
OmegaDroid opened this issue Aug 24, 2016 · 1 comment
Open

Running git hooks does not work for fresh git repos #4

OmegaDroid opened this issue Aug 24, 2016 · 1 comment
Labels

Comments

@OmegaDroid
Copy link
Collaborator

Looks like we are getting the error because refs/heads/master doesn't already exist

Traceback (most recent call last):
  File ".git/hooks/pre-commit", line 7, in <module>
    sys.exit(runners.PreCommitHookRunner().run())
  File "/home/dan/.virtualenvs/git-hooks/lib/python3.4/site-packages/githooks/runners.py", line 63, in run
    args = list(self.get_process_args())
  File "/home/dan/.virtualenvs/git-hooks/lib/python3.4/site-packages/githooks/runners.py", line 85, in get_process_args
    args += tuple(repo.added_files() + repo.modified_files())
  File "/home/dan/.virtualenvs/git-hooks/lib/python3.4/site-packages/githooks/repo.py", line 56, in added_files
    return [os.path.join(repo_root_dir, d.a_path) for d in get().head.commit.diff() if d.new_file]
  File "/home/dan/.virtualenvs/git-hooks/lib/python3.4/site-packages/git/refs/symbolic.py", line 183, in _get_commit
    obj = self._get_object()
  File "/home/dan/.virtualenvs/git-hooks/lib/python3.4/site-packages/git/refs/symbolic.py", line 176, in _get_object
    return Object.new_from_sha(self.repo, hex_to_bin(self.dereference_recursive(self.repo, self.path)))
  File "/home/dan/.virtualenvs/git-hooks/lib/python3.4/site-packages/git/refs/symbolic.py", line 125, in dereference_recursive
    hexsha, ref_path = cls._get_ref_info(repo, ref_path)
  File "/home/dan/.virtualenvs/git-hooks/lib/python3.4/site-packages/git/refs/symbolic.py", line 157, in _get_ref_info
    raise ValueError("Reference at %r does not exist" % ref_path)
ValueError: Reference at 'refs/heads/master' does not exist
@OmegaDroid OmegaDroid added the bug label Aug 24, 2016
@OmegaDroid
Copy link
Collaborator Author

I've added an error for now stating you need to do an initial commit before you can initialise git hooks

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

No branches or pull requests

1 participant