Giter VIP home page Giter VIP logo

git-hooks's People

Contributors

omegadroid avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

git-hooks's Issues

Running git hooks does not work for fresh git repos

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

Add arbitrary commands to the config

I would be useful to be able to run arbitrary commands on your repo that may not be general enough to make a public hook out of (such as ruining tests).

The working directory for the command should be the root of the repo.

Something like:

[run]
pre-commit = command: ./scripts/runtests.sh
    command: ./script/otherscript.sh

Modifying and moving files gives an error

If files are modified and moved the old name is included in the list of modified files. This should not be the case as hook writers shouldn't have to check is a file exists before processing it.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.