overcommit 0.6.2 → 0.6.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d64fbba103905649d8924761929dd8de6ed8dda
|
4
|
+
data.tar.gz: 7e60a0e86700b84e2c0e20f31d9725e3d20e17b5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6287bda409ccdcb0b42760bae088929caec13d9a09ab9dd8355374e889cae1fb33ebc2450bc2a725ec8901f2d0df3185ec7f604694ca2631c43449f4ef371d82
|
7
|
+
data.tar.gz: 4c8de904dcf1b65ef3854e43e8a313baacef309e999d38448f106941284a246fe3cdcc933c7e9e96efe749627771cf9b4b3207a221b413c3006ea78b2ebdef7e
|
data/config/default.yml
CHANGED
@@ -3,17 +3,28 @@ module Overcommit::Hook::CommitMsg
|
|
3
3
|
# under the preferred limits.
|
4
4
|
class TextWidth < Base
|
5
5
|
def run
|
6
|
-
|
7
|
-
|
6
|
+
errors = []
|
7
|
+
|
8
|
+
max_subject_width = @config['max_subject_width']
|
9
|
+
max_body_width = @config['max_body_width']
|
10
|
+
|
11
|
+
if commit_message_lines.first.size > max_subject_width
|
12
|
+
errors << "Please keep the subject <= #{max_subject_width} characters"
|
8
13
|
end
|
9
14
|
|
10
|
-
commit_message_lines.
|
11
|
-
|
12
|
-
|
13
|
-
|
15
|
+
if commit_message_lines.size > 2
|
16
|
+
commit_message_lines[2..-1].each_with_index do |line, index|
|
17
|
+
chomped = line.chomp
|
18
|
+
if chomped.size > max_body_width
|
19
|
+
error = "Line #{index + 3} of commit message has > " <<
|
20
|
+
"#{max_body_width} characters"
|
21
|
+
errors << error
|
22
|
+
end
|
14
23
|
end
|
15
24
|
end
|
16
25
|
|
26
|
+
return :warn, errors.join("\n") if errors.any?
|
27
|
+
|
17
28
|
:good
|
18
29
|
end
|
19
30
|
end
|
@@ -7,7 +7,7 @@ module Overcommit::Hook::PostCheckout
|
|
7
7
|
return :warn, 'bundler not installed -- run `gem install bundler`'
|
8
8
|
end
|
9
9
|
|
10
|
-
return :
|
10
|
+
return :warn if dependencies_changed? && !dependencies_satisfied?
|
11
11
|
|
12
12
|
:good
|
13
13
|
end
|
@@ -11,7 +11,8 @@ module Overcommit::HookContext
|
|
11
11
|
def setup_environment
|
12
12
|
store_modified_times
|
13
13
|
|
14
|
-
if
|
14
|
+
if any_changes?
|
15
|
+
@changes_stashed = true
|
15
16
|
`git stash save --keep-index --quiet #{<<-MSG}`
|
16
17
|
"Overcommit: Stash of repo state before hook run at #{Time.now}"
|
17
18
|
MSG
|
@@ -24,8 +25,11 @@ module Overcommit::HookContext
|
|
24
25
|
# Restore unstaged changes and reset file modification times so it appears
|
25
26
|
# as if nothing ever changed.
|
26
27
|
def cleanup_environment
|
27
|
-
`git reset --hard`
|
28
|
-
|
28
|
+
`git reset --hard` # Ensure working tree is clean before popping stash
|
29
|
+
|
30
|
+
if @changes_stashed
|
31
|
+
`git stash pop --index --quiet`
|
32
|
+
end
|
29
33
|
|
30
34
|
restore_modified_times
|
31
35
|
end
|
@@ -48,6 +52,12 @@ module Overcommit::HookContext
|
|
48
52
|
|
49
53
|
private
|
50
54
|
|
55
|
+
# Returns whether there are any changes between the working tree or index
|
56
|
+
# and HEAD.
|
57
|
+
def any_changes?
|
58
|
+
!`git diff --name-only --ignore-submodules=all HEAD`.strip.empty?
|
59
|
+
end
|
60
|
+
|
51
61
|
DIFF_HUNK_REGEX = /
|
52
62
|
^@@\s
|
53
63
|
[^\s]+\s # Ignore old file range
|
data/lib/overcommit/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: overcommit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Causes Engineering
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-
|
12
|
+
date: 2014-03-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: wopen3
|
@@ -45,14 +45,14 @@ dependencies:
|
|
45
45
|
requirements:
|
46
46
|
- - '='
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 0.
|
48
|
+
version: 0.11.1
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - '='
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 0.
|
55
|
+
version: 0.11.1
|
56
56
|
description: Utility to install, configure, and extend Git hooks
|
57
57
|
email:
|
58
58
|
- eng@causes.com
|