Re: [PATCH] branch: optionally setup branch.*.merge from upstream local branches
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Feb 18, 2008, 12:14 UTC
- Message-ID
- <alpine.LSU.1.00.0802181209210.30505@racer.site>
- In-Reply-To
- <1203336248-9308-1-git-send-email-jaysoffian@gmail.com>
Hi,
On Mon, 18 Feb 2008, Jay Soffian wrote:
Show 11 quoted lines
> diff --git a/branch.h b/branch.h
> index d30abe0..771d6ce 100644
> --- a/branch.h
> +++ b/branch.h
> @@ -1,6 +1,12 @@
> #ifndef BRANCH_H
> #define BRANCH_H
>
> +enum branch_track {
> + BRANCH_TRACK_FALSE = 0,
> + BRANCH_TRACK_TRUE = 1,BRANCH_TRACK_REMOTES would be a better name here. And you do not need the "= 1" and "= 2".
Show 16 quoted lines
> + BRANCH_TRACK_ALWAYS = 2,
> +};
> +
> /* Functions for acting on the information about branches. */
>
> /*
> diff --git a/builtin-branch.c b/builtin-branch.c
> index 5094e0d..231bff4 100644
> --- a/builtin-branch.c
> +++ b/builtin-branch.c
> @@ -30,7 +30,7 @@ static const char * const builtin_branch_usage[] = {
> static const char *head;
> static unsigned char head_sha1[20];
>
> -static int branch_track = 1;
> +static enum branch_track branch_track = BRANCH_TRACK_FALSE;That is a clear regression.
Show 11 quoted lines
> @@ -77,6 +77,10 @@ static int git_branch_config(const char *var, const char *value)
> return 0;
> }
> if (!strcmp(var, "branch.autosetupmerge")) {
> + if (value && !strcasecmp(value, "always")) {
> + branch_track = BRANCH_TRACK_ALWAYS;
> + return 0;
> + }
> branch_track = git_config_bool(var, value);
> return 0;
> }You have this in builtin-branch.c and builtin-checkout.c. Duplicated code. IMHO it is time to move this into the git_default_config() function (with "branch_track" being renamed to "git_branch_track", and moved to environment.c).
Personally, I have no problem with typing "git merge <branch>" in your workflow. I would even avoid saying "git pull" for obviously-local branches, because I would have forgotten which branch it tracked originally.
But hey, if you really want to... ;-)
Ciao, Dscho