Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/commit_msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub fn run(repo: &util::Repo, msg_file: &str) -> Result<()> {
hash
};

let hash_str = data_encoding::BASE32.encode(&hash);
let hash_str = data_encoding::BASE32.encode(&hash).to_ascii_lowercase();

// Check if trailer exists
let output = cmd!("git interpret-trailers --parse", msg_file).checked_output()?;
Expand Down
10 changes: 3 additions & 7 deletions tests/migration_edge_cases.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,13 @@ fn test_base32_format_compliance() {
let id_line = msg.lines().find(|l| l.starts_with("gherrit-pr-id: ")).expect("ID not found");
let id = id_line.trim().strip_prefix("gherrit-pr-id: ").unwrap();

// 1. Case Sensitivity & Normalization
// Must be uppercase G + [A-Z2-7]
// Must be uppercase G + [a-z2-7]
assert!(id.starts_with('G'), "ID must start with G");
let content = &id[1..];
assert!(
content.chars().all(|c| c.is_ascii_uppercase() || c.is_ascii_digit()),
"ID must be uppercase/digits"
content.chars().all(|c| matches!(c, 'a'..='z' | '2'..='7')),
"ID content must be lowercase letters or digits 2-7"
);
assert!(!content.chars().any(|c| c.is_ascii_lowercase()), "ID must not contain lowercase");

// 2. Padding & Symbols
assert!(!content.contains('='), "ID must not contain padding");
assert_eq!(id.len(), 33, "ID length should be 33 (1 prefix + 32 hash)");
}
Loading