Class: Git::Branch

Inherits:
Object
  • Object
show all
Defined in:
lib/git/status_all/git.rb

Instance Method Summary collapse

Instance Method Details

#aheadObject



26
27
28
29
30
# File 'lib/git/status_all/git.rb', line 26

def ahead
	origin = self.remotes(:origin)
	return [] if origin.nil?
	@base.log.between(origin.full, self.name)
end

#ahead_countObject



38
39
40
# File 'lib/git/status_all/git.rb', line 38

def ahead_count
	@ahead_count ||= ahead.count
end

#behindObject



32
33
34
35
36
# File 'lib/git/status_all/git.rb', line 32

def behind
	origin = self.remotes(:origin)
	return [] if origin.nil?
	@base.log.between(self.name, origin.full)
end

#behind_countObject



42
43
44
# File 'lib/git/status_all/git.rb', line 42

def behind_count
	@behind_count ||= behind.count
end

#current?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/git/status_all/git.rb', line 18

def current?
	current	
end

#remotes(remote_name = nil) ⇒ Object



46
47
48
49
50
# File 'lib/git/status_all/git.rb', line 46

def remotes(remote_name = nil)
	result = @base.branches.remote.select{|b| b.name == self.name }
	return result.select{|b| b.full.include? remote_name.to_s }.first unless remote_name.nil?
	return result 
end

#up_to_date?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/git/status_all/git.rb', line 22

def up_to_date?
	ahead_count == 0 && behind_count == 0
end