Module: Command::FastForward

Included in:
Branch, Fetch, Push, ReceivePack
Defined in:
lib/command/shared/fast_forward.rb

Instance Method Summary collapse

Instance Method Details

#fast_forward?(old_oid, new_oid) ⇒ Boolean

Returns:

  • (Boolean)


12
13
14
15
16
# File 'lib/command/shared/fast_forward.rb', line 12

def fast_forward?(old_oid, new_oid)
  common = ::Merge::CommonAncestors.new(repo.database, old_oid, [new_oid])
  common.find
  common.marked?(old_oid, :parent2)
end

#fast_forward_error(old_oid, new_oid) ⇒ Object



6
7
8
9
10
# File 'lib/command/shared/fast_forward.rb', line 6

def fast_forward_error(old_oid, new_oid)
  return nil unless old_oid and new_oid
  return "fetch first" unless repo.database.has?(old_oid)
  return "non-fast-forward" unless fast_forward?(old_oid, new_oid)
end