Correct misnomer "commit hash" -> "commit UUID"

This commit is contained in:
Josh Hansen 2023-10-01 23:32:22 -07:00
parent 07f5921d4f
commit db8d6e2efa
3 changed files with 9 additions and 9 deletions

View file

@ -250,8 +250,8 @@ pub enum Commands {
/// Return the current table to the state it had in the commit with the given uuid `commit`
Reset {
#[arg(help = "Hash of the commit to reset to", required = true)]
commit_hash: String,
#[arg(help = "UUID of the commit to reset to", required = true)]
commit_uuid: String,
#[arg(
short,

View file

@ -261,7 +261,7 @@ fn run_command(cmd: &Commands) {
}
Commands::Reset {
commit_hash,
commit_uuid,
keep,
verbose,
} => {
@ -270,8 +270,8 @@ fn run_command(cmd: &Commands) {
} else {
NewFileHandling::Delete
};
reset(commit_hash, *verbose, new_file_handling)
.unwrap_or_else(|e| panic!("Error resetting to {}: {}", commit_hash, e));
reset(commit_uuid, *verbose, new_file_handling)
.unwrap_or_else(|e| panic!("Error resetting to {}: {}", commit_uuid, e));
}
}
}

View file

@ -14,22 +14,22 @@ pub enum ResetErr {
}
/**
* Return the current table to the state it had in the commit with the given uuid `commit`
* Return the current table to the state it had in the commit with the given uuid `commit_uuid`
*
* ## Errors
*
* If the current working directory is not contained by a table, an error will be returned.
* An error also results if the commit hash does not match any commit.
*/
pub fn reset(commit: &str, verbose: bool, new_file_handling: NewFileHandling) -> Result<()> {
pub fn reset(commit_uuid: &str, verbose: bool, new_file_handling: NewFileHandling) -> Result<()> {
let cur = current_dir()?;
let info = containing_table_info(&cur)?.ok_or(ResetErr::NotInTable)?;
let table_path = info.path_abs();
reset_path(table_path, commit, true, verbose, new_file_handling)?;
reset_path(table_path, commit_uuid, true, verbose, new_file_handling)?;
xattr::set(table_path, XATTR_HEAD.to_osstring(), commit.as_bytes())?;
xattr::set(table_path, XATTR_HEAD.to_osstring(), commit_uuid.as_bytes())?;
Ok(())
}