Skip to content

Status and branching APIs#3

Merged
eugener merged 4 commits into
masterfrom
develop
Sep 10, 2025
Merged

Status and branching APIs#3
eugener merged 4 commits into
masterfrom
develop

Conversation

@eugener

@eugener eugener commented Sep 10, 2025

Copy link
Copy Markdown
Owner

No description provided.

- Replace simple FileStatus enum with IndexStatus and WorktreeStatus enums
- Add FileEntry struct combining PathBuf with both status types
- Implement Box<[FileEntry]> for immutable, memory-efficient storage
- Add const from_char/to_char methods with zero runtime cost
- Provide iterator-based API methods: staged_files(), unstaged_files(), untracked_entries()
- Add status filtering by IndexStatus and WorktreeStatus
- Update all examples and documentation to showcase new capabilities
- Maintain Git-accurate representation of index vs worktree states
Add comprehensive branch management functionality including:
- Repository::branches() with BranchList for efficient filtering
- Repository::current_branch() to get active branch
- Repository::create_branch() and Repository::delete_branch() for lifecycle
- Repository::checkout() and Repository::checkout_new() for switching
- Branch, BranchType, and BranchList types with iterator methods
- Complete test coverage with 11 new tests (90+ total)
- branch_operations.rs example demonstrating full workflow
- Updated documentation with API reference and examples
Add comprehensive commit history functionality with multi-level API:
- Repository::log() for basic commit listing
- Repository::recent_commits() for recent N commits
- Repository::log_with_options() for advanced filtering
- Repository::log_range() for commit ranges
- Repository::log_for_paths() for path-specific history
- Repository::show_commit() for detailed commit information

Include rich types (Commit, CommitLog, Author, CommitMessage, CommitDetails, LogOptions)
with iterator-based filtering and builder pattern for advanced queries.

Add comprehensive example demonstrating all log functionality and update documentation.
Update package version from 0.1.0 to 0.2.0 and add crates.io metadata.

- Add keywords and categories for better discoverability
- Create automated release workflow for crates.io publishing
- Update CI workflow to support develop branch and test configuration
- Make documentation version-agnostic with abstract installation instructions
- Replace version-specific content with capability-focused descriptions
Copilot AI review requested due to automatic review settings September 10, 2025 00:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 introduces comprehensive status and branching APIs for rustic-git, significantly expanding its functionality. The update transforms the file status system from a simple enum-based approach to a sophisticated two-dimensional tracking system that accurately mirrors Git's staging model, while adding complete branch management capabilities and extensive commit history operations.

  • Enhanced status API with separate staged/unstaged file tracking using IndexStatus and WorktreeStatus enums
  • Complete branch operations including create, delete, checkout, and comprehensive listing with type-safe filtering
  • Extensive commit history and log operations with advanced querying, filtering, and analysis capabilities

Reviewed Changes

Copilot reviewed 21 out of 22 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
src/types.rs Add Eq trait to Hash type for equality comparisons
src/lib.rs Expand public API exports to include new status, branch, and log types
src/commands/status.rs Complete rewrite with IndexStatus/WorktreeStatus enums and enhanced FileEntry-based API
src/commands/mod.rs Add branch and log modules with comprehensive type exports
src/commands/log.rs New comprehensive commit history and log operations with multi-level querying API
src/commands/commit.rs Update to use new staged_files() API for checking staged changes
src/commands/branch.rs New complete branch management API with type-safe operations
src/commands/add.rs Update tests to use new staged_files() API
examples/*.rs Update all examples to demonstrate new enhanced APIs
README.md Comprehensive documentation update showcasing new capabilities
Cargo.toml Version bump to 0.2.0 with chrono dependency and metadata additions
.github/workflows/ Add release workflow and enhance CI with git configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/commands/status.rs
.filter(move |entry| entry.index_status == status)
}

/// Get files with specific worktree status

Copilot AI Sep 10, 2025

Copy link

Choose a reason for hiding this comment

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

There's a trailing space after 'status' that should be removed.

Copilot uses AI. Check for mistakes.
Comment thread src/commands/log.rs
Comment on lines +573 to +574
if let Some(space_pos) = stats_part.find(' ')
&& let Ok(changes) = stats_part[..space_pos].parse::<usize>()

Copilot AI Sep 10, 2025

Copy link

Choose a reason for hiding this comment

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

Using let chains in if conditions requires the let_chains feature which may not be stable. Consider using nested if let statements or match expressions for better compatibility.

Copilot uses AI. Check for mistakes.
Comment thread src/commands/log.rs
Comment on lines +592 to +594
if let Some(insertions_pos) = line.find(" insertions(+)")
&& let Some(start) = line[..insertions_pos].rfind(' ')
&& let Ok(insertions) = line[start + 1..insertions_pos].parse::<usize>()

Copilot AI Sep 10, 2025

Copy link

Choose a reason for hiding this comment

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

Using let chains in if conditions requires the let_chains feature which may not be stable. Consider using nested if let statements or match expressions for better compatibility.

Copilot uses AI. Check for mistakes.
Comment thread src/commands/log.rs
Comment on lines +598 to +600
if let Some(deletions_pos) = line.find(" deletions(-)")
&& let Some(start) = line[..deletions_pos].rfind(' ')
&& let Ok(deletions) = line[start + 1..deletions_pos].parse::<usize>()

Copilot AI Sep 10, 2025

Copy link

Choose a reason for hiding this comment

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

Using let chains in if conditions requires the let_chains feature which may not be stable. Consider using nested if let statements or match expressions for better compatibility.

Copilot uses AI. Check for mistakes.
@eugener eugener merged commit f8842ae into master Sep 10, 2025
2 checks passed
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.

2 participants