-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduced sha256 support for git-sizer #109
Conversation
fcharlie
commented
Apr 17, 2023
The name `gitDir` is less ambiguous. Also rename method `Path()` to `GitDir()`.
Add a method `Repository.GitPath(relPath)`, which invokes `git rev-parse --git-path $relPath` to find the path to a file within the Git repository. In `NewRepository()`, instantiate the `Repository` object earlier so that the new method can be used to find the path to `shallow`.
Extract a method to determine whether the repository seems to be a full clone. Call it from `NewRepository()`.
If you already have the desired `GIT_DIR`, there's no need to determine it from the current path.
There's no need to deduce the `GIT_DIR` for a bare repository.
As of Git v2.38.0, there is an option to prevent Git from accessing bare repositories unless asked for explicitly (via `--git-dir` or `GIT_DIR`): `safe.bareRepository`. The tests of `git sizer`, however, assume that Git will access a bare repository when the current directory points inside that repository. This only works if `safe.bareRepository` indicates that this is safe. If that is not the case, i.e. if `safe.bareRepository` is set to `explicit`, Git demands that the environment variable `GIT_DIR` is set (either explicitly, or via `--git-dir`) when accessing bare repositories. So let's set `GIT_DIR` for the test cases that work on bare repositories. Signed-off-by: Johannes Schindelin <[email protected]>
This is the result of running `go fmt -mod=readonly ./...`
e8687bb
to
57a0a57
Compare
Signed-off-by: Johannes Schindelin <[email protected]>
57a0a57
to
0fc1aa3
Compare
@fcharlie I rebased this onto #117 to resolve merge conflicts, and also changed a few things on the way (please double-check!):
Here is the range-diff
|
@dscho Great job, I used in-house tools to convert git-sizer to a sha256 repository, then ran a git-sizer scan and everything worked. |