commit 5b31bcaafe23708fc8b442471765820b69c8473b
parent 266f7a88a7c0bbd44c2fe68f3604c61acbbb35cc
Author: Matthias Beyer <mail@beyermatthias.de>
Date: Thu, 1 Apr 2021 20:39:47 +0200
Add support for calling git-am with -3
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Tested-by: Matthias Beyer <mail@beyermatthias.de>
Link: https://lore.kernel.org/r/20210401183949.25894-4-mail@beyermatthias.de
Diffstat:
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/notmuch-am b/notmuch-am
@@ -26,6 +26,7 @@ begins_with_short_option()
_positionals=()
# THE DEFAULTS INITIALIZATION - OPTIONALS
_arg_am="off"
+_arg_3="off"
print_help()
@@ -34,6 +35,7 @@ print_help()
printf 'Usage: %s [-h|--help] [--(no-)am] <thread-id>\n' "$0"
printf '\t%s\n' "<thread-id>: The notmuch thread id of the thread to apply"
printf '\t%s\n' "--am, --no-am: Call git-am instead of generating a mbox file (off by default)"
+ printf '\t%s\n' "-3: Call git-am with -3 (off by default, only effective with --am)"
printf '\t%s\n' "-h, --help: Prints help"
printf %s "\
@@ -67,6 +69,9 @@ parse_commandline()
_arg_am="on"
test "${1:0:5}" = "--no-" && _arg_am="off"
;;
+ -3)
+ _arg_3="on"
+ ;;
*)
_last_positional="$1"
_positionals+=("$_last_positional")
@@ -120,7 +125,12 @@ main () {
msgid=$(grep -i ^message-id "$mbox" | cut -d" " -f2 | head -n1)
if [[ "$_arg_am" == "on" ]]; then
- b4 am "msgid" -m "$mbox" -o - | git am
+ AM_ARGS=""
+ if [[ "$_arg_3" == "on" ]]; then
+ AM_ARGS="-3"
+ fi
+
+ b4 am "$msgid" -m "$mbox" -o - | git am $AM_ARGS
else
b4 am "$B4AM_ARGS" "$msgid" -m "$mbox"
fi