Commit 76cfdd46 by Edward Thomson Committed by GitHub

Merge pull request #3862 from novalis/dturner/do-not-die-on-missing-config

remote: Handle missing config values when deleting a remote
parents 378d12ac d81cb2e4
...@@ -10,6 +10,9 @@ v0.24 + 1 ...@@ -10,6 +10,9 @@ v0.24 + 1
directory matching the starting directory will not prevent git from directory matching the starting directory will not prevent git from
finding a repository in the starting directory or a parent directory. finding a repository in the starting directory or a parent directory.
* Do not fail when deleting remotes in the presence of broken
global configs which contain branches.
### API additions ### API additions
* You can now get the user-agent used by libgit2 using the * You can now get the user-agent used by libgit2 using the
......
...@@ -2162,15 +2162,21 @@ static int remove_branch_config_related_entries( ...@@ -2162,15 +2162,21 @@ static int remove_branch_config_related_entries(
if (git_buf_printf(&buf, "branch.%.*s.merge", (int)branch_len, branch) < 0) if (git_buf_printf(&buf, "branch.%.*s.merge", (int)branch_len, branch) < 0)
break; break;
if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
break; if (error != GIT_ENOTFOUND)
break;
giterr_clear();
}
git_buf_clear(&buf); git_buf_clear(&buf);
if (git_buf_printf(&buf, "branch.%.*s.remote", (int)branch_len, branch) < 0) if (git_buf_printf(&buf, "branch.%.*s.remote", (int)branch_len, branch) < 0)
break; break;
if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) if ((error = git_config_delete_entry(config, git_buf_cstr(&buf))) < 0) {
break; if (error != GIT_ENOTFOUND)
break;
giterr_clear();
}
} }
if (error == GIT_ITEROVER) if (error == GIT_ITEROVER)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment