Permalink
Browse files

massive whitespace removal

  • Loading branch information...
1 parent fa4a01c commit 18ec70e91691084279d810d49b91da1191ea1fc1 @mojombo committed Oct 27, 2009
Showing with 626 additions and 626 deletions.
  1. +5 −5 lib/grit/actor.rb
  2. +12 −12 lib/grit/blob.rb
  3. +2 −2 lib/grit/commit.rb
  4. +26 −26 lib/grit/commit_stats.rb
  5. +9 −9 lib/grit/config.rb
  6. +14 −14 lib/grit/diff.rb
  7. +1 −1 lib/grit/errors.rb
  8. +30 −30 lib/grit/git-ruby.rb
  9. +11 −11 lib/grit/git-ruby/commit_db.rb
  10. +28 −28 lib/grit/git-ruby/file_index.rb
  11. +14 −14 lib/grit/git-ruby/git_object.rb
  12. +4 −4 lib/grit/git-ruby/internal/file_window.rb
  13. +10 −10 lib/grit/git-ruby/internal/loose.rb
  14. +29 −29 lib/grit/git-ruby/internal/pack.rb
  15. +4 −4 lib/grit/git-ruby/internal/raw_object.rb
  16. +9 −9 lib/grit/git-ruby/object.rb
  17. +90 −90 lib/grit/git-ruby/repository.rb
  18. +28 −28 lib/grit/git.rb
  19. +18 −18 lib/grit/index.rb
  20. +1 −1 lib/grit/lazy.rb
  21. +9 −9 lib/grit/merge.rb
  22. +51 −51 lib/grit/repo.rb
  23. +1 −1 lib/grit/ruby1.9.rb
  24. +24 −24 lib/grit/status.rb
  25. +15 −15 lib/grit/submodule.rb
  26. +12 −12 lib/grit/tree.rb
  27. +6 −6 test/test_actor.rb
  28. +4 −4 test/test_blame_tree.rb
  29. +1 −1 test/test_blob.rb
  30. +1 −1 test/test_commit.rb
  31. +2 −2 test/test_commit_stats.rb
  32. +1 −1 test/test_commit_write.rb
  33. +17 −17 test/test_config.rb
  34. +3 −3 test/test_diff.rb
  35. +5 −5 test/test_file_index.rb
  36. +14 −14 test/test_git.rb
  37. +5 −5 test/test_grit.rb
  38. +4 −4 test/test_head.rb
  39. +3 −3 test/test_index_status.rb
  40. +1 −1 test/test_merge.rb
  41. +3 −3 test/test_raw.rb
  42. +4 −4 test/test_real.rb
  43. +2 −2 test/test_reality.rb
  44. +13 −13 test/test_repo.rb
  45. +12 −12 test/test_rubygit.rb
  46. +6 −6 test/test_rubygit_alt.rb
  47. +20 −20 test/test_rubygit_index.rb
  48. +3 −3 test/test_rubygit_iv2.rb
  49. +16 −16 test/test_submodule.rb
  50. +23 −23 test/test_tree.rb
