Thread (141 messages) 141 messages, 8 authors, 2026-03-04
STALE108d
Revisions (14)
  1. v12 [diff vs current]
  2. v13 [diff vs current]
  3. v14 [diff vs current]
  4. v15 [diff vs current]
  5. v16 [diff vs current]
  6. v17 [diff vs current]
  7. v18 [diff vs current]
  8. v19 [diff vs current]
  9. v20 [diff vs current]
  10. v21 [diff vs current]
  11. v22 [diff vs current]
  12. v23 [diff vs current]
  13. v24 [diff vs current]
  14. v25 current

[PATCH v25 0/2] status: show comparison with push remote tracking branch

From: Harald Nordgren via GitGitGadget <hidden>
Date: 2026-01-13 12:11:59

cc: Chris Torek chris.torek@gmail.com cc: Yee Cheng Chin
ychin.macvim@gmail.com cc: "brian m. carlson" sandals@crustytoothpaste.net
cc: Ben Knoble ben.knoble@gmail.com cc: "Kristoffer Haugsbakk"
kristofferhaugsbakk@fastmail.com cc: Phillip Wood phillip.wood123@gmail.com
cc: Nico Williams nico@cryptonector.com cc: Patrick Steinhardt ps@pks.im

Harald Nordgren (2):
  refactor format_branch_comparison in preparation
  status: show comparison with push remote tracking branch

 remote.c                 | 175 +++++++++++++++++++-----
 t/t6040-tracking-info.sh | 285 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 425 insertions(+), 35 deletions(-)


base-commit: 8745eae506f700657882b9e32b2aa00f234a6fb6
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2138%2FHaraldNordgren%2Fahead_of_main_status-v25
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2138/HaraldNordgren/ahead_of_main_status-v25
Pull-Request: https://github.com/git/git/pull/2138

Range-diff vs v24:

 1:  fd05c7b778 = 1:  fd05c7b778 refactor format_branch_comparison in preparation
 2:  138b79a0b9 ! 2:  fa744efc59 status: show comparison with push remote tracking branch
     @@ t/t6040-tracking-info.sh: test_expect_success '--set-upstream-to @{-1}' '
      +	test_cmp expect actual
      +'
      +
     ++test_expect_success 'status with upstream ahead and push branch up to date' '
     ++	(
     ++		cd test &&
     ++		git checkout -b ahead upstream/main &&
     ++		advance work &&
     ++		git push upstream HEAD &&
     ++		git checkout -b feature8 upstream/main &&
     ++		git push origin &&
     ++		git branch --set-upstream-to upstream/ahead &&
     ++		git status >../actual
     ++	) &&
     ++	cat >expect <<-EOF &&
     ++	On branch feature8
     ++	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 up to date with ${SQ}origin/feature8${SQ}.
     ++
     ++	nothing to commit, working tree clean
     ++	EOF
     ++	test_cmp expect actual
     ++'
     ++
      +test_expect_success 'status shows remapped push refspec' '
      +	(
      +		cd test &&
     -+		git checkout -b feature8 origin/main &&
     -+		git config remote.origin.push refs/heads/feature8:refs/heads/remapped &&
     ++		git checkout -b feature9 origin/main &&
     ++		git config remote.origin.push refs/heads/feature9:refs/heads/remapped &&
      +		git push &&
      +		advance work &&
      +		git status >../actual
      +	) &&
      +	cat >expect <<-EOF &&
     -+	On branch feature8
     ++	On branch feature9
      +	Your branch is ahead of ${SQ}origin/main${SQ} by 1 commit.
      +
      +	Your branch is ahead of ${SQ}origin/remapped${SQ} by 1 commit.
     @@ t/t6040-tracking-info.sh: test_expect_success '--set-upstream-to @{-1}' '
      +test_expect_success 'status shows remapped push refspec with upstream remote' '
      +	(
      +		cd test &&
     -+		git checkout -b feature9 upstream/main &&
     -+		git config remote.origin.push refs/heads/feature9:refs/heads/remapped &&
     ++		git checkout -b feature10 upstream/main &&
     ++		git config remote.origin.push refs/heads/feature10:refs/heads/remapped &&
      +		git push origin &&
      +		advance work &&
      +		git status >../actual
      +	) &&
      +	cat >expect <<-EOF &&
     -+	On branch feature9
     ++	On branch feature10
      +	Your branch is ahead of ${SQ}upstream/main${SQ} by 1 commit.
      +
      +	Your branch is ahead of ${SQ}origin/remapped${SQ} by 1 commit.

-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help