-
Notifications
You must be signed in to change notification settings - Fork 117
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
Conversation
Codecov ReportAttention: Patch coverage is
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. |
...or-git/src/main/java/com/linecorp/centraldogma/server/internal/mirror/AbstractGitMirror.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Ikhun Um <ih.pert@gmail.com>
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.
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() : "") + |
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.
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?
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.
Hi @jrhee17, this is just removing #null
in the message in case the user doesn't specify the branch.
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.
Sure, but isn't a branch still used?
Line 175 in 20772a8
final Ref headBranchRef = getHeadBranchRef(git); |
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.
@jrhee17 agree, we use headBranchRef
will be more clear. Please check my latest commit 🙇
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.
Just one comment. Thanks!
if (headBranchRef.getName().startsWith(Constants.R_HEADS)) { | ||
return headBranchRef.getName().substring(Constants.R_HEADS.length()); | ||
} | ||
return ""; |
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.
Let's just return headBranchRef.getName()
because Miiror abbrId, remote-uri# to the repository
is a bit awkward.
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.
Hi @minwoox, you mean line 734 🤔
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.
Yes. 😊
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.
Pushed a small commit which:
- Address this comment: Improve commit message #934 (comment)
- Add single quotes around the
remoteUri#branchName
@jrhee17 Just update some test case to cover the case that having |
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.
👍 👍 👍
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.
Thanks!
Thanks a lot, @thachlp! 😄 |
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