Skip to content

Commit 69e87d3

Browse files
sdsShane da Silva
authored and
Shane da Silva
committedFeb 20, 2014
Refactor Overcommit framework
Initial refactor commit. Specs are currently broken, but I'm marking this off as a chunk of work for now, and will start working more atomically from now on. Change-Id: I8a120cb660046e3d7b23e302b0054de932df2bec Reviewed-on: http://gerrit.causes.com/35559 Reviewed-by: Shane da Silva <shane@causes.com> Tested-by: Shane da Silva <shane@causes.com>
1 parent 9dbeb63 commit 69e87d3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+1013
-608
lines changed
 

‎TODO

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Handle case where hooks are installed but overcommit isn't
2+
Add user-friendly installation instructions (e.g. run `overcommit` in git
3+
repo and get asked to install if it is not installed)
4+
Symlink all scripts to single Overcommit file
5+
Ask to remove sample files
6+
Parallelize hook checks
7+
Stash non-indexed changes before running checks so real filename can be used
8+
(`git stash save --keep-index --include-untracked`)
9+
Allow hooks to depend on other hooks being run first? (`depends` option)
10+
Auto install hooks on updating overcommit during next hook run
11+
Auto update hook integration script when newer overcommit runs
12+
Allow GIT_TEMPLATE_DIR to be set with `export GIT_TEMPLATE_DIR=`overcommit --template-dir`
13+
Allow hooks to specify required executable (`executable` option, coupled with
14+
install instructions of some sort)
15+
Allow hooks to specify whether they only apply to lines the user modified
16+
Split out Whitespace check into individual checks
17+
Allow SKIP arguments to be case insensitive
18+
19+
20+
Allow features of hooks to be customized (stealth, required, etc.)
21+
22+
`overcommit pre-commit`
23+
`overcommit commit-msg <file-with-message>`
24+
`overcommit post-checkout <prev-HEAD> <new-HEAD> <file-checkout[0/1]>`
25+
26+
Core philosophies:
27+
- Git Hooks are a first-class artifact that don't vary from system to system
28+
(should be stored in source control)
29+
- Copying hooks between multiple repositories is annoying
30+
- Using `git config` as a method of storing hook configuration doesn't persist
31+
- Repository is the fundamental unit of configuration (no global configuration
32+
for multiple repositories stored elsewhere)
33+
- Overcommit is the homebrew of git hooks
34+
35+
36+
37+
WHAT's FIXED:
38+
- Renaming of core concepts
39+
- Control flow fixed to not `exit` in random places
40+
- No longer need temp files for staged files and the various hacks related to it
41+
(e.g. rubocop/scss-lint config loading)
42+
- Easier for developers to test new hooks (just run `bundle exec git commit`,
43+
etc.)
44+
- Removed the HookRegistry
45+
- Allow fine grained control over which checks apply to which files
46+
47+
48+
NICE TO HAVES:
49+
- report status sizes to width of terminal

‎bin/overcommit

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
#!/usr/bin/env ruby
22

3-
$: << File.expand_path('../../lib', __FILE__)
4-
53
require 'overcommit'
64
require 'overcommit/cli'
75

8-
Overcommit::CLI.new(ARGV).tap do |cli|
6+
logger = Overcommit::Logger.new(STDOUT)
7+
8+
Overcommit::CLI.new(ARGV, logger).tap do |cli|
99
cli.parse_arguments
1010
cli.run
1111
end

0 commit comments

Comments
 (0)
Please sign in to comment.