lib/space/model/repo/git.rb in space-0.0.8 vs lib/space/model/repo/git.rb in space-0.0.9
- old
+ new
@@ -15,35 +15,35 @@
def initialize(repo)
@repo = repo
super(repo.path)
end
+ def branch
+ result(:branch) =~ /^\* (.+)/ && $1.strip
+ end
+
+ def commit
+ result(:commit) =~ /^commit (\S{7})/ && $1
+ end
+
def status
dirty? ? :dirty : (ahead? ? :ahead : :clean)
end
def dirty?
!clean?
end
+ def clean?
+ result(:status) =~ /working directory clean/m
+ end
+
def ahead?
ahead > 0
end
- def clean?
- result(:status) =~ /nothing to commit (working directory clean)/
- end
-
def ahead
result(:status) =~ /Your branch is ahead of .* by (\d+) commits?\./ ? $1.to_i : 0
- end
-
- def branch
- result(:branch) =~ /^\* (.+)/ && $1.strip
- end
-
- def commit
- result(:commit) =~ /^commit (\S{7})/ && $1
end
end
end
end
end