Re: [PATCH 3/3] branch: add --unset-upstream option
On Wed, 2012-07-11 at 09:53 -0700, Junio C Hamano wrote: > Carlos Martín Nieto writes: > > > I've added a bit of code to also remove branch.foo.rebase, which > > I'd also consider to be part of the upstream information. > > If "git branch -t" or "git branch --set-upstream" took another > option "--integrate-with=[rebase|merge]" to set the variable, I > would agree that removing branch.$name.rebase would be the right > thing to do, but because it is not, I do not know if it is sensible > to remove it upon --unset-upstream. I'll drop it then. cmn -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] branch: add --unset-upstream option
Carlos Martín Nieto writes: > I've added a bit of code to also remove branch.foo.rebase, which > I'd also consider to be part of the upstream information. If "git branch -t" or "git branch --set-upstream" took another option "--integrate-with=[rebase|merge]" to set the variable, I would agree that removing branch.$name.rebase would be the right thing to do, but because it is not, I do not know if it is sensible to remove it upon --unset-upstream. I actually thought about commenting on that exact variable in my review, saying that the patch was correct that it didn't touch it. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] branch: add --unset-upstream option
On Tue, 2012-07-10 at 11:02 -0700, Junio C Hamano wrote: > Carlos Martín Nieto writes: > > > We have ways of setting the upstream information, but if we want to > > unset it, we need to resort to modifying the configuration manually. > > > > Teach branch an --unset-upstream option that unsets this information. > > > > --- > > > > create_branch() uses install_branch_config() which may also set > > branch.foo.rebase, so this version might leave some configuration > > laying around. > > > > I wonder if deleting the whole branch.foo section would be better. Can > > we be sure that nothing else shows up there? > > "branch.foo.$unknown" may not be related to upstream at all, so that > will not fly. Besides, we already have unknown=description, no? Ah yes, that exists. I've added a bit of code to also remove branch.foo.rebase, which I'd also consider to be part of the upstream information. cmn -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 3/3] branch: add --unset-upstream option
Carlos Martín Nieto writes: > We have ways of setting the upstream information, but if we want to > unset it, we need to resort to modifying the configuration manually. > > Teach branch an --unset-upstream option that unsets this information. > > --- > > create_branch() uses install_branch_config() which may also set > branch.foo.rebase, so this version might leave some configuration > laying around. > > I wonder if deleting the whole branch.foo section would be better. Can > we be sure that nothing else shows up there? "branch.foo.$unknown" may not be related to upstream at all, so that will not fly. Besides, we already have unknown=description, no? If you are removing the branch "foo", it would make sense, though. > + } else if (unset_upstream) { > + struct branch *branch = branch_get(argv[0]); > + struct strbuf buf = STRBUF_INIT; > + > + strbuf_addf(&buf, "branch.%s.remote", branch->name); > + git_config_set_multivar(buf.buf, NULL, NULL, 1); This part makes sense, as "--set-upstream" is about setting the value of branch.foo.remote to 'origin' or whatever. > + strbuf_reset(&buf); > + strbuf_addf(&buf, "branch.%s.merge", branch->name); > + git_config_set_multivar(buf.buf, NULL, NULL, 1); This also makes sense because "branch.foo.merge" names a ref in the context of the remote. A branch may have integrated with the "dev" branch at "origin" repository; when it is modified to slurp changes from "central" repository from now on, there is nothing that says that the branch "dev" at this different remote corresponds to the "dev" branch at the original "origin" repository (such a branch may not even exist at the new "central" repository). There is no point leaving the "branch.foo.merge" configuration behind when you unset the upstream information. > + strbuf_release(&buf); > } else if (argc > 0 && argc <= 2) { > struct branch *branch = branch_get(argv[0]); > const char *old_upstream = NULL; -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html