From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a3-smtp.messagingengine.com (fout-a3-smtp.messagingengine.com [103.168.172.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7C1443DA7F7 for ; Wed, 10 Jun 2026 15:49:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.146 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781106542; cv=none; b=kprKe9S7dj+a++wQkweYhDmC2cldHpqwudsyYTpGqNkwZOHKLaXXuoheLquWyepiy0KTR4ceeiTD30RyRHCnrqL2JEcN/jXt0ImLSa5/jX3WfinMMi2XAwetJdWhihsEdyt5M5lrhNN9hRr8Ri4AAu3mn4iUL4Ff2/0Jeg2AXzo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781106542; c=relaxed/simple; bh=6Bd1h2lzaYcHBp+eT0C0/5ufVijria+5mC63vcOthOk=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=OI7MeOCgVvUIdnjyNm2BIYKvH8U5AcZ5bSYceyytuxIN/w8mFRRINBRRfnk0ebKW+JZ9kOYXwydd5tfteSXGSyMbXF+cER/ZooDMoWodtGTabJ6GCbQOsRNy320hL78VeNicSj3SVYWVl9VHYprID770QvSa9uhVOpdnykPC1uI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=kRazSPzx; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=Xt/vV0zX; arc=none smtp.client-ip=103.168.172.146 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="kRazSPzx"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="Xt/vV0zX" Received: from phl-compute-02.internal (phl-compute-02.internal [10.202.2.42]) by mailfout.phl.internal (Postfix) with ESMTP id BD9A1EC0053; Wed, 10 Jun 2026 11:49:00 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-02.internal (MEProxy); Wed, 10 Jun 2026 11:49:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1781106540; x=1781192940; bh=Wxww8MJzHh z0mtojnM73vRZu5vxvH5t5nmAgCm+n9zs=; b=kRazSPzxxE103SoUibiyHDUQWK yDJdMzh3F389yLN2tuILm0/v7EQC4JTrseCkzNCOIUobLJHA5TVj7ESpFAaMYHsQ SdqCVooH5uCBebBxINVbpj+1MS4POS6uFRmqW+rn2SUtK3LgV5MicUGnufRpCiXr WORR2zotqozWU4WATryzkHIKfjjZdg4V14Hq4yUJLpKlwSkjWaRaHff3MyJfYSWO hoKP/R+g6tlTWkQZ5JsDCsL5X5Uovf2V5RY5nn6MuqpmyLUmxdu9rAJ19XAa9cFt /HKxD4Dn7NJuBfiGAJl/A5gizJK5h7fEx1DhIkbPPIz1e/G4opFEOX5dvcRg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1781106540; x=1781192940; bh=Wxww8MJzHhz0mtojnM73vRZu5vxvH5t5n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KQ74RFM/REj8jefg X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Wed, 10 Jun 2026 11:49:00 -0400 (EDT) From: Junio C Hamano To: "Harald Nordgren via GitGitGadget" Cc: git@vger.kernel.org, Harald Nordgren Subject: Re: [PATCH v4] remote: qualify "git pull" advice for non-upstream compareBranches In-Reply-To: (Harald Nordgren via GitGitGadget's message of "Thu, 21 May 2026 14:06:07 +0000") References: Date: Wed, 10 Jun 2026 08:48:59 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain "Harald Nordgren via GitGitGadget" writes: > From: Harald Nordgren > > Enable ENABLE_ADVICE_PULL for push-branch comparisons too, not just > the upstream entry, so the "use git pull" hint prints when the local > branch is behind its push branch. > > Spell out "git pull " so running the suggested > command actually pulls the ref the user was told about; plain > "git pull" would fetch the upstream instead. > > Signed-off-by: Harald Nordgren > --- > remote: qualify "git pull" advice for non-upstream branches > > * Don't suggest git pull when we have no good command to suggest. > * New test for this. Asserts the behind line shows with no follow-up > advice. Very well written. What does not happen in the "punt" case (the first bullet point above) may deserve to be given in the commit log message, but otherwise it is very clear what the change wanted to do to the future readers of "git log". > remote.c | 48 +++++++++++++++---- > t/t6040-tracking-info.sh | 100 +++++++++++++++++++++++++++++++++++++++ > 2 files changed, 140 insertions(+), 8 deletions(-) The code changes look correct, and the new tests checks the new suggestion as well as the "punt" case, which is good. Shall we mark it for 'next' now? Thanks for working on this. >> diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh > index 0242b5bf7a..91cbb8775d 100755 > --- a/t/t6040-tracking-info.sh > +++ b/t/t6040-tracking-info.sh > @@ -646,4 +646,104 @@ test_expect_success 'status.compareBranches with remapped push and upstream remo > test_cmp expect actual > ' > > +test_expect_success 'status.compareBranches behind both upstream and push' ' > + test_config -C test push.default current && > + test_config -C test remote.pushDefault origin && > + test_config -C test status.compareBranches "@{upstream} @{push}" && > + git -C test checkout -b feature13 upstream/main && > + (cd test && advance work13) && > + git -C test push origin && > + git -C test branch --set-upstream-to upstream/ahead && > + git -C test reset --hard HEAD^ && > + git -C test status >actual && > + cat >expect <<-EOF && > + On branch feature13 > + Your branch is behind ${SQ}upstream/ahead${SQ} by 1 commit, and can be fast-forwarded. > + (use "git pull" to update your local branch) > + > + Your branch is behind ${SQ}origin/feature13${SQ} by 1 commit, and can be fast-forwarded. > + (use "git pull origin feature13" to update your local branch) > + > + nothing to commit, working tree clean > + EOF > + test_cmp expect actual > +' A good test that clearly shows how @{push} is described ;-) > +test_expect_success 'status.compareBranches with remapped push and behind push branch' ' > + test_config -C test remote.pushDefault origin && > + test_config -C test remote.origin.push refs/heads/feature14:refs/heads/remapped14 && > + test_config -C test status.compareBranches "@{push}" && > + git -C test checkout -b feature14 upstream/main && > + (cd test && advance work14) && > + git -C test push && > + git -C test reset --hard HEAD^ && > + git -C test status >actual && > + cat >expect <<-EOF && > + On branch feature14 > + Your branch is behind ${SQ}origin/remapped14${SQ} by 1 commit, and can be fast-forwarded. > + (use "git pull origin remapped14" to update your local branch) > + > + nothing to commit, working tree clean > + EOF > + test_cmp expect actual > +' OK.