Changes rolled back immediately after commit
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2.3k
- Forks
- 293
- PR merge metrics
- No merged PRs in 30d
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 '. . . . . . . . . . . . <'
end
Repository 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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by running the supplied create_commit reproduction against the test repository and inspect Rugged::Commit.create, repo.index, and the HEAD update path. Compare the commit's tree and HEAD before and after reopening the repository; done means the written index.md content remains present after the method returns.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, ruby
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100