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

Re: [PATCH v6 9/9] status: unit tests for --porcelain=v2

From
JHJeff Hostetler <git@jeffhostetler.com>
Date
Aug 11, 2016, 20:51 UTC
Message-ID
<57ACE550.9040501@jeffhostetler.com>
In-Reply-To
<xmqqtwer17b6.fsf@gitster.mtv.corp.google.com>
On 08/11/2016 02:36 PM, Junio C Hamano wrote:
Show 10 quoted lines
> Jeff Hostetler <git@jeffhostetler.com> writes:
>
>> From: Jeff Hostetler <jeffhost@microsoft.com>
>> +. ./test-lib.sh
>> +
>> +OID_EMPTY=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
>
> It seems that test-lib.sh these days has EMPTY_BLOB defined for your
> use.  You can remove this and replace its use (just two lines) with
> $EMPTY_BLOB down in the "add -N" test.

That's a recent addition to test-lib.sh. I'll rebase my series onto a more recent master to get that.

Show 10 quoted lines
>> +test_expect_success setup '
>> +	test_tick &&
>> +	git config --local core.autocrlf false &&
>
> I'd suggest removing "--local".
>
> Existing use of "git config" in the test suite, unless their use is
> about testing "git config" itself to validate the operation of the
> --local/--global/--system options, do not seem to explicitly say
> "--local", which is the default anyway.
ok. just being cautious, but if that's the convention, that's fine.
Show 12 quoted lines
>> +test_expect_success 'after first commit, make dirt, confirm unstaged changes' '
>
> Did you mean s/dirt/dirty/?  "make and confirm unstaged changes"
> would be sufficient.  Because "confirming" is implicit (as these
> are all tests), "after the first commit, modify working tree files"
> might even be better, perhaps?
>
>> +	echo x >>file_x &&
>> +	OID_X1=$(git hash-object -t blob -- file_x) &&
>> +	rm file_z &&
>> +	H0=$(git rev-parse HEAD) &&
>> + ...
got it.
Show 8 quoted lines
>> +test_expect_success 'after first commit, stage dirt, confirm staged changes' '
>
> What you "git add" is meant to be good changes, so they are no
> longer dirt ;-)  More importantly, because I never heard of "dirt"
> used in Git context, it is unclear if it is an untracked file, a
> modification that is not meant to be committed immediately, or what.
>
> "after the first commit, fully add changes to the index"?
reworded and simplified.
Show 32 quoted lines
>> +	git add file_x &&
>> +	git rm file_z &&
>> +	H0=$(git rev-parse HEAD) &&
>> +
>> +	cat >expect <<-EOF &&
>> +	# branch.oid $H0
>> +	# branch.head master
>> +	1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
>> +	1 D. N... 100644 000000 000000 $OID_Z $_z40 file_z
>> +	? actual
>> +	? expect
>> +	EOF
>
>> +test_expect_success 'after first commit, also stage rename, confirm 2 path line format' '
>> +	git mv file_y renamed_y &&
>> +	H0=$(git rev-parse HEAD) &&
>> +
>> +	q_to_tab >expect <<-EOF &&
>> +	# branch.oid $H0
>> +	# branch.head master
>> +	1 M. N... 100644 100644 100644 $OID_X $OID_X1 file_x
>> +	1 D. N... 100644 000000 000000 $OID_Z $_z40 file_z
>> +	2 R. N... 100644 100644 100644 $OID_Y $OID_Y R100 renamed_yQfile_y
>> +	? actual
>> +	? expect
>> +	EOF
>> +
>> +	git status --porcelain=v2 --branch --untracked-files=all >actual &&
>> +	test_cmp expect actual
>> +'
>
> Do we want to test -z format on this, too?
Sure.
I'll send these up in a v7 series in a few minutes.

Thanks Jeff

Previous: Junio C HamanoNext: Jeff Hostetler
Message 11 of 13 in “status: V2 porcelain status”
  1. 0/9 status: V2 porcelain statusJeff Hostetler, Aug 11, 2016
  2. 2/9 status: cleanup API to wt_status_printJeff Hostetler, Aug 11, 2016
  3. 7/9 git-status.txt: describe --porcelain=v2 formatJeff Hostetler, Aug 11, 2016
  4. 8/9 test-lib-functions.sh: Add lf_to_nulJeff Hostetler, Aug 11, 2016
  5. 5/9 status: print per-file porcelain v2 status dataJeff Hostetler, Aug 11, 2016
  6. 3/9 status: support --porcelain[=<version>]Jeff Hostetler, Aug 11, 2016
  7. 4/9 status: collect per-file data for --porcelain=v2Jeff Hostetler, Aug 11, 2016
  8. 1/9 status: rename long-format print routinesJeff Hostetler, Aug 11, 2016
  9. 9/9 status: unit tests for --porcelain=v2Jeff Hostetler, Aug 11, 2016
  10. Junio C HamanoAug 11, 2016
  11. Jeff HostetlerAug 11, 2016
  12. 6/9 status: print branch info with --porcelain=v2 --branchJeff Hostetler, Aug 11, 2016
  13. Junio C HamanoAug 11, 2016

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.