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}
11
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub struct FileChange {
14    pub path: PathBuf,
15    pub status: FileStatus,
16    pub old_path: Option<PathBuf>,
17}
18
19impl FileChange {
20    #[must_use]
21    pub fn new(path: PathBuf, status: FileStatus) -> Self {
22        Self {
23            path,
24            status,
25            old_path: None,
26        }
27    }
28
29    #[must_use]
30    pub fn with_old_path(mut self, old_path: PathBuf) -> Self {
31        self.old_path = Some(old_path);
32        self
33    }
34}
35
36#[derive(Debug, Clone, PartialEq, Eq)]
37pub struct TagInfo {
38    pub name: String,
39    pub target_sha: String,
40}
41
42#[derive(Debug, Clone, PartialEq, Eq)]
43pub struct CommitInfo {
44    pub sha: String,
45    pub message: String,
46}