git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/3] status: add status.aheadbehind setting

From
SZEDER Gábor <szeder.dev@gmail.com>
Date
Jun 29, 2019, 17:30 UTC
Message-ID
<20190629173001.GI21574@szeder.dev>
In-Reply-To
<2f0f2a2df9410947b985d83a924d2549d62bb65f.1560889284.git.gitgitgadget@gmail.com>
On Tue, Jun 18, 2019 at 01:21:25PM -0700, Jeff Hostetler via GitGitGadget wrote:
Show 17 quoted lines
> diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
> index 716283b274..febf63f28a 100755
> --- a/t/t6040-tracking-info.sh
> +++ b/t/t6040-tracking-info.sh
> @@ -159,6 +159,19 @@ test_expect_success 'status -s -b --no-ahead-behind (diverged from upstream)' '
>  	test_i18ncmp expect actual
>  '
>  
> +cat >expect <<\EOF
> +## b1...origin/master [different]
> +EOF
> +
> +test_expect_success 'status.aheadbehind=false status -s -b (diverged from upstream)' '
> +	(
> +		cd test &&
> +		git checkout b1 >/dev/null &&
> +		git -c status.aheadbehind=false status -s -b | head -1

These tests specifically check 'git status', but the pipe hides its exit code. Please use an intermediate file instead.

> +	) >actual &&

I found it odd to save the output of a whole subshell and redirect 'git checkout's stdout to /dev/null to prevent it from itnerfering with the stdout of the subshell, instead of saving only the stdout of the command the test focuses on.

Show 38 quoted lines
> +	test_i18ncmp expect actual
> +'
> +
>  cat >expect <<\EOF
>  On branch b1
>  Your branch and 'origin/master' have diverged,
> @@ -174,6 +187,15 @@ test_expect_success 'status --long --branch' '
>  	test_i18ncmp expect actual
>  '
>  
> +test_expect_success 'status --long --branch' '
> +	(
> +		cd test &&
> +		git checkout b1 >/dev/null &&
> +		git -c status.aheadbehind=true status --long -b | head -3
> +	) >actual &&
> +	test_i18ncmp expect actual
> +'
> +
>  cat >expect <<\EOF
>  On branch b1
>  Your branch and 'origin/master' refer to different commits.
> @@ -188,6 +210,15 @@ test_expect_success 'status --long --branch --no-ahead-behind' '
>  	test_i18ncmp expect actual
>  '
>  
> +test_expect_success 'status.aheadbehind=false status --long --branch' '
> +	(
> +		cd test &&
> +		git checkout b1 >/dev/null &&
> +		git -c status.aheadbehind=false status --long -b | head -2
> +	) >actual &&
> +	test_i18ncmp expect actual
> +'
> +
>  cat >expect <<\EOF
>  ## b5...brokenbase [gone]
>  EOF
Previous: Jeff HostetlerNext: Jeff Hostetler via GitGitGadget
Message 5 of 7 in “git-status: create config for ahead/behind calculation”
  1. 0/3 git-status: create config for ahead/behind calculationDerrick Stolee via GitGitGadget, Jun 18, 2019
  2. 1/3 status: add status.aheadbehind settingJeff Hostetler via GitGitGadget, Jun 18, 2019
  3. Junio C HamanoJun 21, 2019
  4. Jeff HostetlerJun 26, 2019
  5. SZEDER GáborJun 29, 2019
  6. 3/3 status: ignore status.aheadbehind in porcelain formatsJeff Hostetler via GitGitGadget, Jun 18, 2019
  7. 2/3 status: warn when a/b calculation takes too longJeff Hostetler via GitGitGadget, Jun 18, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.