Skip to content

Commit

Permalink
git: remove RefName::GitRef variant which isn't used anymore
Browse files Browse the repository at this point in the history
  • Loading branch information
yuja committed Oct 24, 2023
1 parent a756333 commit 831dc84
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/src/git.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ pub enum RefName {
LocalBranch(String),
RemoteBranch { branch: String, remote: String },
Tag(String),
GitRef(String),
}

impl fmt::Display for RefName {
Expand All @@ -54,7 +53,6 @@ impl fmt::Display for RefName {
RefName::LocalBranch(name) => write!(f, "{name}"),
RefName::RemoteBranch { branch, remote } => write!(f, "{branch}@{remote}"),
RefName::Tag(name) => write!(f, "{name}"),
RefName::GitRef(name) => write!(f, "{name}"),
}
}
}
Expand Down Expand Up @@ -117,14 +115,13 @@ fn to_git_ref_name(parsed_ref: &RefName) -> Option<String> {
RefName::RemoteBranch { branch, remote } => (!branch.is_empty() && branch != "HEAD")
.then(|| format!("refs/remotes/{remote}/{branch}")),
RefName::Tag(tag) => Some(format!("refs/tags/{tag}")),
RefName::GitRef(name) => Some(name.to_owned()),
}
}

fn to_remote_branch<'a>(parsed_ref: &'a RefName, remote_name: &str) -> Option<&'a str> {
match parsed_ref {
RefName::RemoteBranch { branch, remote } => (remote == remote_name).then_some(branch),
RefName::LocalBranch(..) | RefName::Tag(..) | RefName::GitRef(..) => None,
RefName::LocalBranch(..) | RefName::Tag(..) => None,
}
}

Expand Down Expand Up @@ -312,7 +309,6 @@ pub fn import_some_refs(
}
// TODO: If we add Git-tracking tag, it will be updated here.
}
RefName::GitRef(_) => unreachable!(),
}
}

Expand Down Expand Up @@ -469,7 +465,6 @@ fn default_remote_ref_state_for(ref_name: &RefName, git_settings: &GitSettings)
RemoteRefState::New
}
}
RefName::GitRef(_) => unreachable!(),
}
}

Expand Down

0 comments on commit 831dc84

Please sign in to comment.