Skip to content

Conversation

@eyalk007
Copy link
Contributor

@eyalk007 eyalk007 commented Aug 3, 2025

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • I used go fmt ./... for formatting the code before submitting the pull request.
  • This feature is included on all supported VCS providers - GitHub, Bitbucket cloud, Bitbucket server, GitLab and Azure Repos.
  • I added the relevant documentation for the new feature.

Optimized file commits: Single files use Contents API, multiple files use Git API with parallel blob creation
Added concurrent processing for multi-file operations by using createBlobsInParallel()
Fixed nil pointer crash in CreateBranch method by switching from GetBranch() to GetRef() API and adding null checks

- Fix nil pointer dereference in CreateBranch method by adding proper null checks for sourceBranchRef and sourceBranchRef.Object
- Fix TestGitHubClient_CreateBranch by using proper github.Reference mock instead of github.Branch
- Fix TestGitHubClient_CommitAndPushFiles by adding second file to trigger multi-file commit path that matches test expectations
@eyalk007 eyalk007 self-assigned this Aug 3, 2025
@eyalk007 eyalk007 added the improvement Automatically generated release notes label Aug 3, 2025
Message: &commitMessage,
Content: []byte(encodedContent),
Branch: &branch,
Author: &github.CommitAuthor{
Copy link
Contributor

Choose a reason for hiding this comment

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

so both for author and committer we are using author?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In Git, there are two distinct roles for a commit:

  1. Author - The person who originally wrote the code/content
  2. Committer - The person who actually committed the code to the repository

While these are often the same person (as in your code example where both use the same values), they serve different purposes:

  • The author represents who created the content
  • The committer represents who added it to the repository

You need both because:

  1. Git's data model tracks these separately
  2. In collaborative workflows, they might be different people (e.g., someone submits code that another person reviews and commits)
  3. Setting both ensures proper attribution in the commit history
  4. It maintains consistency with standard Git behavior

Even when they're the same person, explicitly setting both fields ensures predictable behavior when interacting with GitHub's API.

Content: github.String(f.Content),
Encoding: github.String("utf-8"),
})
if err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we continuing after we get an error?
i also see in the next loop that :
if result.err != nil {
close(blobChan)
return nil, fmt.Errorf("failed to create blob for %s: %w", result.file.Path, result.err)
}
so why it is not being stopped in the first iteration?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed

as concurrent creates race conditions
@github-actions
Copy link
Contributor

github-actions bot commented Aug 5, 2025

👍 Frogbot scanned this pull request and did not find any new security issues.


@eyalk007 eyalk007 merged commit 20cf07a into jfrog:master Aug 6, 2025
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants