Skip to content

Conversation

maoyama
Copy link
Owner

@maoyama maoyama commented May 31, 2025

This pull request introduces enhancements to the GitClient module, focusing on improving search functionality and code organization. Key changes include adding support for searching commits by file or directory paths, refactoring GitLog to streamline argument handling, and simplifying the creation of GitLog instances in LogStore.

Search Functionality Enhancements:

  • Added support for path-based search: Introduced a new SearchKind case (path) to enable searching commits that modify specific file or directory paths. Updated SearchKind with labels and descriptions for the new search type. ([[1]](https://github.com/maoyama/Tempo/pull/153/files#diff-e2f1ffd385455ac9df914b5a077d257bdd4c9d0f9372541e625d70da74465f07L11-R11), [[2]](https://github.com/maoyama/Tempo/pull/153/files#diff-e2f1ffd385455ac9df914b5a077d257bdd4c9d0f9372541e625d70da74465f07R27-R28), [[3]](https://github.com/maoyama/Tempo/pull/153/files#diff-e2f1ffd385455ac9df914b5a077d257bdd4c9d0f9372541e625d70da74465f07R46-R47), [[4]](https://github.com/maoyama/Tempo/pull/153/files#diff-e2f1ffd385455ac9df914b5a077d257bdd4c9d0f9372541e625d70da74465f07R65-R66))
  • Updated search token handling: Modified SearchTokensHandler to include the new path search kind in token filtering logic. ([GitClient/Models/SearchTokensHandler.swiftL31-R76](https://github.com/maoyama/Tempo/pull/153/files#diff-f7bec91803b611b449f7c79471b9dadde937cf2beebc3b84d5f8b9988c1dd4abL31-R76))

Code Refactoring and Simplification:

  • Refactored GitLog arguments: Added a paths property to GitLog and adjusted argument handling to support path-based filtering. Moved the --topo-order argument to ensure proper ordering. ([[1]](https://github.com/maoyama/Tempo/pull/153/files#diff-37eff570e1f5e2291c5bd8370430f624c8ea799690b6965d120eb76bc4253fccR26-R27), [[2]](https://github.com/maoyama/Tempo/pull/153/files#diff-37eff570e1f5e2291c5bd8370430f624c8ea799690b6965d120eb76bc4253fccL57-R62), [[3]](https://github.com/maoyama/Tempo/pull/153/files#diff-37eff570e1f5e2291c5bd8370430f624c8ea799690b6965d120eb76bc4253fccR76))
  • Simplified LogStore logic: Created a helper method gitLog for constructing GitLog instances, reducing redundancy in multiple places where GitLog was instantiated. ([[1]](https://github.com/maoyama/Tempo/pull/153/files#diff-83d76bf6bb027587384a3aaad45adfe25c0b97840e863834478b4f9c90442522R54-R67), [[2]](https://github.com/maoyama/Tempo/pull/153/files#diff-83d76bf6bb027587384a3aaad45adfe25c0b97840e863834478b4f9c90442522L72-R90), [[3]](https://github.com/maoyama/Tempo/pull/153/files#diff-83d76bf6bb027587384a3aaad45adfe25c0b97840e863834478b4f9c90442522L89-R99), [[4]](https://github.com/maoyama/Tempo/pull/153/files#diff-83d76bf6bb027587384a3aaad45adfe25c0b97840e863834478b4f9c90442522L114-R123), [[5]](https://github.com/maoyama/Tempo/pull/153/files#diff-83d76bf6bb027587384a3aaad45adfe25c0b97840e863834478b4f9c90442522L170-R165), [[6]](https://github.com/maoyama/Tempo/pull/153/files#diff-83d76bf6bb027587384a3aaad45adfe25c0b97840e863834478b4f9c90442522L190-R179))

UI Improvements:

  • Enhanced search token picker: Updated the FolderView to display tooltips (help) for search token kinds, providing additional context for users. ([GitClient/Views/Folder/FolderView.swiftL94-R96](https://github.com/maoyama/Tempo/pull/153/files#diff-7c23e0932cd90b6072f70acc6ed6eb514b0ad4ec63a1dfc83d738cd241f9392eL94-R96))

maoyama added 6 commits May 30, 2025 08:27
- Added 'path' case to SearchKind enum.
- Updated the label and description for 'path'.
- Refactored logic in SearchTokensHandler to accommodate the new 'path' case in filter methods.
- Simplified case handling in multiple switch statements by using 'default'.
- Introduced a private helper method `gitLog` to simplify the creation of GitLog instances, reducing duplication in the code.
- Updated existing methods to utilize the new `gitLog` method for improved readability and maintainability.
@maoyama maoyama requested a review from Copilot May 31, 2025 06:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds path-based commit search, refactors log construction, and enhances the search UI.

  • Introduces a new path search kind with labels and help text.
  • Updates SearchTokensHandler to handle path tokens in filtering.
  • Refactors LogStore and GitLog to support passing file/directory paths and consolidates GitLog instantiation.
  • Adds tooltips in the FolderView search token picker.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
GitClient/Views/Folder/FolderView.swift Added .help(kind.help) tooltip to each search token picker item
GitClient/Models/SearchTokensHandler.swift Extended token-filtering logic to include the new path kind
GitClient/Models/SearchKind.swift Appended path case and corresponding label, shortLabel, and help text
GitClient/Models/Observables/LogStore.swift Added paths property, introduced gitLog helper, wired path tokens
GitClient/Models/Commands/GitLog.swift Moved --topo-order, added path arguments in the command builder

@maoyama maoyama merged commit d7b890f into main May 31, 2025
4 checks passed
@maoyama maoyama mentioned this pull request May 31, 2025
@maoyama maoyama deleted the search-with-path branch May 31, 2025 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant