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

Merged
merged 6 commits into from
Jun 13, 2024
Merged

Improve commit message #934

merged 6 commits into from
Jun 13, 2024

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 missing coverage. Please review.

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

Current head f05407b differs from pull request most recent head 6441bfb

Please upload reports for the commit 6441bfb 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. 😊

Copy link
Contributor

Choose a reason for hiding this comment

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

Pushed a small commit which:

@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
@thachlp thachlp closed this Jun 11, 2024
@minwoox minwoox reopened this Jun 12, 2024
@minwoox
Copy link
Member

minwoox commented Jun 12, 2024

@ikhoon, @jrhee17 Gentle ping. 😉

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.

👍 👍 👍

Copy link
Contributor

@ikhoon ikhoon left a comment

Choose a reason for hiding this comment

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

Thanks!

@minwoox minwoox added this to the 0.66.0 milestone Jun 13, 2024
@minwoox minwoox merged commit 138eb29 into line:main Jun 13, 2024
10 checks passed
@minwoox
Copy link
Member

minwoox commented Jun 13, 2024

Thanks a lot, @thachlp! 😄

@thachlp
Copy link
Member Author

thachlp commented Jun 13, 2024

Thanks a lot, @thachlp! 😄

Thanks @minwoox @ikhoon @jrhee17

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