Re: [PATCH v2 1/1] config: learn the "hostname:" includeIf condition
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Mar 11, 2024, 17:39 UTC
- Message-ID
- <xmqqil1ssm5y.fsf@gitster.g>
- In-Reply-To
- <9fb02065-12d2-4c92-b1a5-74c06125c692@iencinas.com>
Ignacio Encinas Rubio <ignacio@iencinas.com> writes:
> I can't think of any room for improvement other than integrating > hostname (or a custom hostname) into git and using it in the tests, but > I doubt it is worth it.
Ah, that is a thought. We have t/helper that builds "test-tool" just for that, and exposing the output of xhostname() does sounds like a reasonable way to go. It would roughly involve
* Add t/helper/test-xhostname.c that defines cmd__xhostname() and writes the result of calling xhostname() to its standard output.
* Plumb it through by adding it to a few places:
- t/helper/test-tool.h wants the extern definition. - t/helper/test-tool.c wants it in its cmds[] array. - Makefile wants to list it in TEST_BUILTIN_OBJS
* Then use "test-tool xhostname" in your tests, instead of "hostname".
You can run
$ git grep chmtime ':!t/*.sh"
to find places that needed to be touched when a similar internal tool "chmtime" was added.