git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: git@vger.kernel.org, Martin Langhoff <martin.langhoff@gmail.com>,
	Steffen Prohaska <prohaska@zib.de>,
	Daniel Barkalow <barkalow@iabervon.org>,
	Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: [PATCH] checkout: updates to tracking report
Date: Wed, 20 Feb 2008 19:42:53 -0800	[thread overview]
Message-ID: <7vk5kzynya.fsf_-_@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20080221014513.GA7185@coredump.intra.peff.net> (Jeff King's message of "Wed, 20 Feb 2008 20:45:13 -0500")

Jeff King <peff@peff.net> writes:

>>  	struct branch *branch = branch_get(NULL);
>
> Shouldn't this be branch_get(new->name)?

Perhaps.

> ...
> 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).

Thanks.

-- >8 --

Ask branch_get() for the new branch explicitly instead of
letting it return a potentially stale information.

Tighten the logic to find the tracking branch to deal better
with misconfigured repositories (i.e. branch.*.merge can exist
but it may not have a refspec that fetches to .it)

Also fixes grammar in a message, as pointed out by Jeff King.

The function is about reporting and not automatically
fast-forwarding to the upstream, so stop calling it
"adjust-to".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
 builtin-checkout.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/builtin-checkout.c b/builtin-checkout.c
index f51b77a..19413eb 100644
--- a/builtin-checkout.c
+++ b/builtin-checkout.c
@@ -290,7 +290,7 @@ static int merge_working_tree(struct checkout_opts *opts,
 	return 0;
 }
 
-static void adjust_to_tracking(struct branch_info *new, struct checkout_opts *opts)
+static void report_tracking(struct branch_info *new, struct checkout_opts *opts)
 {
 	/*
 	 * We have switched to a new branch; is it building on
@@ -306,13 +306,13 @@ static void adjust_to_tracking(struct branch_info *new, struct checkout_opts *op
 	int rev_argc;
 	int num_ours, num_theirs;
 	const char *remote_msg;
-	struct branch *branch = branch_get(NULL);
+	struct branch *branch = branch_get(new->name);
 
 	/*
 	 * Nothing to report unless we are marked to build on top of
 	 * somebody else.
 	 */
-	if (!branch || !branch->merge)
+	if (!branch || !branch->merge || !branch->merge[0] || !branch->merge[0]->dst)
 		return;
 
 	/*
@@ -370,7 +370,7 @@ static void adjust_to_tracking(struct branch_info *new, struct checkout_opts *op
 		       remote_msg, base,
 		       num_ours, (num_ours == 1) ? "" : "s");
 	else if (!num_ours)
-		printf("Your branch is behind of the tracked%s branch '%s' "
+		printf("Your branch is behind the tracked%s branch '%s' "
 		       "by %d commit%s,\n"
 		       "and can be fast-forwarded.\n",
 		       remote_msg, base,
@@ -426,7 +426,7 @@ static void update_refs_for_switch(struct checkout_opts *opts,
 	remove_branch_state();
 	strbuf_release(&msg);
 	if (!opts->quiet && (new->path || !strcmp(new->name, "HEAD")))
-		adjust_to_tracking(new, opts);
+		report_tracking(new, opts);
 }
 
 static int switch_branches(struct checkout_opts *opts,
-- 
1.5.4.2.261.g851a5

  reply	other threads:[~2008-02-21  3:49 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-08  4:44 Minor annoyance with git push Martin Langhoff
2008-02-08  4:50 ` Martin Langhoff
2008-02-08  7:48   ` Junio C Hamano
2008-02-09 11:22     ` Steffen Prohaska
2008-02-10  3:44       ` Junio C Hamano
2008-02-10 12:21         ` Johannes Schindelin
2008-02-08 11:52   ` Johannes Schindelin
2008-02-08 22:23     ` Martin Langhoff
2008-02-08 22:27       ` Mike Hommey
2008-02-08  5:38 ` Sean
2008-02-08  6:29   ` Steffen Prohaska
2008-02-08 11:50 ` Johannes Schindelin
2008-02-08 22:27   ` Martin Langhoff
2008-02-08 22:57     ` Johannes Schindelin
2008-02-09  2:46     ` Jeff King
2008-02-09  2:54       ` Jeff King
2008-02-09 13:04         ` Johannes Schindelin
2008-02-09 13:22           ` Jeff King
2008-02-09 11:22       ` Steffen Prohaska
2008-02-09  3:00 ` Jeff King
2008-02-09  3:24   ` Junio C Hamano
2008-02-09  3:55     ` Jeff King
2008-02-09 11:50     ` Martin Langhoff
2008-02-09 13:06       ` Johannes Schindelin
2008-02-10  2:24       ` Junio C Hamano
2008-02-10 10:13         ` Jeff King
2008-02-10 12:22           ` Johannes Schindelin
2008-02-17  1:08         ` [RFC] checkout to notice forks (Re: Minor annoyance with git push) Junio C Hamano
2008-02-17  3:31           ` Daniel Barkalow
2008-02-17  4:11             ` Junio C Hamano
2008-02-17  6:39               ` Daniel Barkalow
2008-02-17  7:37                 ` Junio C Hamano
2008-02-17 17:36                   ` Daniel Barkalow
2008-02-17 12:28           ` Jeff King
2008-02-20 16:01             ` Santi Béjar
2008-02-19 17:03           ` Martin Langhoff
2008-02-20 23:05             ` [PATCH] checkout: tone down the "forked status" diagnostic messages Junio C Hamano
2008-02-21  1:45               ` Jeff King
2008-02-21  3:42                 ` Junio C Hamano [this message]
2008-02-21  5:27                   ` [PATCH] checkout: updates to tracking report Jay Soffian
2008-02-21 17:02                   ` Daniel Barkalow
2008-02-21  2:56               ` [PATCH] checkout: tone down the "forked status" diagnostic messages Jay Soffian
2008-02-09 10:53   ` Minor annoyance with git push Steffen Prohaska
2008-02-09 13:10     ` Johannes Schindelin
2008-02-10  2:07       ` Junio C Hamano
2008-02-10  2:15         ` Johannes Schindelin
2008-02-10 10:17           ` Jeff King
2008-02-10 12:20             ` Johannes Schindelin
2008-02-10 12:23               ` Jeff King
2008-02-10 13:04                 ` Johannes Schindelin
2008-02-10 13:07                   ` Jeff King
2008-02-20  8:23                   ` Junio C Hamano
2008-02-20 13:06                     ` Johannes Schindelin
2008-02-20 15:20                       ` Jay Soffian
2008-02-20 15:38                         ` Johannes Schindelin
2008-02-21 22:35                           ` Steven Walter
2008-02-22  0:11                             ` Johannes Schindelin
2008-02-20 14:03                     ` Jeff King
2008-02-20 17:54                       ` Junio C Hamano
2008-02-20 18:15                         ` Jeff King
2008-02-20 18:17                           ` Jeff King
2008-02-20 18:19                           ` Junio C Hamano
2008-02-20 18:23                             ` Jeff King
2008-02-10 14:03           ` Wincent Colaiuta
2008-02-10 15:02             ` Steven Walter
2008-02-10 16:29               ` Johannes Schindelin
2008-02-10 16:26             ` Johannes Schindelin
2008-02-10 18:18               ` Wincent Colaiuta
2008-02-10 22:34                 ` Jeff King
2008-02-10 22:59                   ` Junio C Hamano
2008-02-10 23:29                     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vk5kzynya.fsf_-_@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=barkalow@iabervon.org \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    --cc=martin.langhoff@gmail.com \
    --cc=peff@peff.net \
    --cc=prohaska@zib.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).