From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Subject: [PATCHv3 (resend) 1/4] git-am foreign patch support: introduce patch_format
Date: Tue, 2 Jun 2009 01:10:38 +0200 [thread overview]
Message-ID: <1243897841-8923-2-git-send-email-giuseppe.bilotta@gmail.com> (raw)
In-Reply-To: <1243897841-8923-1-git-send-email-giuseppe.bilotta@gmail.com>
Set up a framework to allow git-am to support patches which are not in
mailbox format. Introduce a patch_format variable that presently can
only be set from the command line, defaulting to 'mbox' (the only
supported format) if not specified.
---
git-am.sh | 37 +++++++++++++++++++++++++++++++++----
1 files changed, 33 insertions(+), 4 deletions(-)
diff --git a/git-am.sh b/git-am.sh
index 578780b..da160de 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -18,6 +18,7 @@ whitespace= pass it through git-apply
directory= pass it through git-apply
C= pass it through git-apply
p= pass it through git-apply
+patch-format= format the patch(es) are in
reject pass it through git-apply
resolvemsg= override error message when patch failure occurs
r,resolved to be used after a patch failure
@@ -133,6 +134,32 @@ It does not apply to blobs recorded in its index."
unset GITHEAD_$his_tree
}
+patch_format=
+
+check_patch_format () {
+ # early return if patch_format was set from the command line
+ if test -n "$patch_format"
+ then
+ return 0
+ fi
+ patch_format=mbox
+}
+
+split_patches () {
+ case "$patch_format" in
+ mbox)
+ git mailsplit -d"$prec" -o"$dotest" -b -- "$@" > "$dotest/last" || {
+ rm -fr "$dotest"
+ exit 1
+ }
+ ;;
+ *)
+ echo "Patch format $patch_format is not supported."
+ exit 1
+ ;;
+ esac
+}
+
prec=4
dotest="$GIT_DIR/rebase-apply"
sign= utf8=t keep= skip= interactive= resolved= rebasing= abort=
@@ -175,6 +202,8 @@ do
git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;;
-C|-p)
git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
+ --patch-format)
+ shift ; patch_format="$1" ;;
--reject)
git_apply_opt="$git_apply_opt $1" ;;
--committer-date-is-author-date)
@@ -274,10 +303,10 @@ else
done
shift
fi
- git mailsplit -d"$prec" -o"$dotest" -b -- "$@" > "$dotest/last" || {
- rm -fr "$dotest"
- exit 1
- }
+
+ check_patch_format "$@"
+
+ split_patches "$@"
# -s, -u, -k, --whitespace, -3, -C and -p flags are kept
# for the resuming session after a patch failure.
--
1.6.3.1.282.g9f93
next prev parent reply other threads:[~2009-06-01 23:11 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-01 23:10 [PATCHv3 (resend) 0/4] git-am foreign patch support Giuseppe Bilotta
2009-06-01 23:10 ` Giuseppe Bilotta [this message]
2009-06-01 23:10 ` [PATCHv3 (resend) 2/4] git-am foreign patch support: autodetect some patch formats Giuseppe Bilotta
2009-06-01 23:10 ` [PATCHv3 (resend) 3/4] git-am foreign patch support: StGIT support Giuseppe Bilotta
2009-06-01 23:10 ` [PATCHv3 (resend) 4/4] git-am: refactor 'cleaning up and aborting' Giuseppe Bilotta
2009-06-02 10:56 ` [PATCHv3 (resend) 0/4] git-am foreign patch support Nanako Shiraishi
2009-06-02 15:21 ` Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1243897841-8923-2-git-send-email-giuseppe.bilotta@gmail.com \
--to=giuseppe.bilotta@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).