git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] remote: Ignore failure to remove missing branch.<name>.merge

From
Ross Lagerwall <rosslagerwall@gmail.com>
Date
Feb 18, 2017, 00:23 UTC
Message-ID
<20170218002341.23099-1-rosslagerwall@gmail.com>

If a branch is configured with a default remote but no branch.<name>.merge and then the remote is removed, git fails to remove the remote with: "fatal: could not unset 'branch.<name>.merge'"

Instead, ignore this since it is not an error and shouldn't prevent the remote from being removed.

Signed-off-by: Ross Lagerwall <rosslagerwall@gmail.com>
---
 builtin/remote.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/builtin/remote.c b/builtin/remote.c
index e52cf3925..5dd22c2eb 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -769,7 +769,9 @@ static int rm(int argc, const char **argv)
 				strbuf_reset(&buf);
 				strbuf_addf(&buf, "branch.%s.%s",
 						item->string, *k);
-				git_config_set(buf.buf, NULL);
+				result = git_config_set_gently(buf.buf, NULL);
+				if (result && result != CONFIG_NOTHING_SET)
+					die(_("COULd not unset '%s'"), buf.buf);
 			}
 		}
 	}
-- 
2.11.0
Next: Junio C Hamano
Message 1 of 4 in “remote: Ignore failure to remove missing branch.<name>.merge”
  1. remote: Ignore failure to remove missing branch.<name>.mergeRoss Lagerwall, Feb 18, 2017
  2. Junio C HamanoFeb 21, 2017
  3. Ross LagerwallFeb 21, 2017
  4. Junio C HamanoFeb 21, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.