Skip to content

Conversation

typeless
Copy link
Contributor

@typeless typeless 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
Copy link

codecov-io 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 This PR needs two approvals by maintainers to be considered for merging. 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
Copy link
Member

lunny commented Apr 2, 2019

@typeless could you add some tests?

@typeless typeless force-pushed the support-search-commits-by-author branch from 3059b38 to b346859 Compare April 2, 2019 07:45
@typeless
Copy link
Contributor Author

typeless commented Apr 2, 2019

The test does not work yet.

@typeless typeless force-pushed the support-search-commits-by-author branch 3 times, most recently from a722086 to a354319 Compare April 2, 2019 12:19
@typeless
Copy link
Contributor Author

typeless commented Apr 2, 2019

Added some basic tests.

@typeless typeless force-pushed the support-search-commits-by-author branch 2 times, most recently from b15121a to d8e9be0 Compare April 3, 2019 01:54
@typeless
Copy link
Contributor Author

typeless 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
Copy link
Contributor

@zeripath zeripath left a comment

Choose a reason for hiding this comment

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

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

@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Apr 6, 2019
@zeripath zeripath added this to the 1.9.0 milestone Apr 6, 2019
@zeripath zeripath added the topic/ui Change the appearance of the Gitea UI label Apr 6, 2019
typeless added 8 commits April 8, 2019 16:50
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
I have no idea about how to format it with line breaks.
@typeless typeless force-pushed the support-search-commits-by-author branch from e64e61d to c8753e1 Compare April 8, 2019 08:54
@typeless
Copy link
Contributor Author

typeless commented Apr 8, 2019

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

@typeless
Copy link
Contributor Author

typeless commented Apr 8, 2019

Fixed.

@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Apr 11, 2019
@lunny lunny added type/changelog Adds the changelog for a new Gitea version type/enhancement An improvement of existing functionality and removed topic/ui Change the appearance of the Gitea UI labels Apr 11, 2019
@lunny
Copy link
Member

lunny commented Apr 11, 2019

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

@typeless
Copy link
Contributor Author

typeless commented Apr 11, 2019

@lunny okay, thanks.

@lunny lunny merged commit 3186ef5 into go-gitea:master Apr 12, 2019
@go-gitea go-gitea locked and limited conversation to collaborators Nov 24, 2020
@delvh delvh removed the type/changelog Adds the changelog for a new Gitea version label Oct 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. type/enhancement An improvement of existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants