Skip to content

Conversation

maoyama
Copy link
Owner

@maoyama maoyama commented May 31, 2025

https://git-scm.com/docs/git-log#Documentation/git-log.txt---authorltpatterngt

--author=
--committer=
Limit the commits output to ones with author/committer header lines that match the specified pattern (regular expression). With more than one --author=, commits whose author matches any of the given patterns are chosen (similarly for multiple --committer=).

===========

This pull request introduces changes to support multiple authors in search filters, refactors the SearchTokensHandler for improved clarity, and updates related tests. The most significant changes include replacing single-author handling with multi-author support, renaming the handle method to normalize for better semantic alignment, and modifying tests to reflect these updates.

Support for multiple authors:

  • Updated GitLog.swift to replace single-author handling (author) with multi-author support (authors) and adjusted the logic for constructing Git command arguments. [1] [2]
  • Updated LogStore.swift to support multiple authors in search tokens by changing author to authors. [1] [2]

Refactoring for clarity:

  • Renamed handle method in SearchTokensHandler.swift to normalize for improved semantic clarity.
  • Consolidated logic for handling author tokens in SearchTokensHandler.swift by removing redundant filtering and aligning behavior with other token types. [1] [2]

Test updates:

  • Updated all test cases in SearchTokensHandlerTests.swift to use the renamed normalize method and to reflect the changes in token handling logic.

UI integration:

  • Modified FolderView.swift to use the updated normalize method for handling search tokens, ensuring compatibility with the refactored logic.

maoyama added 3 commits May 31, 2025 15:49
Updated the GitLog struct to replace the single author string with an array of authors. Modified argument building to handle multiple authors when generating git log commands. Additionally, updated the LogStore to reflect the changes in authors parsing.
@maoyama maoyama requested a review from Copilot May 31, 2025 06:54
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 enhances search functionality by supporting multiple authors, refactors token handling for clarity, and updates tests and UI to match the new API.

  • Introduce multi-author support in GitLog and LogStore
  • Rename SearchTokensHandler.handle to normalize and consolidate token logic
  • Update tests and FolderView to use the new normalize method

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
GitClientTests/SearchTokensHandlerTests.swift Updated tests to call normalize instead of handle
GitClient/Views/Folder/FolderView.swift Switched from handle to normalize in the search tokens update
GitClient/Models/SearchTokensHandler.swift Renamed handlenormalize and merged .author with .path case
GitClient/Models/Observables/LogStore.swift Changed single author property to authors array
GitClient/Models/Commands/GitLog.swift Replaced single --author flag with multiple --author args
Comments suppressed due to low confidence (2)

GitClientTests/SearchTokensHandlerTests.swift:28

  • Typo in test name: Math should be Match to reflect .grepAllMatch.
@Test func handleGrepAllMath() async throws {

GitClientTests/SearchTokensHandlerTests.swift:103

  • Typo in test name: Auhor should be Author.
@Test func handleAuhorInEdit() async throws {

@@ -72,7 +63,7 @@ struct SearchTokensHandler {
return true
}
}
case .path:
case .author, .path:
Copy link
Preview

Copilot AI May 31, 2025

Choose a reason for hiding this comment

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

The .author case was merged with .path and now always returns all tokens, which breaks the intended behavior of replacing old author tokens. Separate .author into its own case and filter only the new author tokens.

Suggested change
case .author, .path:
case .author:
return newTokens.filter { token in
switch token.kind {
case .author:
return !oldTokens.contains(token)
default:
return true
}
}
case .path:

Copilot uses AI. Check for mistakes.

@maoyama maoyama merged commit f4db3c6 into main May 31, 2025
4 checks passed
@maoyama maoyama deleted the multiple-author branch May 31, 2025 07:05
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