Skip to content

Conversation

maoyama
Copy link
Owner

@maoyama maoyama commented Apr 23, 2025

This pull request introduces a new feature to display the total number of commits in the CommitLogView and includes the necessary backend and UI changes to support this functionality. The changes involve adding a new model for counting commits, updating the LogStore observable to calculate and store the count, and modifying the UI to display the count.

Backend Changes:

  • Addition of GitRevListCount Command:

    • A new struct GitRevListCount was added to execute the git rev-list --count command and parse its output to retrieve the total number of commits. (GitClient/Models/Commands/GitRevListCount.swift)
    • Updated the Xcode project file to include GitRevListCount.swift in the build sources. (GitClient.xcodeproj/project.pbxproj) [1] [2] [3] [4]
  • Enhancements to LogStore Observable:

    • Added a totalCommitsCount property to store the count of commits. (LogStore.swift)
    • Implemented the loadTotalCommitsCount method to calculate the total commits count based on the current directory and search tokens. (LogStore.swift)
    • Updated methods like logs(), update(), and removeAll() to integrate the new loadTotalCommitsCount functionality. (LogStore.swift) [1] [2] [3] [4]

UI Changes:

  • Display Commit Count in CommitLogView:
    • Modified CommitLogView to include a bottom inset displaying the total number of commits. This uses the totalCommitsCount property from LogStore. (CommitLogView.swift)

maoyama added 7 commits April 23, 2025 22:33
- Introduced a new property `totalCommitsCount` to keep track of the total number of commits.
- Updated existing methods to load the total commits count whenever commits are loaded or updated.
- Ensured `totalCommitsCount` resets in `removeAll` method.
- Changed static text "1,000 Commits" to a dynamic count text using a new method `countText()`.
- Added logic to display the correct singular or plural form based on the total commit count.
- Introduced a new struct `GitRevListCount` to encapsulate functionality for counting commits.
- Updated project file to include the new source file.
…stCount

- Trimmed whitespace from the output of stdOut in GitRevListCount's parse function to ensure accurate counting.
- Updated loadTotalCommitsCount method in LogStore to use GitRevListCount when searchTokens are empty, improving efficiency.
@maoyama maoyama requested a review from Copilot April 23, 2025 23:51
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 pull request adds a new feature to display the total commit count in the commit log view by introducing a backend command for counting commits, integrating the count into the observable log store, and updating the UI to show the count.

  • Added the GitRevListCount command to execute "git rev-list --count".
  • Enhanced LogStore to calculate and update totalCommitsCount during log retrieval and updates.
  • Modified CommitLogView to display the commit count in a bottom inset.

Reviewed Changes

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

File Description
GitClient/Views/Folder/CommitLogView.swift Added UI elements to show commit count using totalCommitsCount.
GitClient/Models/Observables/LogStore.swift Integrated loadTotalCommitsCount call across log operations.
GitClient/Models/Commands/GitRevListCount.swift Introduced a new command to parse commit count from git output.
Files not reviewed (1)
  • GitClient.xcodeproj/project.pbxproj: Language not supported
Comments suppressed due to low confidence (1)

GitClient/Models/Commands/GitRevListCount.swift:2

  • The header comment still references 'GitRevList.swift' while the file is named 'GitRevListCount.swift'. Please update this comment to match the file name for clarity.
//  GitRevList.swift

@maoyama maoyama merged commit c2b82d9 into main Apr 24, 2025
4 checks passed
@maoyama maoyama deleted the commits-count branch April 24, 2025 09:55
@maoyama maoyama mentioned this pull request Apr 24, 2025
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