Skip to content
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

Experiments with wrapping git CLI command with CliWrap #243

Closed
wants to merge 34 commits into from

Conversation

mscottford
Copy link
Member

We've had some challenges with libgit2sharp. This experiment is trying to evaluate the feasibility of breaking our dependency with that package and instead, just using the git CLI to get the information that we need.

@mscottford mscottford self-assigned this Feb 19, 2021
RepositoryRoot = repositoryRoot;
}

public Dictionary<DateTime, string> LogEntriesFor(string path) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method LogEntriesFor has 30 lines of code (exceeds 25 allowed). Consider refactoring.

This includes some logic to retry the HTTP request for the .atom xml file. The retry uses a logarithmic backoff starting at 100ms, and attempts to retry 5 times before giving up.
@mrbiggred
Copy link
Contributor

@mscottford if I understand correctly removing the libgit2sharp library will require any consumers of this NuGet package to have Git installed. Is that extra step, requiring Git to be installed in a path the NuGet package can find, easier then the trouble we are having with libgit2sharp?

What are the issues we are having with libgit2sharp?

@mscottford
Copy link
Member Author

@mscottford if I understand correctly removing the libgit2sharp library will require any consumers of this NuGet package to have Git installed. Is that extra step, requiring Git to be installed in a path the NuGet package can find, easier then the trouble we are having with libgit2sharp?

Yes, the git executable would need to be accessible via PATH. We could also support reading an environment variable to point to the location of the git executable if it's not found in the path. We could throw a friendly exception that details that as a requirement. We would probably also want to do some experiments to determine which versions of git we could support. For that we could run a git specific integration test in a variety of git version in CI. That could be accomplished using the build matrix support in GitHub Actions. I found a good blog post that details how to those work. https://ncorti.com/blog/howto-github-actions-build-matrix

What are the issues we are having with libgit2sharp?

Good question.

First up, support for this package is waning and there is a need for additional maintainers (see: libgit2/libgit2sharp#1834). I don't feel like we have the resources that would be needed to get involved, and behavior that we need from the library is rather limited.

We've also logged some past issues with this library in the past.

Next up are some comments that I've seen while reading through the project's issues.

RepositoryRoot = repositoryRoot;
}

public Dictionary<DateTimeOffset, string> LogEntriesFor(string path) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Method LogEntriesFor has 30 lines of code (exceeds 25 allowed). Consider refactoring.

@codeclimate
Copy link

codeclimate bot commented Mar 8, 2021

Code Climate has analyzed commit d84d05b and detected 2 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 2

View more on Code Climate.

@mrbiggred mrbiggred linked an issue Mar 15, 2021 that may be closed by this pull request
mscottford and others added 8 commits March 19, 2021 14:39
There was a bug where that was causing the start of the date range to be older than the oldest revision in the file history. Meaning that the file would not have existed at the start of the date range that was being used for analysis. This changes the logic so that the oldest file date is always the starting point of the range, and then range is built in one month increments starting with the start of the month that immediately follows the creation of the first file in the history.
The logic was starting with the oldest file and then incrementing one month at a time from there. The timezone of that value might not match the timezone that has been passed in via `asOf`. With this change, we assume that the caller wants the results to be in the same timezone offset that's specified in the `asOf` value. Before this change, all results would have been in the timezone of that first commit.
@mscottford
Copy link
Member Author

This train-wreck of a monster pull-request is ready for review. At the moment, the class that wraps the git cli command is included, but it is not being used by the GitFileHistory class. So, if this were merged in today, then it would essentially just implement the switch to using DateTimeOffset everywhere.

Since this is such a mess, one option is to break it up into smaller pull requests that can be evaluated easier. Or we can just move forward and accept the messiness in the commit history.

Copy link

@codeclimate codeclimate bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PR diff size of 47641 lines exceeds the maximum allowed for the inline comments feature.

@codeclimate
Copy link

codeclimate bot commented Mar 26, 2021

Code Climate has analyzed commit e85b623 and detected 36 issues on this pull request.

Here's the issue category breakdown:

Category Count
Complexity 8
Duplication 28

The test coverage on the diff in this pull request is 92.6% (50% is the threshold).

This pull request will bring the total coverage in the repository to 92.0% (1.5% change).

View more on Code Climate.

@mscottford
Copy link
Member Author

This work is being abandoned in favor of the approach taken in the Freshli-CLI project.

@mscottford mscottford closed this Sep 8, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Sep 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants