-
Notifications
You must be signed in to change notification settings - Fork 119
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 history displays irrelevant changes #922
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #922 +/- ##
============================================
+ Coverage 66.78% 67.52% +0.74%
- Complexity 3513 3567 +54
============================================
Files 370 370
Lines 14476 14477 +1
Branches 1553 1553
============================================
+ Hits 9668 9776 +108
+ Misses 3929 3821 -108
- Partials 879 880 +1 ☔ View full report in Codecov by Sentry. |
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! Could you add some tests, please? 😉
Could you also check if |
Ok, let me check |
Sure, let me try. |
final AggregatedHttpResponse userInfo = client.get("/api/v0/users/me").aggregate().join(); | ||
final JsonNode jsonNode = Jackson.readTree(userInfo.contentUtf8()); | ||
assertThat(jsonNode.get("login").asText()).isEqualTo("[email protected]"); | ||
} |
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.
@minwoox here, I try to add tests for the class RepositoryServiceTest, but it always returns 404 for /api/v0
(I try users/me
to make sure I am correct ^^)
Do you know how to start the /api/v0
dogma for the test?
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.
It's activated only when the webAppEnabled
is true
.
centraldogma/server/src/main/java/com/linecorp/centraldogma/server/CentralDogma.java
Line 782 in c7450c5
if (cfg.isWebAppEnabled()) { |
Line 69 in 7152873
builder.webAppEnabled(true); |
By the way, could you tell me why you need to retrieve the user information?
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 @minwoox, I can call /api/v0
now.
I just do the simplest test with api/v0
to explain to you my problem 🤩
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 for the initiative! Left a high-level review before going into details 🙇
@@ -177,10 +177,11 @@ public CompletionStage<List<CommitDto>> getHistory(@Param String projectName, | |||
@Param String path, | |||
@Param @Default("-1") String from, | |||
@Param @Default("1") String to) { | |||
final String pathPattern = "/".equals(path) ? "/**" : path + "/**"; |
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.
The other APIs we have (e.g. watch*, diff*) don't add a slash
at the end.
For consistency, I think it would be better that all APIs that accept a pathPattern
have the same behavior.
Also, I think it is perfectly valid to watch /a**
depending on the use-case.
Question) What do you think of fixing this issue from the client side 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.
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.
Sorry about the late reply. Yeah, I also thought we should fix the UI (which is the client) to call the path correctly when I first created the issue.
We should let users retrieve whatever history they want so I think we should touch it on the server-side.
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.
Sound good @minwoox, could you provide me the screenshot to explain expected from client? I am happy to finish this 🚀
Motivate:
The history of a directory includes changes in directories share the name. For instance: the history of
/foo
displays changes for/foo2
,/foo3
,/foobar
...Modifications:
Add a slash
(/)
before**
in the path(path + "/**")
. The patternfoo/**
matches/foo/anything
,/foo/subdir/file
, but it does not match anything that isn't a subpath of/foo
.Result
Fixes #902