libgit2 / libgit2/rugged

Stale Rugged::Config#each_key values if another process changes .git/config

Open
#785 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2.3k
Forks
293
PR merge metrics
No merged PRs in 30d

Description

This looks like a regression from libgit2 0.28.0, but I'm not sure yet if it's a Rugged issue or a libgit2 one. Here's a sample reproduction:

require 'rugged'

repo = Rugged::Repository.new('.')
start_values = repo.config.each_key.to_a
system('git config --local core.foobar "asdf"')

new_values = repo.config.each_key.to_a
puts "Inserted value: #{repo.config['core.foobar']}"

system('git config --local --unset core.foobar')

puts start_values == new_values

With Rugged 0.27.5, I get:

Inserted value: asdf
false

With Rugged 0.28.0, I get:

Inserted value: asdf
true

What's curious is that the lookup works fine, but the each_key seems to be cached in the 0.28.0 case.

@pks-t @carlosmn I think this has to do with the in-memory config backend in https://github.com/libgit2/libgit2/pull/4767.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Rugged::Config#each_key and run the Ruby reproduction in the issue, comparing results before and after an external git config --local change. Read the in-memory config backend discussed in libgit2 pull request 4767 to determine whether the cache belongs in Rugged or libgit2. Done means the stale-key behavior is reproduced, its ownership is identified, and a regression test or fix is established.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, git, ruby
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.