-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
fix: fetch revision only then fallback to default refspec #5605
Conversation
Error messages
|
If performance is a concern, we can add an explicit setting for each repository. |
Any comments? @alexmt |
Codecov Report
@@ Coverage Diff @@
## master #5605 +/- ##
==========================================
- Coverage 41.93% 41.91% -0.02%
==========================================
Files 176 176
Lines 22992 22992
==========================================
- Hits 9641 9637 -4
- Misses 11966 11972 +6
+ Partials 1385 1383 -2
Continue to review full report at Codecov.
|
Sorry, PR slip off radar. |
@alexmt apologies if a faux pas, but do you have an ETA on this one? Just wanted to make sure this didn't fall through the cracks again due to the holidays. |
Flake? The failure seems not related to the change.
|
Failed on the same case
Is the |
reposerver/repository/repository.go
Outdated
err = gitClient.Fetch(revision) | ||
|
||
if err != nil { | ||
log.Warnf("Failed to fetch revision %s: %v", revision, err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please change it to log.Info
. We are trying to use 'warning' logs only for something that the operator should act on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
util/git/client.go
Outdated
@@ -335,7 +335,7 @@ func (m *nativeGitClient) Fetch(revision string) error { | |||
|
|||
var err error | |||
if revision != "" { | |||
err = m.runCredentialedCmd("git", "fetch", "origin", revision, "--tags", "--force") | |||
err = m.runCredentialedCmd("git", "fetch", "origin", revision) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you please clarify why this change is necessary? Can we rollback this line please unless it is really needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to fetch tags on explicit revision. This reduce a bit the pack size on large repository with many tags.
Feel free to revert the change though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good. Reverted this change. The rest looks good! Merging once CI is green.
Ignoring commit SHA breaks gerrit when the commit is not merged Signed-off-by: Yujun Zhang <yujunz@nvidia.com>
Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com>
) * fix: fallback to fetch default only on error Ignoring commit SHA breaks gerrit when the commit is not merged Signed-off-by: Yujun Zhang <yujunz@nvidia.com> * revert util/git/client.go changes Signed-off-by: Alexander Matyushentsev <AMatyushentsev@gmail.com> Co-authored-by: Alexander Matyushentsev <AMatyushentsev@gmail.com> Signed-off-by: pashavictorovich <pavel@codefresh.io>
@yujunz can you expand on this? I'm observing performance issues (lots of large packfiles) for some repos. But I don't know enough about git to understand why this happens. |
Not sure what kind of pack files from your repository. This patch mainly reduces the total refs to fetch. It is not helping when the repository has many large files or long commit history. |
Fixes #4935