On 11/3/24 18:39, Junio C Hamano wrote: > Ignacio Encinas Rubio <ignacio@xxxxxxxxxxxx> 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 Great! I hadn't noticed "test-tool". Just to double-check, what name do we want to use for this? xhostname, hostname, xgethostname, gethostname? If I didn't miss something, the only place the test use hostname is in $ git grep '$(hostname' t/ t/t6500-gc.sh: hostname=$(hostname || echo unknown) && as you previously pointed out. So my plan is: 1. Extend test-tool, migrate t6500-gc.sh to test-tool xhostname(*) 2. Update my v2 to use "test-tool xhostname(*)" (*) or however we want to name it > * 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. Thank you very much for the pointers, they were very helpful!