Config doesn't handle getting and storing all types of attributes
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2.3k
- Forks
- 293
- PR merge metrics
- No merged PRs in 30d
Description
Hello, I'm working on transitioning my project over to using rugged. I'm amazed at the performance improvements that we've seen so far. I'm getting down to the last few operations that need to be converted and I'm stuck on this one:
I want to add a second fetch for a remote.
My desired config looks like this:
[core]
repositoryformatversion = 0
filemode = true
bare = false
logallrefupdates = true
[remote "origin"]
url = git@github.com:ManageIQ/manageiq.git
fetch = +refs/heads/*:refs/remotes/origin/*
fetch = +refs/pull/*:refs/prs/*
[branch "master"]
remote = origin
merge = refs/heads/master
In order to achieve this, I need to first read the config looking for the fetches, but I get the following which doesn't show the first fetch:
Rugged::Repository.new(my_path).config.get("remote.origin.fetch")
=> "+refs/pull/*:refs/prs/*"
I can work around this with:
Rugged::Repository.new(my_path).remotes.first.fetch_refspecs
=> ["+refs/heads/*:refs/remotes/origin/*", "+refs/pull/*:refs/prs/*"]
I can achieve this on the command line with
$ git config --get-all "remote.origin.fetch"
+refs/heads/*:refs/remotes/origin/*
+refs/pull/*:refs/prs/*
Then I want to add the second ref and store it if it doesn't already exist, but store and []= blow up with:
Rugged::Repository.new(my_path).config.store("remote.origin.fetch", "+refs/pull/*:refs/prs/*")
Rugged::ConfigError: multivar incompatible with simple set
I can achieve this on the command line with:
git config --add remote.origin.fetch +refs/pull/*:refs/prs/*
Is there another way to store this in the config?
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 with the Rugged::Config#get, store, and []= behavior described in the issue, then compare it with Repository#remotes.first.fetch_refspecs and the equivalent git config --get-all and --add commands. Confirm that repeated remote.origin.fetch values are preserved when read and can be appended without triggering the multivar error; add coverage for both operations if the repository's existing tests identify a suitable location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, git, ruby
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100