Skip to content

Commit

Permalink
backend: remove unused Commit::is_pruned (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvonz committed Oct 7, 2021
1 parent 4c4e436 commit fdb861b
Show file tree
Hide file tree
Showing 11 changed files with 50 additions and 271 deletions.
2 changes: 1 addition & 1 deletion lib/protos/store.proto
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ message Commit {
Signature committer = 7;

bool is_open = 8;
bool is_pruned = 9;
bool is_pruned = 9 [deprecated = true];
}

message Conflict {
Expand Down
1 change: 0 additions & 1 deletion lib/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ pub struct Commit {
pub author: Signature,
pub committer: Signature,
pub is_open: bool,
pub is_pruned: bool,
}

#[derive(Debug, PartialEq, Eq, Clone)]
Expand Down
4 changes: 0 additions & 4 deletions lib/src/commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,6 @@ impl Commit {
self.data.is_open
}

pub fn is_pruned(&self) -> bool {
self.data.is_pruned
}

pub fn is_empty(&self) -> bool {
let parents = self.parents();
// TODO: Perhaps the root commit should also be considered empty.
Expand Down
3 changes: 0 additions & 3 deletions lib/src/commit_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ impl CommitBuilder {
author: signature.clone(),
committer: signature,
is_open: false,
is_pruned: false,
};
CommitBuilder {
store: store.clone(),
Expand All @@ -76,7 +75,6 @@ impl CommitBuilder {
let mut commit = predecessor.store_commit().clone();
commit.predecessors = vec![predecessor.id().clone()];
commit.committer = signature(settings);
commit.is_pruned = false;
CommitBuilder {
store: store.clone(),
commit,
Expand All @@ -100,7 +98,6 @@ impl CommitBuilder {
author: signature.clone(),
committer: signature,
is_open: true,
is_pruned: false,
};
CommitBuilder {
store: store.clone(),
Expand Down
6 changes: 0 additions & 6 deletions lib/src/git_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ fn signature_to_git(signature: &Signature) -> git2::Signature {
fn serialize_note(commit: &Commit) -> String {
let mut proto = crate::protos::store::Commit::new();
proto.is_open = commit.is_open;
proto.is_pruned = commit.is_pruned;
proto.change_id = commit.change_id.0.to_vec();
for predecessor in &commit.predecessors {
proto.predecessors.push(predecessor.0.to_vec());
Expand All @@ -106,7 +105,6 @@ fn deserialize_note(commit: &mut Commit, note: &str) {
let mut cursor = Cursor::new(bytes);
let proto: crate::protos::store::Commit = Message::parse_from_reader(&mut cursor).unwrap();
commit.is_open = proto.is_open;
commit.is_pruned = proto.is_pruned;
commit.change_id = ChangeId(proto.change_id);
for predecessor in &proto.predecessors {
commit.predecessors.push(CommitId(predecessor.clone()));
Expand Down Expand Up @@ -353,7 +351,6 @@ impl Backend for GitBackend {
author,
committer,
is_open: false,
is_pruned: false,
};

let maybe_note = locked_repo
Expand Down Expand Up @@ -564,7 +561,6 @@ mod tests {
assert_eq!(commit.predecessors, vec![]);
assert_eq!(commit.root_tree.0.as_slice(), root_tree_id.as_bytes());
assert!(!commit.is_open);
assert!(!commit.is_pruned);
assert_eq!(commit.description, "git commit message");
assert_eq!(commit.author.name, "git author");
assert_eq!(commit.author.email, "git.author@example.com");
Expand Down Expand Up @@ -641,7 +637,6 @@ mod tests {
author: signature.clone(),
committer: signature,
is_open: false,
is_pruned: false,
};
let commit_id = store.write_commit(&commit).unwrap();
let git_refs = git_repo
Expand Down Expand Up @@ -675,7 +670,6 @@ mod tests {
author: signature.clone(),
committer: signature,
is_open: false,
is_pruned: false,
};
let commit_id1 = store.write_commit(&commit1).unwrap();
let mut commit2 = commit1;
Expand Down
Loading

0 comments on commit fdb861b

Please sign in to comment.