Thread (11 messages) flat view 11 messages, 4 authors, 2016-06-15

Re: [PATCH] git-remote - Unset core.origin when deleting the default remote

From: Mark Levedahl <hidden>
Date: 2016-06-15 22:44:05

Possibly related (same subject, not in this thread)

Jeff King wrote:
On Sun, Jan 13, 2008 at 11:27:08AM -0500, Mark Levedahl wrote:

  
quoted
--- a/git-remote.perl
+++ b/git-remote.perl
@@ -328,6 +328,11 @@ sub rm_remote {
 
 	$git->command('config', '--remove-section', "remote.$name");
 
+	my $defremote = $git->config("core.origin");
+	if (defined $defremote && $defremote eq $name) {
+	       $git->command("config", "--unset", "core.origin");
+	}
+
    
I'm not sure I see the use case that this helps.
  
Just being thorough: the man page claims that "git remote rm foo" 
removes all mention of remote foo.
    Alternatively, when adding a remote, if it is the _only_ remote (or
    perhaps if the current core.origin doesn't exist), we could set
    core.origin which would automagically cover the latter two cases.
    Although it feels a little too DWIM.

-Peff
  
I suspect anything done in this case is going to suffer from DWIM-itis 
in some conditions. I can't offer a better argument than the one above.

Mark
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help