View
@@ -1,15 +1,15 @@
module Grit
-
+
class Actor
attr_reader :name
attr_reader :email
-
+
def initialize(name, email)
@name = name
@email = email
end
alias_method :to_s, :name
-
+
# Create an Actor from a string.
# +str+ is the string, which is expected to be in regular git format
#
@@ -26,11 +26,11 @@ def self.from_string(str)
return self.new(str, nil)
end
end
-
+
# Pretty object inspection
def inspect
%Q{#<Grit::Actor "#{@name} <#{@email}>">}
end
end # Actor
-
+
end # Grit
View
@@ -1,12 +1,12 @@
module Grit
-
+
class Blob
DEFAULT_MIME_TYPE = "text/plain"
-
+
attr_reader :id
attr_reader :mode
attr_reader :name
-
+
# Create an unbaked Blob containing just the specified attributes
# +repo+ is the Repo
# +atts+ is a Hash of instance variable data
@@ -15,7 +15,7 @@ class Blob
def self.create(repo, atts)
self.allocate.create_initialize(repo, atts)
end
-
+
# Initializer for Blob.create
# +repo+ is the Repo
# +atts+ is a Hash of instance variable data
@@ -28,39 +28,39 @@ def create_initialize(repo, atts)
end
self
end
-
+
# The size of this blob in bytes
#
# Returns Integer
def size
@size ||= @repo.git.cat_file({:s => true}, id).chomp.to_i
end
-
+
# The binary contents of this blob.
#
# Returns String
def data
@data ||= @repo.git.cat_file({:p => true}, id)
end
-
+
# The mime type of this file (based on the filename)
#
# Returns String
def mime_type
guesses = MIME::Types.type_for(self.name) rescue []
guesses.first ? guesses.first.simplified : DEFAULT_MIME_TYPE
end
-
+
# The blame information for the given file at the given commit
#
# Returns Array: [Grit::Commit, Array: [<line>]]
def self.blame(repo, commit, file)
data = repo.git.blame({:p => true}, commit, '--', file)
-
+
commits = {}
blames = []
info = nil
-
+
data.split("\n").each do |line|
parts = line.split(/\s+/, 2)
case parts.first
@@ -107,11 +107,11 @@ def self.blame(repo, commit, file)
blames
end
-
+
def basename
File.basename(name)
end
-
+
# Pretty object inspection
def inspect
%Q{#<Grit::Blob "#{@id}">}
View
@@ -178,11 +178,11 @@ def diffs
self.class.diff(@repo, parents.first.id, @id)
end
end
-
+
def stats
stats = @repo.commit_stats(self.sha, 1)[0][-1]
end
-
+
# Convert this Commit to a String which is just the SHA1 id
def to_s
@id
@@ -1,9 +1,9 @@
module Grit
-
+
class CommitStats
-
+
attr_reader :id, :files, :additions, :deletions, :total
-
+
# Instantiate a new CommitStats
# +id+ is the id of the commit
# +files+ is an array of :
@@ -16,11 +16,11 @@ def initialize(repo, id, files)
@repo = repo
@id = id
@files = files
- @additions = files.inject(0) { |total, a| total += a[1] }
- @deletions = files.inject(0) { |total, a| total += a[2] }
- @total = files.inject(0) { |total, a| total += a[3] }
+ @additions = files.inject(0) { |total, a| total += a[1] }
+ @deletions = files.inject(0) { |total, a| total += a[2] }
+ @total = files.inject(0) { |total, a| total += a[3] }
end
-
+
# Find all commit stats matching the given criteria.
# +repo+ is the Repo
# +ref+ is the ref from which to begin (SHA1 or name) or nil for --all
@@ -31,39 +31,39 @@ def initialize(repo, id, files)
# Returns assoc array [sha, Grit::Commit[] (baked)]
def self.find_all(repo, ref, options = {})
allowed_options = [:max_count, :skip, :since]
-
+
default_options = {:numstat => true}
actual_options = default_options.merge(options)
-
+
if ref
output = repo.git.log(actual_options, ref)
else
output = repo.git.log(actual_options.merge(:all => true))
end
-
+
self.list_from_string(repo, output)
end
-
+
# Parse out commit information into an array of baked Commit objects
# +repo+ is the Repo
# +text+ is the text output from the git command (raw format)
#
# Returns assoc array [sha, Grit::Commit[] (baked)]
def self.list_from_string(repo, text)
lines = text.split("\n")
-
+
commits = []
while !lines.empty?
id = lines.shift.split.last
-
+
lines.shift
lines.shift
lines.shift
-
+
message_lines = []
message_lines << lines.shift[4..-1] while lines.first =~ /^ {4}/ || lines.first == ''
-
+
lines.shift while lines.first && lines.first.empty?
files = []
@@ -74,29 +74,29 @@ def self.list_from_string(repo, text)
total = additions + deletions
files << [filename, additions, deletions, total]
end
-
+
lines.shift while lines.first && lines.first.empty?
-
+
commits << [id, CommitStats.new(repo, id, files)]
end
-
+
commits
end
-
+
# Pretty object inspection
def inspect
%Q{#<Grit::CommitStats "#{@id}">}
end
-
+
# Convert to an easy-to-traverse structure
def to_diffstat
files.map do |metadata|
DiffStat.new(*metadata)
end
end
-
+
# private
-
+
def to_hash
{
'id' => id,
@@ -106,16 +106,16 @@ def to_hash
'total' => total
}
end
-
+
end # CommitStats
-
+
class DiffStat
attr_reader :filename, :additions, :deletions
def initialize(filename, additions, deletions, total=nil)
@filename, @additions, @deletions = filename, additions, deletions
end
-
+
def net
additions - deletions
end
@@ -124,5 +124,5 @@ def inspect
"#{filename}: +#{additions} -#{deletions}"
end
end
-
+
end # Grit
View
@@ -1,32 +1,32 @@
module Grit
-
+
class Config
def initialize(repo)
@repo = repo
end
-
+
def []=(key, value)
@repo.git.config({}, key, value)
@data = nil
end
-
+
def [](key)
data[key]
end
-
+
def fetch(key, default = nil)
data[key] || default || raise(IndexError.new("key not found"))
end
-
+
def keys
data.keys
end
-
+
protected
def data
@data ||= load_config
end
-
+
def load_config
hash = {}
config_lines.map do |line|
@@ -35,10 +35,10 @@ def load_config
end
hash
end
-
+
def config_lines
@repo.git.config(:list => true).split(/\n/)
end
end # Config
-
+
end # Grit
Oops, something went wrong. Retry.

0 comments on commit 18ec70e

Please sign in to comment.