-
Notifications
You must be signed in to change notification settings - Fork 286
Open
Description
This is probably related to (#663 /cc @cfillion).
Scenario:
Given a repository:
* commit C (HEAD)
|
* commit B
|
* commit A
When we do:
walker.push sha_of_a
walker.hide sha_of_cWalker returns 1 commit (commit A) instead of 0 commits. This happens only when using Rugged::SORT_DATE.
Script to reproduce
gem 'rugged', "= #{ENV['RUGGED_VERSION']}"
require 'rugged'
require 'tmpdir'
Class.new do
def initialize
path = Dir.mktmpdir 'test-repository'
@repo = Rugged::Repository.init_at path
@repo.config['user.name'] = 'John Doe'
@repo.config['user.email'] = 'john@doe.com'
@hash_a = create_commit
sleep 1
@hash_b = create_commit
sleep 1
@hash_c = create_commit
puts Rugged::VERSION
compare
end
def create_commit
Rugged::Commit.create @repo,
message: 'Hello World',
parents: @repo.empty? ? [] : [@repo.head.target].compact,
tree: @repo.index.write_tree(@repo),
update_ref: 'HEAD'
end
def compare
walker = Rugged::Walker.new @repo
walker.sorting(Rugged::SORT_DATE)
walker.push @hash_a
walker.hide @hash_c
commits = walker.to_a
walker.reset
puts commits.size
end
end.new> RUGGED_VERSION=0.25.0b9 ruby rugged.rb
0.25.0b9
0
> RUGGED_VERSION=0.25.0b10 ruby rugged.rb
0.25.0b10
1
Metadata
Metadata
Assignees
Labels
No labels