Config doesn't handle getting and storing all types of attributes
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 = [email protected]: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?
Hello @tenderlove I was looking through the list of committers on this project and saw your name. Can you take a look at this or suggest someone else to start the discussion?
Thanks! Hope all is well and happy holidays!
Hey @bdunne! Good to hear from you. I've been looking in to this, but I don't see a way from the gem to get multiple configuration values out, so I added get_all in #737. I'll see if I can figure out something for a multi-value set.
Thanks for looking into it @tenderlove