Thanks to visit codestin.com
Credit goes to github.com

Skip to content

remote: Handle missing config values when deleting a remote #3862

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

novalis
Copy link
Contributor

@novalis novalis commented Jul 15, 2016

Somehow I ended up with the following in my ~/.gitconfig:
[branch "master"]
remote = origin
merge = master
rebase = true

I assume something went crazy while I was running the git.git tests
some time ago, and that I never noticed until now.

This is not a good configuration, but it shouldn't cause problems. But
it does. Specifically, if you have this in your config, and you
perform the following set of actions:

create a remote
fetch from that remote
create a branch off of the remote master branch called "master"
delete the branch
delete the remote

The remote delete fails with the message "Could not find key
'branch.master.rebase' to delete". This is because it's iterating over
the config entries (including the ones in the global config) and
believes that there is a master branch which must therefore have these
config keys.

#3856

break;
if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
if (error != GIT_ENOTFOUND)
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could I trouble you to do a giterr_clear() here to remove the error message that git_config_delete_entry added? We would like to avoid leaving that error message hanging around when there isn't actually an error.

@ethomson
Copy link
Member

👍 Thanks. :D

Somehow I ended up with the following in my ~/.gitconfig:
[branch "master"]
remote = origin
merge = master
rebase = true

I assume something went crazy while I was running the git.git tests
some time ago, and that I never noticed until now.

This is not a good configuration, but it shouldn't cause problems. But
it does. Specifically, if you have this in your config, and you
perform the following set of actions:

create a remote
fetch from that remote
create a branch off of the remote master branch called "master"
delete the branch
delete the remote

The remote delete fails with the message "Could not find key
'branch.master.rebase' to delete". This is because it's iterating over
the config entries (including the ones in the global config) and
believes that there is a master branch which must therefore have these
config keys.

libgit2#3856
@novalis novalis force-pushed the dturner/do-not-die-on-missing-config branch from ad971b5 to d81cb2e Compare July 15, 2016 17:47
@novalis
Copy link
Contributor Author

novalis commented Jul 18, 2016

(done)

@ethomson ethomson merged commit 76cfdd4 into libgit2:master Jul 24, 2016
@ethomson
Copy link
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants