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

Improve commit message #934

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open

Improve commit message #934

wants to merge 5 commits into from

Conversation

thachlp
Copy link
Member

@thachlp thachlp commented Mar 13, 2024

Motivation

When unspecified a branch name on mirroring setup, the message show with #null, we should omit #null when using the default branch to avoid confuse.

Result
Close: #933

Copy link

codecov bot commented Mar 13, 2024

Codecov Report

Attention: Patch coverage is 42.85714% with 4 lines in your changes are missing coverage. Please review.

Project coverage is 66.80%. Comparing base (aae194c) to head (f05407b).
Report is 11 commits behind head on main.

❗ Current head f05407b differs from pull request most recent head 804b8c9. Consider uploading reports for the commit 804b8c9 to get more accurate results

Files Patch % Lines
...ogma/server/internal/mirror/AbstractGitMirror.java 42.85% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main     #934      +/-   ##
============================================
- Coverage     66.86%   66.80%   -0.06%     
+ Complexity     3529     3517      -12     
============================================
  Files           370      370              
  Lines         14531    14482      -49     
  Branches       1563     1554       -9     
============================================
- Hits           9716     9675      -41     
+ Misses         3936     3931       -5     
+ Partials        879      876       -3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Co-authored-by: Ikhun Um <ih.pert@gmail.com>
Copy link
Contributor

@jrhee17 jrhee17 left a comment

Choose a reason for hiding this comment

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

Would it also be possible to add a test case?

@@ -257,7 +257,8 @@ void mirrorRemoteToLocal(
changes.put(mirrorStatePath, Change.ofJsonUpsert(
mirrorStatePath, "{ \"sourceRevision\": \"" + headCommitId.name() + "\" }"));
// Construct the log message and log.
summary = "Mirror " + abbrId + ", " + remoteRepoUri() + '#' + remoteBranch() +
summary = "Mirror " + abbrId + ", " + remoteRepoUri() +
(remoteBranch() != null ? '#' + remoteBranch() : "") +
Copy link
Contributor

Choose a reason for hiding this comment

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

Question) In this case, the head branch exists but the user just didn't specify the remote branch.
Would it make sense to use headBranchRef instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @jrhee17, this is just removing #null in the message in case the user doesn't specify the branch.
image

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, but isn't a branch still used?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jrhee17 agree, we use headBranchRef will be more clear. Please check my latest commit 🙇

Copy link
Member

@minwoox minwoox left a comment

Choose a reason for hiding this comment

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

Just one comment. Thanks!

if (headBranchRef.getName().startsWith(Constants.R_HEADS)) {
return headBranchRef.getName().substring(Constants.R_HEADS.length());
}
return "";
Copy link
Member

Choose a reason for hiding this comment

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

Let's just return headBranchRef.getName() because Miiror abbrId, remote-uri# to the repository is a bit awkward.

Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @minwoox, you mean line 734 🤔

Copy link
Member

Choose a reason for hiding this comment

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

Yes. 😊

@thachlp thachlp requested a review from ikhoon May 14, 2024 08:25
@thachlp
Copy link
Member Author

thachlp commented May 14, 2024

Would it also be possible to add a test case?

@jrhee17 Just update some test case to cover the case that having remoteBranch, please help review

@thachlp thachlp requested a review from jrhee17 May 14, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remote branch show null when unspecified
4 participants