spec/support/repo.rb
def new_commit_move_file(repo)
  blob_oid = repo.head.target.tree.detect { |i| i[:name] == "CHANGELOG" }[:oid]
  file_content = repo.lookup(blob_oid).content
  oid = repo.write(file_content, :blob)
  index = repo.index
  index.read_tree(repo.head.target.tree)
  index.add(path: "encoding/CHANGELOG", oid: oid, mode: 0100644)
  index.remove("CHANGELOG")

  options = commit_options(repo, index, "Move CHANGELOG to encoding/")

  sha = Rugged::Commit.create(repo, options)
  repo.lookup(sha)
end
# Writes a new commit to the repo and returns a Rugged::Commit.  Moves the
# CHANGELOG file to the encoding/ directory.
Writes a new commit to the repo and returns a Rugged::Commit.  Moves the
CHANGELOG file to the encoding/ directory.
Writes a new commit to the repo and returns a Rugged :: Commit . Moves the CHANGELOG file to the encoding / directory .
def new_commit_move_file(repo)
  blob_oid = repo.head.target.tree.detect { |i| i[:name] == "CHANGELOG" }[:oid]
  file_content = repo.lookup(blob_oid).content
  oid = repo.write(file_content, :blob)
  index = repo.index
  index.read_tree(repo.head.target.tree)
  index.add(path: "encoding/CHANGELOG", oid: oid, mode: 0100644)
  index.remove("CHANGELOG")
  options = commit_options(repo, index, "Move CHANGELOG to encoding/")
  sha = Rugged::Commit.create(repo, options)
  repo.lookup(sha)
end
def new_commit_move_file ( repo ) blob_oid = repo . head . target . tree . detect { | i | i [ :name ] == "CHANGELOG" } [ :oid ] file_content = repo . lookup ( blob_oid ) . content oid = repo . write ( file_content , :blob ) index = repo . index index . read_tree ( repo . head . target . tree ) index . add ( path : "encoding/CHANGELOG" , oid : oid , mode : 0100644 ) index . remove ( "CHANGELOG" ) options = commit_options ( repo , index , "Move CHANGELOG to encoding/" ) sha = Rugged :: Commit . create ( repo , options ) repo . lookup ( sha ) end
Writes a new commit to the repo and returns a Rugged::Commit.
Writes a new commit to the repo and returns a Rugged :: Commit .
repo