commit 0.7.0 → 0.7.1
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 +4 -4
- data/CHANGELOG.md +6 -0
- data/exe/commit +5 -0
- data/lib/commit/git_commit.rb +8 -7
- data/lib/commit/helper.rb +17 -6
- data/lib/commit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b6138776dedeea471b341c2527dcaedeeee7c19439a86caf860b5149c04e5906
|
|
4
|
+
data.tar.gz: 3dae4a041ea54fe55a0ca7b28b66f143933452cf8784cd9bbf9bf623d1ff9798
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2a89c5efac58799f9cedd29610cdad9b3d66d193e96174e495dea13efa1422cdd5fb1ac39cd634172250ecc7861eba88db1f4e620f0db63dd3c3050acf11e2c6
|
|
7
|
+
data.tar.gz: 8dcac30b3732564994a60553059fe75fbcfaec2e0d4fb9cad288fff9b1cc59832b7b86eaecb266d3633e8933c4fc3da5e950f5e1427f968d41c2c6944895ed5a
|
data/CHANGELOG.md
CHANGED
data/exe/commit
CHANGED
data/lib/commit/git_commit.rb
CHANGED
|
@@ -36,11 +36,12 @@ class GitCommit
|
|
|
36
36
|
msg = @options[:commit_message] if @options[:commit_message]
|
|
37
37
|
discover_branch
|
|
38
38
|
|
|
39
|
-
puts "Committing with message '#{msg}'".green unless @options[:verbosity]
|
|
40
|
-
run
|
|
39
|
+
puts "Committing with message '#{msg}'".green unless @options[:verbosity] == QUIET
|
|
40
|
+
run "git commit -m '#{msg}' 2>&1 | sed -e '/^X11/d' -e '/^Warning:/d'", verbose: @options[:verbosity] >= VERBOSE
|
|
41
41
|
# @repo.push 'origin', ['refs/heads/master'] # Needs a callback to handle authentication
|
|
42
|
-
puts "Pushing to origin #{@branch}".green unless @options[:verbosity]
|
|
43
|
-
run
|
|
42
|
+
puts "Pushing to origin #{@branch}".green unless @options[:verbosity] == QUIET
|
|
43
|
+
run "git push origin #{@branch} --tags 3>&1 1>&2 2>&3 | sed -e '/^X11/d' -e '/^Warning:/d'",
|
|
44
|
+
verbose: @options[:verbosity] >= VERBOSE
|
|
44
45
|
@change_count = 0
|
|
45
46
|
@commit_size = 0
|
|
46
47
|
end
|
|
@@ -62,7 +63,7 @@ class GitCommit
|
|
|
62
63
|
def large_files
|
|
63
64
|
large = []
|
|
64
65
|
@repo.status do |path, flags|
|
|
65
|
-
puts "#{path} #{flags}" if @options[:verbosity]
|
|
66
|
+
puts "#{path} #{flags}" if @options[:verbosity] >= NORMAL
|
|
66
67
|
if File(path).dir?
|
|
67
68
|
scan_dir path
|
|
68
69
|
elsif large_file?(filename)
|
|
@@ -91,8 +92,8 @@ class GitCommit
|
|
|
91
92
|
tag = @options[:tag]
|
|
92
93
|
return unless tag
|
|
93
94
|
|
|
94
|
-
run
|
|
95
|
-
run
|
|
95
|
+
run "git tag -a #{tag} -m 'v#{tag}'", verbose: @options[:verbosity] >= VERBOSE
|
|
96
|
+
run 'git push origin --tags', verbose: @options[:verbosity] >= VERBOSE
|
|
96
97
|
exit
|
|
97
98
|
end
|
|
98
99
|
|
data/lib/commit/helper.rb
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
class GitCommit
|
|
2
|
+
QUIET = 0
|
|
3
|
+
NORMAL = 1
|
|
4
|
+
VERBOSE = 2
|
|
5
|
+
ANNOYING = 3
|
|
6
|
+
STFU = 4
|
|
7
|
+
|
|
8
|
+
|
|
2
9
|
# Needs absolute path or the path relative to the current directory, not just the name of the directory
|
|
3
10
|
def add_recursively(name)
|
|
4
11
|
Dir.entries(name).each do |entry|
|
|
@@ -28,7 +35,7 @@ class GitCommit
|
|
|
28
35
|
however the file is #{@nh.to_human file_size}.
|
|
29
36
|
The file will be added to .gitignore.
|
|
30
37
|
MESSAGE
|
|
31
|
-
puts msg.yellow unless @options[:verbosity]
|
|
38
|
+
puts msg.yellow unless @options[:verbosity] == QUIET
|
|
32
39
|
|
|
33
40
|
newline = needs_newline('.gitignore') ? "\n" : ''
|
|
34
41
|
File.write('.gitignore', "#{newline}#{filename}\n", mode: 'a')
|
|
@@ -36,9 +43,12 @@ class GitCommit
|
|
|
36
43
|
elsif filename == '.gitignore'
|
|
37
44
|
@gitignore_dirty = true
|
|
38
45
|
else
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
46
|
+
if @commit_size + file_size >= MAX_SIZE / 2.0
|
|
47
|
+
# Defeat formatter
|
|
48
|
+
commit_push 'A portion of the files to be committed is being pushed now because they are large.'
|
|
49
|
+
end
|
|
50
|
+
puts "Adding '#{escape filename}'".green unless @options[:verbosity] == QUIET
|
|
51
|
+
run ['git', 'add', escape(filename)], verbose: @options[:verbosity] >= VERBOSE
|
|
42
52
|
end
|
|
43
53
|
@change_count += 1
|
|
44
54
|
@commit_size += file_size
|
|
@@ -66,6 +76,7 @@ class GitCommit
|
|
|
66
76
|
# - +:worktree_deleted+: the file has been deleted from the working directory
|
|
67
77
|
def recursive_add
|
|
68
78
|
@change_count = 0
|
|
79
|
+
run ['git', 'add', '--all'], verbose: @options[:verbosity] >= VERBOSE
|
|
69
80
|
@repo.status do |path, flags|
|
|
70
81
|
next if flags.include? :ignored
|
|
71
82
|
|
|
@@ -76,13 +87,13 @@ class GitCommit
|
|
|
76
87
|
end
|
|
77
88
|
end
|
|
78
89
|
if @gitignore_dirty
|
|
79
|
-
puts 'Changing .gitignore'.green unless @options[:verbosity]
|
|
90
|
+
puts 'Changing .gitignore'.green unless @options[:verbosity] == QUIET
|
|
80
91
|
run 'git add .gitignore', verbose: @options[:verbosity] >= 2
|
|
81
92
|
@change_count += 1
|
|
82
93
|
end
|
|
83
94
|
return unless @change_count.zero?
|
|
84
95
|
|
|
85
|
-
puts 'No changes were detected to this git repository.'.green if @options[:verbosity]
|
|
96
|
+
puts 'No changes were detected to this git repository.'.green if @options[:verbosity] >= VERBOSE
|
|
86
97
|
exit
|
|
87
98
|
end
|
|
88
99
|
|
data/lib/commit/version.rb
CHANGED