Skip to main content

changeset_git/
types.rs

1use std::path::PathBuf;
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq)]
4pub enum FileStatus {
5    Added,
6    Modified,
7    Deleted,
8    Renamed,
9    Copied,
10    Typechange,
11}
12
13#[derive(Debug, Clone, PartialEq, Eq)]
14pub struct FileChange {
15    pub path: PathBuf,
16    pub status: FileStatus,
17    pub old_path: Option<PathBuf>,
18}
19
20impl FileChange {
21    #[must_use]
22    pub fn new(path: PathBuf, status: FileStatus) -> Self {
23        Self {
24            path,
25            status,
26            old_path: None,
27        }
28    }
29
30    #[must_use]
31    pub fn with_old_path(mut self, old_path: PathBuf) -> Self {
32        self.old_path = Some(old_path);
33        self
34    }
35}
36
37#[derive(Debug, Clone, PartialEq, Eq)]
38pub struct TagInfo {
39    pub name: String,
40    pub target_sha: String,
41}
42
43#[derive(Debug, Clone, PartialEq, Eq)]
44pub struct CommitInfo {
45    pub sha: String,
46    pub message: String,
47}