Commit 34c72cf7 authored by Lucas De Marchi's avatar Lucas De Marchi
Browse files

dim: Fallback to re-encoded patch on fail

If the email comes from a source that encodes the mbox body as base64
for whatever reason, the grep would fail. If it fails, fallback to using
git-mailinfo which will re-encode it.
Signed-off-by: Lucas De Marchi's avatarLucas De Marchi <>
Reviewed-by: José Roberto de Souza's avatarJosé Roberto de Souza <>
parent 132510ea
Pipeline #558933 passed with stages
in 52 seconds
......@@ -1117,10 +1117,17 @@ function check_merge_baseline
# 3-way merge logic. check the default source (a/) and destination (b/) prefixes.
function check_diff_prefix
local rv
local rv patch msg patch_recoded
rv=$(grep -q -E "^diff --git a\/.+ b\/.+$" $patch)
if [ -z "$rv" ]; then
msg=$(mktemp --tmpdir dim-msg.XXXXXX)
patch_recoded=$(mktemp --tmpdir dim-patch.XXXXXX)
git mailinfo "$msg" "$patch_recoded" < $patch >/dev/null
rv=$(grep -q -E "^diff --git a\/.+ b\/.+$" $patch_recoded)
rm "$msg" "$patch_recoded"
return $rv
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment