Skip to main content

worktree_setup_git/
lib.rs

1//! Git operations for worktree-setup.
2//!
3//! This crate provides git operations using the `git2` library, including:
4//!
5//! * Repository discovery and information
6//! * Worktree listing, creation, and management
7//! * File status detection (unstaged, untracked)
8//!
9//! # Example
10//!
11//! ```rust,ignore
12//! use worktree_setup_git::{open_repo, get_worktrees, create_worktree};
13//!
14//! let repo = open_repo(".")?;
15//! let worktrees = get_worktrees(&repo)?;
16//! println!("Found {} worktrees", worktrees.len());
17//! ```
18
19#![cfg_attr(feature = "fail-on-warnings", deny(warnings))]
20#![warn(clippy::all, clippy::pedantic, clippy::nursery, clippy::cargo)]
21#![allow(clippy::multiple_crate_versions)]
22
23mod error;
24mod repo;
25mod status;
26mod worktree;
27
28pub use error::GitError;
29pub use git2::Repository;
30pub use repo::{
31    discover_repo, fetch_remote, get_current_branch, get_default_branch, get_local_branches,
32    get_recent_branches, get_remote_branches, get_remotes, get_repo_root, get_workdir, open_repo,
33};
34pub use status::get_unstaged_and_untracked_files;
35pub use worktree::{
36    WorktreeCreateOptions, WorktreeInfo, create_worktree, delete_branch, get_main_worktree,
37    get_worktrees, prune_worktrees, remove_worktree,
38};