Re: [PATCH] checkout: tone down the "forked status" diagnostic messages

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

 



On Wed, Feb 20, 2008 at 03:05:23PM -0800, Junio C Hamano wrote:

> @@ -301,64 +301,88 @@ static void adjust_to_tracking(struct branch_info *new, struct checkout_opts *op
>  	char *base;
>  	unsigned char sha1[20];
>  	struct commit *ours, *theirs;
> -	const char *msgfmt;
>  	char symmetric[84];
> -	int show_log;
> +	struct rev_info revs;
> +	const char *rev_argv[10];
> +	int rev_argc;
> +	int num_ours, num_theirs;
> +	const char *remote_msg;
>  	struct branch *branch = branch_get(NULL);

Shouldn't this be branch_get(new->name)? branch_get calls read_config(),
which caches the "current branch" information, so it's possible to end
up with stale branch info. Try:

  git clone git://git.kernel.org/pub/scm/git/git.git
  git checkout -b next origin/next

I get:

  Branch next set up to track remote branch refs/remotes/origin/next.
  Switched to a new branch "next"
  Your branch is ahead of the tracked remote branch 'origin/master' by 76
  commits.

Switching to master and then back to the already-created "next" works
fine.

Even safer, I think, would be a way to invalidate the information cached
in read_config when we change branches; this would fix it for any other
callsites that look at the current branch from the same git invocation
that changes the current branch.

> +	if (!num_theirs)
> +		printf("Your branch is ahead of the tracked%s branch '%s' "
> +		       "by %d commit%s.\n",
> +		       remote_msg, base,
> +		       num_ours, (num_ours == 1) ? "" : "s");
> +	else if (!num_ours)
> +		printf("Your branch is behind of the tracked%s branch '%s' "
> +		       "by %d commit%s,\n"
> +		       "and can be fast-forwarded.\n",

While not uncommon colloquially, "behind of" is not grammatically
correct. "behind" is a preposition, so the "of" is redundant (it is
necessary in the top string because "ahead" is an adverb).

-Peff
-
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]

  Powered by Linux