I remembered about this after seeing a note about this in the CI:
>> Verifying initializing a new Pants project works
hint: Using 'master' as the name for the initial branch. This default branch name
hint: will change to "main" in Git 3.0. To configure the initial branch name
hint: to use in all of your new repositories, which will suppress this warning,
hint: call:
hint:
hint: git config --global init.defaultBranch <name>
hint:
hint: Names commonly chosen instead of 'master' are 'main', 'trunk' and
hint: 'development'. The just-created branch can be renamed via this command:
hint:
hint: git branch -m <name>
hint:
hint: Disable this message with "git config set advice.defaultBranchName false"
This ticket might be better stated as trying to determine if we can remove some copy/paste from within our tests related to test setup.
In reality, I don't think that matters too much - but I think for the most part, if we can avoid cloning in favour of in-repo files - I think we should. There is a lot of test setup and logging cruft for maintainers to read through, which doesn't add much value being inline in the test vs out-of-band somewhere. This goes against locality of behaviour, but I'm sure there is a nice tradeoff somewhere.
The exception for the git comment might be the source builds - but even for those, we can download and unpack a zip with an expected SHA/size (though, is there any real value in this step vs git anyways? 🤷🏽). Alternatively, if we rely on certain git locations, they could also be submodules in the repo. It could help avoid comments like:
// We must pass a full sha to use the shallow fetch trick.
I think this could also help avoid the case where we hardcode a git apply patch into a test - which just feels wrong for some reason.
I don't think this will appreciably change the test duration, but I think it will streamline the test code a little bit. I'll PR a change and just see how it feels.
I remembered about this after seeing a note about this in the CI:
This ticket might be better stated as trying to determine if we can remove some copy/paste from within our tests related to test setup.
In reality, I don't think that matters too much - but I think for the most part, if we can avoid cloning in favour of in-repo files - I think we should. There is a lot of test setup and logging cruft for maintainers to read through, which doesn't add much value being inline in the test vs out-of-band somewhere. This goes against locality of behaviour, but I'm sure there is a nice tradeoff somewhere.
The exception for the git comment might be the source builds - but even for those, we can download and unpack a zip with an expected SHA/size (though, is there any real value in this step vs git anyways? 🤷🏽). Alternatively, if we rely on certain git locations, they could also be submodules in the repo. It could help avoid comments like:
I think this could also help avoid the case where we hardcode a
git apply patchinto a test - which just feels wrong for some reason.I don't think this will appreciably change the test duration, but I think it will streamline the test code a little bit. I'll PR a change and just see how it feels.