mhutchie / vscode-git-graph

View a Git Graph of your repository in Visual Studio Code, and easily perform Git actions from the graph.
https://marketplace.visualstudio.com/items?itemName=mhutchie.git-graph
Other
1.97k stars 260 forks source link

allow searching in different column #375

Open wingliu0 opened 4 years ago

wingliu0 commented 4 years ago

Describe the feature that you'd like The current find widget will search the description, date, author and commit hash. It would be great if we can configure the column being searched in setting

mhutchie commented 4 years ago

Hi @wingliu0,

Thanks for raising this feature request, I definitely think it would be a valuable feature to have in Git Graph.

bmagyarkuti commented 3 years ago

Hi @mhutchie,

Just wondering what you had in mind for this. I have a personal use case that would just require a subset of this feature, searching in a commit's body (a different poster mentions this same feature in a comment under #147). I already have a spike implementation that works (I extended DataSource#getLog to also include the commit message). Do you think it'd make sense to just extend search so it always includes the commit body as well? Alternatively, would you rather have "commit body" as an optional column that users need to explicitly include in their search?

Best, Barna

mhutchie commented 3 years ago

Hi @bmagyarkuti,

For performance & parsing reliability reasons, I deliberately decided not to retrieve the entire commit body with DataSource.getLog.

bmagyarkuti commented 3 years ago

Hi @mhutchie, I thought you might have, and have reservations about performance myself (although I haven't done any performance testing, which I think I will). Did you have any ideas about how to do this well? Do you think this feature is a good candidate for me to try working on? If so, what do you imagine would be the simplest working version of the feature? For me, it is either: 1) By default, search also looks in the commit body. The implementation meets your performance goals and does not make parsing less stable than it is now. 2) Users can configure the fields they'd like to include in their search. For a minimal viable product, it's enough that users are able to enable / disable the inclusion of the commit body. The setting is globally applied to all searches, and can be made in the vscode settings ui / by editing the vscode settings JSON. Possible improvements include the addition of more fields, the possibility to turn off search for existing fields, and making it easier for users to change this setting for just a one-off search.

I also wanted to tell you about why I need to search in commit bodies. In each commit, we add a corresponding ticket to mark the user story that a commit contributes to. The ticket number is at the end of the commit message, so it gets pushed to the body. We do a code review for each story, and I need a way to quickly filter out just the commits that contributed to the story we're reviewing. (We could work around this by starting each commit with the ticket number, but I'd need to convince a lot of people for this, and not all of them are using vscode.)

mhutchie commented 3 years ago

Hi @bmagyarkuti,

For the reasons I mentioned yesterday, I don’t want to proceed with any variation of including searching the entire commit body in the current Find Widget. When I first implemented it (over 1.5 years ago), I already worked through a variety of options but ultimately decided against it (for numerous reasons).

From what I’ve seen in many projects and companies, it’s very common for developers to put the issue / ticket number at the beginning of commit messages (it guarantees it’s always visible, no matter how much of the commit message is visible in various user interfaces). This also makes Git Graph’s Issue Linking feature really fast and convenient to use.

bmagyarkuti commented 3 years ago

Hi @mhutchie, I understand. Thanks for taking the time to explain your experience. Best, Barna