-
Notifications
You must be signed in to change notification settings - Fork 144
feat: log: search changes #523
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
Open
PRESFIL
wants to merge
1
commit into
altsem:master
Choose a base branch
from
PRESFIL:feat-log-search-changes
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| use super::*; | ||
|
|
||
| fn setup(ctx: TestContext) -> TestContext { | ||
| commit(&ctx.dir, "first", "third"); | ||
| commit(&ctx.dir, "first", "second"); | ||
| commit(&ctx.dir, "first", "first"); | ||
| ctx | ||
| } | ||
|
|
||
| #[test] | ||
| fn grep_changes_prompt() { | ||
| snapshot!(setup(setup_clone!()), "l-G"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn grep_changes_set_example() { | ||
| snapshot!(setup(setup_clone!()), "l-Gexample<enter>"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn grep_changes_second() { | ||
| snapshot!(setup(setup_clone!()), "l-Gsecond<enter>l"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn grep_changes_no_match() { | ||
| snapshot!(setup(setup_clone!()), "l-Gdoesntexist<enter>l"); | ||
| } | ||
|
|
||
| #[test] | ||
| fn grep_changes_second_other() { | ||
| snapshot!(setup(setup_clone!()), "l-Gsecond<enter>omain<enter>"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ mod discard; | |
| mod editor; | ||
| mod fetch; | ||
| mod log; | ||
| mod log_grep_changes; | ||
| mod merge; | ||
| mod pull; | ||
| mod push; | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/tests/snapshots/gitu__tests__log_grep_changes__grep_changes_no_match.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| source: src/tests/log_grep_changes.rs | ||
| expression: ctx.redact_buffer() | ||
| --- | ||
| ▌No commits found | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| styles_hash: 90ecdf643519e051 |
25 changes: 25 additions & 0 deletions
25
src/tests/snapshots/gitu__tests__log_grep_changes__grep_changes_prompt.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| source: src/tests/log_grep_changes.rs | ||
| expression: ctx.redact_buffer() | ||
| --- | ||
| ▌On branch main | | ||
| ▌Your branch is ahead of 'origin/main' by 3 commit(s). | | ||
| | | ||
| Recent commits | | ||
| a7fb92e main modify first | | ||
| eb42c24 modify first | | ||
| a086849 add first | | ||
| b66a0bf origin/main add initial-file | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| ────────────────────────────────────────────────────────────────────────────────| | ||
| Log Arguments | | ||
| l current -F Search messages (--grep) | | ||
| o other -G Search changes (-G) | | ||
| q/esc Quit/Close -n Limit number of commits (-n=256) | | ||
| ────────────────────────────────────────────────────────────────────────────────| | ||
| ? Search changes: › █ | | ||
| styles_hash: f31db5867a2f6c5d |
25 changes: 25 additions & 0 deletions
25
src/tests/snapshots/gitu__tests__log_grep_changes__grep_changes_second.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| source: src/tests/log_grep_changes.rs | ||
| expression: ctx.redact_buffer() | ||
| --- | ||
| ▌a7fb92e main modify first | | ||
| eb42c24 modify first | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| styles_hash: a908290abddd40c9 |
25 changes: 25 additions & 0 deletions
25
src/tests/snapshots/gitu__tests__log_grep_changes__grep_changes_second_other.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| source: src/tests/log_grep_changes.rs | ||
| expression: ctx.redact_buffer() | ||
| --- | ||
| ▌a7fb92e main modify first | | ||
| eb42c24 modify first | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| styles_hash: a908290abddd40c9 |
25 changes: 25 additions & 0 deletions
25
src/tests/snapshots/gitu__tests__log_grep_changes__grep_changes_set_example.snap
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| source: src/tests/log_grep_changes.rs | ||
| expression: ctx.redact_buffer() | ||
| --- | ||
| ▌On branch main | | ||
| ▌Your branch is ahead of 'origin/main' by 3 commit(s). | | ||
| | | ||
| Recent commits | | ||
| a7fb92e main modify first | | ||
| eb42c24 modify first | | ||
| a086849 add first | | ||
| b66a0bf origin/main add initial-file | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| | | ||
| ────────────────────────────────────────────────────────────────────────────────| | ||
| Log Arguments | | ||
| l current -F Search messages (--grep) | | ||
| o other -G Search changes (-G=example) | | ||
| q/esc Quit/Close -n Limit number of commits (-n=256) | | ||
| styles_hash: 835226a0c290291d |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I reckon this becomes quite expensive, diffing each commit to the previous. It does take a few seconds to complete a search for me in the Gitu repo with a release-build.
I've been replacing other parts of (lib)git2 uses with simply command forks.
git log --oneline --grep 'test'might do the job. Perhaps there's a lower-level, more stable command thangit log --grepthat is more suitable for scripting (aka plumbing-command). Would require some rework.