class CreateGithubRelease::Assertions::LocalAndRemoteOnSameCommit


@api public
Checks both the local repository and the remote repository.
Assert that the local working directory and the remote are on the same commit

def assert

Raises:
  • (SystemExit) - if the assertion fails

Returns:
  • (void) -
def assert
  print 'Checking that local and remote are on the same commit...'
  local_commit = `git rev-parse HEAD`.chomp
  remote_commit = `git ls-remote '#{project.remote}' '#{project.default_branch}' | cut -f 1`.chomp
  if local_commit == remote_commit
    puts 'OK'
  else
    error 'Local and remote are not on the same commit'
  end
end