From 4ea8f158a7965f866e91e5f11c1ba189079bd935 Mon Sep 17 00:00:00 2001 From: "C. McEnroe" Date: Tue, 16 Feb 2021 20:38:04 -0500 Subject: Add -M to move messages after export --- git-fetch-email.sh | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'git-fetch-email.sh') diff --git a/git-fetch-email.sh b/git-fetch-email.sh index 52aa74f..6109091 100644 --- a/git-fetch-email.sh +++ b/git-fetch-email.sh @@ -1,5 +1,5 @@ #!/bin/sh -# Copyright (C) 2019, 2020 C. McEnroe +# Copyright (C) 2019-2021 C. McEnroe # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -27,12 +27,14 @@ subject=$(git config fetchemail.subject) from=$(git config fetchemail.from) to=$(git config fetchemail.to) cc=$(git config fetchemail.cc) +move=$(git config fetchemail.moveTo) OPTS_SPEC="\ git fetch-email [] -- C,cc= fetch patches with matching Cc headers F,from= fetch patches with matching From headers +M,move-to= move patches to mailbox S,subject= fetch patches with matching Subject headers T,to= fetch patches with matching To headers a,apply apply patches with git-am @@ -50,6 +52,7 @@ while [ $# -gt 0 ]; do case "${opt}" in (-C) cc=$1; shift;; (-F) from=$1; shift;; + (-M) move=$1; shift;; (-S) subject=$1; shift;; (-T) to=$1; shift;; (-a) apply=yes;; @@ -61,6 +64,7 @@ while [ $# -gt 0 ]; do (--no-apply) apply=;; (--no-cc) cc=;; (--no-from) from=;; + (--no-move-to) move=;; (--no-subject) subject=;; (--no-to) to=;; (--no-verbose) verbose=;; @@ -96,6 +100,7 @@ fetch() { ${from:+-F "${from}"} \ ${to:+-T "${to}"} \ ${cc:+-C "${cc}"} \ + ${move:+-M "${move}"} \ ${user} status=$? if [ $status -ne 78 ]; then @@ -107,7 +112,15 @@ fetch() { } if [ -n "${apply}" ]; then + applyMove=$move + move= fetch | git am --patch-format=mboxrd "$@" + status=$? + if [ $status -eq 0 ] && [ -n "${applyMove}" ]; then + move=$applyMove + fetch + fi + exit $status else fetch fi -- cgit 1.4.1