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

Support search operators for commits search #6479

Merged
merged 15 commits into from Apr 12, 2019

Conversation

@typeless
Copy link
Contributor

commented Apr 1, 2019

For now, support auther:, committer:, after: and before:,
When more than one prefix is supplied, the result is the union.
When different prefixes are supplied, the result is the intersection.

For example,
"author:alice author:bob"
=> the result is all commits authored by Alice OR Bob

"hello committer:alice after:2019-03-05 before:2019-03-10"
=> the result is all commits committed by Alice AND has the keyword during 2019-03-05~2019-03-10.
'hello' in the message.

Essentially, this is a wrapper for git log with the support of --grep, --author, --committer, --after, and --before options.

Note that there should NOT have any space after the colon(:) of the prefix.
For example,
"author:bill" => correct
"author: bill" => wrong

@codecov-io

This comment has been minimized.

Copy link

commented Apr 1, 2019

Codecov Report

Merging #6479 into master will increase coverage by 0.12%.
The diff coverage is 96.29%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6479      +/-   ##
==========================================
+ Coverage   40.35%   40.48%   +0.12%     
==========================================
  Files         405      405              
  Lines       54277    54320      +43     
==========================================
+ Hits        21904    21989      +85     
+ Misses      29356    29312      -44     
- Partials     3017     3019       +2
Impacted Files Coverage Δ
modules/git/commit.go 44.69% <100%> (+7.87%) ⬆️
routers/repo/commit.go 24.79% <83.33%> (+8.53%) ⬆️
modules/git/repo_commit.go 52.21% <95.23%> (+4.58%) ⬆️
routers/repo/view.go 42.07% <0%> (+0.99%) ⬆️
models/repo_list.go 67.89% <0%> (+1.05%) ⬆️
modules/log/event.go 65.98% <0%> (+1.52%) ⬆️
models/repo_indexer.go 60.59% <0%> (+2.54%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1b7dffc...43fb1e4. Read the comment docs.

@GiteaBot GiteaBot added the lgtm/need 2 label Apr 1, 2019

@typeless typeless changed the title Support searching commits with prefix syntax Support commits search with prefix syntax Apr 2, 2019

@lunny

This comment has been minimized.

Copy link
Member

commented Apr 2, 2019

@typeless could you add some tests?

@typeless typeless force-pushed the typeless:support-search-commits-by-author branch from 3059b38 to b346859 Apr 2, 2019

@typeless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 2, 2019

The test does not work yet.

@typeless typeless force-pushed the typeless:support-search-commits-by-author branch 3 times, most recently from a722086 to a354319 Apr 2, 2019

@typeless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 2, 2019

Added some basic tests.

@typeless typeless force-pushed the typeless:support-search-commits-by-author branch 2 times, most recently from b15121a to d8e9be0 Apr 3, 2019

@typeless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 3, 2019

All tests passed. It is ready for review.

@typeless typeless changed the title Support commits search with prefix syntax Support search operators for commits search Apr 3, 2019

@zeripath
Copy link
Contributor

left a comment

Recommend making an options struct at the git module level. Otherwise lgtm

Show resolved Hide resolved modules/git/commit.go Outdated

@GiteaBot GiteaBot added lgtm/need 1 and removed lgtm/need 2 labels Apr 6, 2019

@zeripath zeripath added this to the 1.9.0 milestone Apr 6, 2019

@zeripath zeripath added the kind/ui label Apr 6, 2019

typeless added some commits Apr 1, 2019

Support searching commits with prefix syntax
For now, support auther: committer:
When more than one prefix is supplied is presented, the result is the union.
When different prefixes are supplied, the result is the intersection.

For example,
"author:alice author:bob"
=> the result is all commits authored by Alice OR Bob

"hello committer:alice"
=> the result is all commits committed by Alice AND has the keyword
'hello' in the message.

Note that there should NOT have any space after the colon(:) of the prefix.
For example,
"author:bill" => correct
"author: bill" => wrong
Update tooltip text
I have no idea about how to format it with line breaks.

@typeless typeless force-pushed the typeless:support-search-commits-by-author branch from e64e61d to c8753e1 Apr 8, 2019

@typeless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 8, 2019

Hold on, I accidentally git push -f an old commit. :(
I am going to recover it.

@typeless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 8, 2019

Fixed.

Show resolved Hide resolved modules/git/repo_commit.go Outdated

@GiteaBot GiteaBot added lgtm/done and removed lgtm/need 1 labels Apr 11, 2019

@sapk

sapk approved these changes Apr 11, 2019

Show resolved Hide resolved routers/repo/commit.go Outdated
@lunny

This comment has been minimized.

Copy link
Member

commented Apr 11, 2019

@typeless thanks for your PR. My comment is not a block that could be another PR.

@typeless

This comment has been minimized.

Copy link
Contributor Author

commented Apr 11, 2019

@lunny okay, thanks.

Mura Li
@lunny

lunny approved these changes Apr 11, 2019

lunny added some commits Apr 11, 2019

@lunny lunny merged commit 3186ef5 into go-gitea:master Apr 12, 2019

2 checks passed

approvals/lgtm this commit looks good
continuous-integration/drone/pr Build is passing
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.