remote: Handle missing config values when deleting a remote by novalis · Pull Request #3862 · libgit2/libgit2 · GitHub
Skip to content

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

Merged
ethomson merged 1 commit into
libgit2:masterfrom
novalis:dturner/do-not-die-on-missing-config
Jul 24, 2016
Merged

remote: Handle missing config values when deleting a remote#3862
ethomson merged 1 commit into
libgit2:masterfrom
novalis:dturner/do-not-die-on-missing-config

Conversation

@novalis

@novalis novalis commented Jul 15, 2016

Copy link
Copy Markdown
Contributor

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

Comment thread src/remote.c

Copy link
Copy Markdown
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
Copy Markdown
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

novalis commented Jul 18, 2016

Copy link
Copy Markdown
Contributor Author

(done)

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

Copy link
Copy Markdown
Member

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