-
Notifications
You must be signed in to change notification settings - Fork 286
Open
Description
Hello. Thank you for this library.
I can not find solution via google for next problem:
After Rugged::Commit.create changes rolled back immediately.
I have create test method and test repository
Try write changes to existing file 'index.md'
def create_commit
repo = Rugged::Repository.new('TB 2')
puts 'Init repository'
puts '. . . . . . . . . . . .'
changes = "- - - - - - \n test blob"
oid = repo.write(changes, :blob)
index = repo.index
index.read_tree(repo.head.target.tree)
index.add(:path => 'index.md', :oid => oid, :mode => 0100644)
author = {:email => 'current_user.email', :time=>Time.now, :name => 'current_user.email'}
options = {}
options[:tree] = index.write_tree(repo)
options[:author] = author
options[:committer] = author
options[:message] ||= "Edit page test"
options[:parents] = repo.empty? ? [] : [ repo.head.target ].compact
options[:update_ref] = 'HEAD'
commit_result = Rugged::Commit.create(repo, options)
puts commit_result.inspect
puts '. . . . . . . . . . . . <'
endRepository before changes:
Execute method:
$ irb
> load './rugged_test.rb'
=> true
> create_commit
. . . . . . . . . . . .
"0e7891687e9aa0a3868c29046dbd033767ae2aca"
. . . . . . . . . . . . <
=> nil
Repository after changes:
Rugged version:
...
Installing rugged 0.21.4
...I am not good know git itself, but use instructions from Rugged Readme page. Looks like i have missing some additional step in setup or commit, but i can not figure out which of.
Metadata
Metadata
Assignees
Labels
No labels