Description
At the moment GitSheets has to be run against an initialised git directory with at least one commit made, so we have a bunch of git commit -m 'init' --allow-empty
in tests/docs/etc. I believe the reason it requires at least one commit is that hologit/Repo's getFromEnvironment
static method is running git rev-parse --verify HEAD
(see here).
According to @themightychris:
There's a wrapper for that in Git or Hologit that provides for just returning null instead of throwing an exception for cases where potential nonexistense is anticipated
We should use that call instead, and I'm leaning towards it being best to generate an initialization commit rather than just start a new chain from an import with no parent
Link. use theRepo
class to "open" the repo ^ that will let you instantiate it with a selected ref. instead of hardcoding HEAD everywhere.
To which I replied:
in other words
Repo.createFromEnvironment({ ref: await resolveRef() })
?
won't it resolve to null and we're in the same situation?