summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/git/base.rb2
-rw-r--r--lib/git/lib.rb8
2 files changed, 5 insertions, 5 deletions
diff --git a/lib/git/base.rb b/lib/git/base.rb
index c5fac45..2201eb5 100644
--- a/lib/git/base.rb
+++ b/lib/git/base.rb
@@ -130,7 +130,7 @@ module Git
def repo_size
size = 0
Dir.chdir(repo.path) do
- (size, dot) = `du -d0`.chomp.split
+ (size, dot) = `du -s`.chomp.split
end
size.to_i
end
diff --git a/lib/git/lib.rb b/lib/git/lib.rb
index 411b491..4c4147d 100644
--- a/lib/git/lib.rb
+++ b/lib/git/lib.rb
@@ -81,7 +81,7 @@ module Git
sha = revparse(opts[:object] || branch_current || 'master')
count = opts[:count] || 30
- if /\w{40}/.match(sha) # valid sha
+ if /\w{40}$/.match(sha) # valid sha
repo = get_raw_repo
return process_commit_data(repo.log(sha, count))
end
@@ -542,9 +542,9 @@ module Git
def commit_tree(tree, opts = {})
opts[:message] = "commit tree #{tree}" if !opts[:message]
- t = Tempfile.new('commit-message') do |t|
- t.write(opts[:message])
- end
+ t = Tempfile.new('commit-message')
+ t.write(opts[:message])
+ t.close
arr_opts = []
arr_opts << tree