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

Clarify search by changes vs. changed lines #730

Closed
borekb opened this issue Apr 30, 2019 · 4 comments

Comments

Projects
None yet
2 participants
@borekb
Copy link

commented Apr 30, 2019

Just from the title / tooltip of the actions, it's not clear what's the difference between the two:

Screenshot 2019-04-30 at 15 13 24

This is what they do:

case GitRepoSearchBy.ChangedLines:
searchArgs = ['-M', '--all', '--full-history', '-E', '-i', `-G${search}`];
break;
case GitRepoSearchBy.Changes:
searchArgs = ['-M', '--all', '--full-history', '-E', '-i', '--pickaxe-regex', `-S${search}`];
break;

The harder part is how to explain the difference 😄 This StackOverflow answer is quite nice.

In GitLens' UI, it would at least be useful to add this:

  • or, by changes (-G)
  • or, by changed lines (-S)

Suggestion for respective tooltips:

  • "Show commits whose diffs contain the pattern"
  • "Show commits that add or delete the pattern"
@borekb

This comment has been minimized.

Copy link
Author

commented Apr 30, 2019

If there would be way to link to that SO answer or any other similar resource that contains an example, that would be very useful as well. I always have to google it 😄.

@eamodio eamodio self-assigned this Apr 30, 2019

@eamodio eamodio added this to the Soon™ milestone Apr 30, 2019

@eamodio

This comment has been minimized.

Copy link
Owner

commented May 1, 2019

@borekb I'm very tempted to just remove the -S variant as having 2 is quite confusing and the -G version is much more likely what people would expect. Also even the git docs say that -S is Intended for the scripter’s use: https://git-scm.com/docs/git-log#Documentation/git-log.txt--Sltstringgt

Thoughts?

@borekb

This comment has been minimized.

Copy link
Author

commented May 2, 2019

I generally agree, however, I just had a situation where I needed to look for instances of a string that was removed from code, so "changed lines" is what I needed to use.

Still, I think you're right and that for the most part, having two very similar options is not worth it. If you could think of a way to hint at the other option, maybe hide it in the "..." menu as an advanced option or something, that would probably be best but if that feels too cumbersome, I'm fine with keeping just the -G option.

@borekb

This comment has been minimized.

Copy link
Author

commented May 2, 2019

BTW, looking at my original post, is the current code even correct? GitRepoSearchBy.Changes uses '--pickaxe-regex -S while GitRepoSearchBy.ChangedLines uses -G; shouldn't it be the other way around?

@eamodio eamodio closed this in 3e8603b May 6, 2019

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.