Skip to content

Commit 372352b

Browse files
committed
fix(sendmail): escape fake git fixture newline
Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
1 parent fa4b329 commit 372352b

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/infra/sendmail.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,8 +395,9 @@ fn git_candidates(command_path: Option<&Path>) -> Vec<GitCandidate> {
395395
let mut candidates = Vec::new();
396396
if let Some(path) = command_path {
397397
candidates.push(GitCandidate::Path(path.to_path_buf()));
398+
} else {
399+
candidates.push(GitCandidate::Program("git"));
398400
}
399-
candidates.push(GitCandidate::Program("git"));
400401
candidates
401402
}
402403

@@ -920,7 +921,7 @@ mod tests {
920921
let fake_git = write_fake_git(
921922
&root,
922923
&format!(
923-
"#!/bin/sh\nif [ \"$1\" = \"--version\" ]; then\n echo 'git version 2.51.0'\n exit 0\nfi\nif [ \"$1\" = \"send-email\" ] && [ \"$2\" = \"-h\" ]; then\n echo 'usage: git send-email [<options>] <file|directory>...'\n exit 129\nfi\nif [ \"$1\" = \"send-email\" ]; then\n printf '%s\n' \"$@\" > '{}'\n last=''\n for arg in \"$@\"; do\n last=\"$arg\"\n done\n cp \"$last\" '{}'\n echo 'sent'\n exit 0\nfi\nexit 1\n",
924+
"#!/bin/sh\nif [ \"$1\" = \"--version\" ]; then\n echo 'git version 2.51.0'\n exit 0\nfi\nif [ \"$1\" = \"send-email\" ] && [ \"$2\" = \"-h\" ]; then\n echo 'usage: git send-email [<options>] <file|directory>...'\n exit 129\nfi\nif [ \"$1\" = \"send-email\" ]; then\n printf '%s\\n' \"$@\" > '{}'\n last=''\n for arg in \"$@\"; do\n last=\"$arg\"\n done\n cp \"$last\" '{}'\n echo 'sent'\n exit 0\nfi\nexit 1\n",
924925
capture_args.display(),
925926
capture.display()
926927
),

0 commit comments

Comments
 (0)