Commit graph

11 commits

Author SHA1 Message Date
Jean-Luc Herren c60b528225 Make default pre-commit hook less noisy
This hook thought to have found a conflict marker any time it saw
a 7-character combination of any of the characters '<>=' at the
beginning of a line, whereas it should only look for the *same*
character to appear repeatedly.

Also, restrict it to match exactly 7 times, to avoid matching the
underlining with '='-characters often used in documentation.

Signed-off-by: Jean-Luc Herren <jlh@gmx.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-01-14 13:52:27 -08:00
Junio C Hamano f81117b84d Merge branch 'maint'
* maint:
  Fix sample pre-commit hook
2007-11-22 23:25:42 -08:00
Junio C Hamano 7a3db75bee Fix sample pre-commit hook
If the worktree happened to have a file called HEAD, "diff-index --cached HEAD"
would complain about the ambiguity between revision and path.  Avoid it by
using an explicit "--" for disambiguation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-11-22 23:25:19 -08:00
Jim Meyering 4a21d13db4 hooks-pre-commit: use \t, rather than a literal TAB in regexp
Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-10-26 23:16:51 -07:00
Junio C Hamano a6080a0a44 War on whitespace
This uses "git-apply --whitespace=strip" to fix whitespace errors that have
crept in to our source files over time.  There are a few files that need
to have trailing whitespaces (most notably, test vectors).  The results
still passes the test, and build result in Documentation/ area is unchanged.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2007-06-07 00:04:01 -07:00
Junio C Hamano 61c2bcbd11 pre-commit hook: complain about conflict markers.
Several <<< or === or >>> characters at the beginning of a line
is very likely to be leftover conflict markers from a failed
automerge the user resolved incorrectly, so detect them.

As usual, this can be defeated with "git commit --no-verify" if
you really do want to have those files, just like changes that
introduce trailing whitespaces.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-04-19 15:37:40 -07:00
Junio C Hamano d37fd03222 [PATCH] pre-commit sample hook: do not barf on the initial import
The example hook barfs on the initial import.  Ideally it should
produce a diff from an empty tree, but for now let's stop at
squelching the bogus error message.  Often an initial import
involves tons of badly formatted files from foreign SCM, so not
complaining about them like this patch does might actually be a
better idea than enforcing the "Perfect Patch" format on them.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2006-01-29 14:52:16 -08:00
Junio C Hamano 215a7ad1ef Big tool rename.
As promised, this is the "big tool rename" patch.  The primary differences
since 0.99.6 are:

  (1) git-*-script are no more.  The commands installed do not
      have any such suffix so users do not have to remember if
      something is implemented as a shell script or not.

  (2) Many command names with 'cache' in them are renamed with
      'index' if that is what they mean.

There are backward compatibility symblic links so that you and
Porcelains can keep using the old names, but the backward
compatibility support  is expected to be removed in the near
future.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-09-07 17:45:20 -07:00
Marco Costalba b909a15ede [PATCH] Fix git-commit-script to output on stderr when -v fails
When git-commit-script is called with -v option and
verify test fails result is print on stdout
instead of stderr.

[jc: The original patch from Marco updated git-commit-script that
still had the piece of code in question, which has been moved to
an example hook script on its own, so I transplanted the patch to
that new file instead.]

Signed-off-by: Marco Costalba <mcostalba@yahoo.it>
Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-20 10:54:27 -07:00
Junio C Hamano b779dd5ee3 Make sample pre-commit hook output Emacs friendly.
Use the common error message format, "filename:lineno: body";
this way, problematic lines can be jumped to from the Emacs
compilation buffer by C-x `.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-20 01:05:12 -07:00
Junio C Hamano 89e2c5f17b Add commit hook and make the verification customizable.
There are three hooks:

    - 'pre-commit' is given an opportunity to inspect what is
      being committed, before we invoke the EDITOR for the
      commit message;

    - 'commit-msg' is invoked on the commit log message after
      the user prepares it;

    - 'post-commit' is run after a successful commit is made.

The first two can interfere to stop the commit.  The last one is
for after-the-fact notification.

The earlier built-in commit checker is now moved to pre-commit.

Signed-off-by: Junio C Hamano <junkio@cox.net>
2005-08-19 16:23:31 -07:00