Re: [PATCH 3/3] branch: add --unset-upstream option

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Carlos Martín Nieto <cmn@xxxxxxxx> 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]