Merge branch 'pb/am-message-id-footer'
"git am" learned "--message-id" option to copy the message ID of the incoming e-mail to the log message of resulting commit. * pb/am-message-id-footer: git-am: add --message-id/--no-message-id git-mailinfo: add --message-id
This commit is contained in:
commit
fa7f51d533
@ -57,6 +57,17 @@ OPTIONS
|
|||||||
--no-scissors::
|
--no-scissors::
|
||||||
Ignore scissors lines (see linkgit:git-mailinfo[1]).
|
Ignore scissors lines (see linkgit:git-mailinfo[1]).
|
||||||
|
|
||||||
|
-m::
|
||||||
|
--message-id::
|
||||||
|
Pass the `-m` flag to 'git mailinfo' (see linkgit:git-mailinfo[1]),
|
||||||
|
so that the Message-ID header is added to the commit message.
|
||||||
|
The `am.messageid` configuration variable can be used to specify
|
||||||
|
the default behaviour.
|
||||||
|
|
||||||
|
--no-message-id::
|
||||||
|
Do not add the Message-ID header to the commit message.
|
||||||
|
`no-message-id` is useful to override `am.messageid`.
|
||||||
|
|
||||||
-q::
|
-q::
|
||||||
--quiet::
|
--quiet::
|
||||||
Be quiet. Only print error messages.
|
Be quiet. Only print error messages.
|
||||||
|
@ -66,6 +66,11 @@ conversion, even with this flag.
|
|||||||
-n::
|
-n::
|
||||||
Disable all charset re-coding of the metadata.
|
Disable all charset re-coding of the metadata.
|
||||||
|
|
||||||
|
-m::
|
||||||
|
--message-id::
|
||||||
|
Copy the Message-ID header at the end of the commit message. This
|
||||||
|
is useful in order to associate commits with mailing list discussions.
|
||||||
|
|
||||||
--scissors::
|
--scissors::
|
||||||
Remove everything in body before a scissors line. A line that
|
Remove everything in body before a scissors line. A line that
|
||||||
mainly consists of scissors (either ">8" or "8<") and perforation
|
mainly consists of scissors (either ">8" or "8<") and perforation
|
||||||
|
@ -15,6 +15,7 @@ static const char *metainfo_charset;
|
|||||||
static struct strbuf line = STRBUF_INIT;
|
static struct strbuf line = STRBUF_INIT;
|
||||||
static struct strbuf name = STRBUF_INIT;
|
static struct strbuf name = STRBUF_INIT;
|
||||||
static struct strbuf email = STRBUF_INIT;
|
static struct strbuf email = STRBUF_INIT;
|
||||||
|
static char *message_id;
|
||||||
|
|
||||||
static enum {
|
static enum {
|
||||||
TE_DONTCARE, TE_QP, TE_BASE64
|
TE_DONTCARE, TE_QP, TE_BASE64
|
||||||
@ -24,6 +25,7 @@ static struct strbuf charset = STRBUF_INIT;
|
|||||||
static int patch_lines;
|
static int patch_lines;
|
||||||
static struct strbuf **p_hdr_data, **s_hdr_data;
|
static struct strbuf **p_hdr_data, **s_hdr_data;
|
||||||
static int use_scissors;
|
static int use_scissors;
|
||||||
|
static int add_message_id;
|
||||||
static int use_inbody_headers = 1;
|
static int use_inbody_headers = 1;
|
||||||
|
|
||||||
#define MAX_HDR_PARSED 10
|
#define MAX_HDR_PARSED 10
|
||||||
@ -198,6 +200,12 @@ static void handle_content_type(struct strbuf *line)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void handle_message_id(const struct strbuf *line)
|
||||||
|
{
|
||||||
|
if (add_message_id)
|
||||||
|
message_id = strdup(line->buf);
|
||||||
|
}
|
||||||
|
|
||||||
static void handle_content_transfer_encoding(const struct strbuf *line)
|
static void handle_content_transfer_encoding(const struct strbuf *line)
|
||||||
{
|
{
|
||||||
if (strcasestr(line->buf, "base64"))
|
if (strcasestr(line->buf, "base64"))
|
||||||
@ -342,6 +350,14 @@ static int check_header(const struct strbuf *line,
|
|||||||
ret = 1;
|
ret = 1;
|
||||||
goto check_header_out;
|
goto check_header_out;
|
||||||
}
|
}
|
||||||
|
if (cmp_header(line, "Message-Id")) {
|
||||||
|
len = strlen("Message-Id: ");
|
||||||
|
strbuf_add(&sb, line->buf + len, line->len - len);
|
||||||
|
decode_header(&sb);
|
||||||
|
handle_message_id(&sb);
|
||||||
|
ret = 1;
|
||||||
|
goto check_header_out;
|
||||||
|
}
|
||||||
|
|
||||||
/* for inbody stuff */
|
/* for inbody stuff */
|
||||||
if (starts_with(line->buf, ">From") && isspace(line->buf[5])) {
|
if (starts_with(line->buf, ">From") && isspace(line->buf[5])) {
|
||||||
@ -816,6 +832,8 @@ static int handle_commit_msg(struct strbuf *line)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (patchbreak(line)) {
|
if (patchbreak(line)) {
|
||||||
|
if (message_id)
|
||||||
|
fprintf(cmitmsg, "Message-Id: %s\n", message_id);
|
||||||
fclose(cmitmsg);
|
fclose(cmitmsg);
|
||||||
cmitmsg = NULL;
|
cmitmsg = NULL;
|
||||||
return 1;
|
return 1;
|
||||||
@ -1013,7 +1031,7 @@ static int git_mailinfo_config(const char *var, const char *value, void *unused)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const char mailinfo_usage[] =
|
static const char mailinfo_usage[] =
|
||||||
"git mailinfo [-k|-b] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] msg patch < mail >info";
|
"git mailinfo [-k|-b] [-m | --message-id] [-u | --encoding=<encoding> | -n] [--scissors | --no-scissors] msg patch < mail >info";
|
||||||
|
|
||||||
int cmd_mailinfo(int argc, const char **argv, const char *prefix)
|
int cmd_mailinfo(int argc, const char **argv, const char *prefix)
|
||||||
{
|
{
|
||||||
@ -1032,6 +1050,8 @@ int cmd_mailinfo(int argc, const char **argv, const char *prefix)
|
|||||||
keep_subject = 1;
|
keep_subject = 1;
|
||||||
else if (!strcmp(argv[1], "-b"))
|
else if (!strcmp(argv[1], "-b"))
|
||||||
keep_non_patch_brackets_in_subject = 1;
|
keep_non_patch_brackets_in_subject = 1;
|
||||||
|
else if (!strcmp(argv[1], "-m") || !strcmp(argv[1], "--message-id"))
|
||||||
|
add_message_id = 1;
|
||||||
else if (!strcmp(argv[1], "-u"))
|
else if (!strcmp(argv[1], "-u"))
|
||||||
metainfo_charset = def_charset;
|
metainfo_charset = def_charset;
|
||||||
else if (!strcmp(argv[1], "-n"))
|
else if (!strcmp(argv[1], "-n"))
|
||||||
|
21
git-am.sh
21
git-am.sh
@ -17,6 +17,7 @@ s,signoff add a Signed-off-by line to the commit message
|
|||||||
u,utf8 recode into utf8 (default)
|
u,utf8 recode into utf8 (default)
|
||||||
k,keep pass -k flag to git-mailinfo
|
k,keep pass -k flag to git-mailinfo
|
||||||
keep-non-patch pass -b flag to git-mailinfo
|
keep-non-patch pass -b flag to git-mailinfo
|
||||||
|
m,message-id pass -m flag to git-mailinfo
|
||||||
keep-cr pass --keep-cr flag to git-mailsplit for mbox format
|
keep-cr pass --keep-cr flag to git-mailsplit for mbox format
|
||||||
no-keep-cr do not pass --keep-cr flag to git-mailsplit independent of am.keepcr
|
no-keep-cr do not pass --keep-cr flag to git-mailsplit independent of am.keepcr
|
||||||
c,scissors strip everything before a scissors line
|
c,scissors strip everything before a scissors line
|
||||||
@ -371,13 +372,18 @@ split_patches () {
|
|||||||
prec=4
|
prec=4
|
||||||
dotest="$GIT_DIR/rebase-apply"
|
dotest="$GIT_DIR/rebase-apply"
|
||||||
sign= utf8=t keep= keepcr= skip= interactive= resolved= rebasing= abort=
|
sign= utf8=t keep= keepcr= skip= interactive= resolved= rebasing= abort=
|
||||||
resolvemsg= resume= scissors= no_inbody_headers=
|
messageid= resolvemsg= resume= scissors= no_inbody_headers=
|
||||||
git_apply_opt=
|
git_apply_opt=
|
||||||
committer_date_is_author_date=
|
committer_date_is_author_date=
|
||||||
ignore_date=
|
ignore_date=
|
||||||
allow_rerere_autoupdate=
|
allow_rerere_autoupdate=
|
||||||
gpg_sign_opt=
|
gpg_sign_opt=
|
||||||
|
|
||||||
|
if test "$(git config --bool --get am.messageid)" = true
|
||||||
|
then
|
||||||
|
messageid=t
|
||||||
|
fi
|
||||||
|
|
||||||
if test "$(git config --bool --get am.keepcr)" = true
|
if test "$(git config --bool --get am.keepcr)" = true
|
||||||
then
|
then
|
||||||
keepcr=t
|
keepcr=t
|
||||||
@ -400,6 +406,10 @@ it will be removed. Please do not use it anymore."
|
|||||||
utf8=t ;; # this is now default
|
utf8=t ;; # this is now default
|
||||||
--no-utf8)
|
--no-utf8)
|
||||||
utf8= ;;
|
utf8= ;;
|
||||||
|
-m|--message-id)
|
||||||
|
messageid=t ;;
|
||||||
|
--no-message-id)
|
||||||
|
messageid=f ;;
|
||||||
-k|--keep)
|
-k|--keep)
|
||||||
keep=t ;;
|
keep=t ;;
|
||||||
--keep-non-patch)
|
--keep-non-patch)
|
||||||
@ -567,6 +577,7 @@ Use \"git am --abort\" to remove it.")"
|
|||||||
echo "$sign" >"$dotest/sign"
|
echo "$sign" >"$dotest/sign"
|
||||||
echo "$utf8" >"$dotest/utf8"
|
echo "$utf8" >"$dotest/utf8"
|
||||||
echo "$keep" >"$dotest/keep"
|
echo "$keep" >"$dotest/keep"
|
||||||
|
echo "$messageid" >"$dotest/messageid"
|
||||||
echo "$scissors" >"$dotest/scissors"
|
echo "$scissors" >"$dotest/scissors"
|
||||||
echo "$no_inbody_headers" >"$dotest/no_inbody_headers"
|
echo "$no_inbody_headers" >"$dotest/no_inbody_headers"
|
||||||
echo "$GIT_QUIET" >"$dotest/quiet"
|
echo "$GIT_QUIET" >"$dotest/quiet"
|
||||||
@ -621,6 +632,12 @@ b)
|
|||||||
*)
|
*)
|
||||||
keep= ;;
|
keep= ;;
|
||||||
esac
|
esac
|
||||||
|
case "$(cat "$dotest/messageid")" in
|
||||||
|
t)
|
||||||
|
messageid=-m ;;
|
||||||
|
f)
|
||||||
|
messageid= ;;
|
||||||
|
esac
|
||||||
case "$(cat "$dotest/scissors")" in
|
case "$(cat "$dotest/scissors")" in
|
||||||
t)
|
t)
|
||||||
scissors=--scissors ;;
|
scissors=--scissors ;;
|
||||||
@ -692,7 +709,7 @@ do
|
|||||||
get_author_ident_from_commit "$commit" >"$dotest/author-script"
|
get_author_ident_from_commit "$commit" >"$dotest/author-script"
|
||||||
git diff-tree --root --binary --full-index "$commit" >"$dotest/patch"
|
git diff-tree --root --binary --full-index "$commit" >"$dotest/patch"
|
||||||
else
|
else
|
||||||
git mailinfo $keep $no_inbody_headers $scissors $utf8 "$dotest/msg" "$dotest/patch" \
|
git mailinfo $keep $no_inbody_headers $messageid $scissors $utf8 "$dotest/msg" "$dotest/patch" \
|
||||||
<"$dotest/$msgnum" >"$dotest/info" ||
|
<"$dotest/$msgnum" >"$dotest/info" ||
|
||||||
stop_here $this
|
stop_here $this
|
||||||
|
|
||||||
|
@ -85,6 +85,7 @@ test_expect_success setup '
|
|||||||
|
|
||||||
git format-patch --stdout first >patch1 &&
|
git format-patch --stdout first >patch1 &&
|
||||||
{
|
{
|
||||||
|
echo "Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>" &&
|
||||||
echo "X-Fake-Field: Line One" &&
|
echo "X-Fake-Field: Line One" &&
|
||||||
echo "X-Fake-Field: Line Two" &&
|
echo "X-Fake-Field: Line Two" &&
|
||||||
echo "X-Fake-Field: Line Three" &&
|
echo "X-Fake-Field: Line Three" &&
|
||||||
@ -536,4 +537,26 @@ test_expect_success 'am empty-file does not infloop' '
|
|||||||
test_i18ncmp expected actual
|
test_i18ncmp expected actual
|
||||||
'
|
'
|
||||||
|
|
||||||
|
test_expect_success 'am --message-id really adds the message id' '
|
||||||
|
rm -fr .git/rebase-apply &&
|
||||||
|
git reset --hard &&
|
||||||
|
git checkout HEAD^ &&
|
||||||
|
git am --message-id patch1.eml &&
|
||||||
|
test_path_is_missing .git/rebase-apply &&
|
||||||
|
git cat-file commit HEAD | tail -n1 >actual &&
|
||||||
|
grep Message-Id patch1.eml >expected &&
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
|
test_expect_success 'am --message-id -s signs off after the message id' '
|
||||||
|
rm -fr .git/rebase-apply &&
|
||||||
|
git reset --hard &&
|
||||||
|
git checkout HEAD^ &&
|
||||||
|
git am -s --message-id patch1.eml &&
|
||||||
|
test_path_is_missing .git/rebase-apply &&
|
||||||
|
git cat-file commit HEAD | tail -n2 | head -n1 >actual &&
|
||||||
|
grep Message-Id patch1.eml >expected &&
|
||||||
|
test_cmp expected actual
|
||||||
|
'
|
||||||
|
|
||||||
test_done
|
test_done
|
||||||
|
@ -35,6 +35,10 @@ do
|
|||||||
then
|
then
|
||||||
check_mailinfo $mail --no-inbody-headers
|
check_mailinfo $mail --no-inbody-headers
|
||||||
fi
|
fi
|
||||||
|
if test -f "$TEST_DIRECTORY"/t5100/msg$mail--message-id
|
||||||
|
then
|
||||||
|
check_mailinfo $mail --message-id
|
||||||
|
fi
|
||||||
'
|
'
|
||||||
done
|
done
|
||||||
|
|
||||||
|
5
t/t5100/info0012--message-id
Normal file
5
t/t5100/info0012--message-id
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
Author: Dmitriy Blinov
|
||||||
|
Email: bda@mnsspb.ru
|
||||||
|
Subject: Изменён список пакетов необходимых для сборки
|
||||||
|
Date: Wed, 12 Nov 2008 17:54:41 +0300
|
||||||
|
|
8
t/t5100/msg0012--message-id
Normal file
8
t/t5100/msg0012--message-id
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
textlive-* исправлены на texlive-*
|
||||||
|
docutils заменён на python-docutils
|
||||||
|
|
||||||
|
Действительно, оказалось, что rest2web вытягивает за собой
|
||||||
|
python-docutils. В то время как сам rest2web не нужен.
|
||||||
|
|
||||||
|
Signed-off-by: Dmitriy Blinov <bda@mnsspb.ru>
|
||||||
|
Message-Id: <1226501681-24923-1-git-send-email-bda@mnsspb.ru>
|
30
t/t5100/patch0012--message-id
Normal file
30
t/t5100/patch0012--message-id
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
howto/build_navy.txt | 6 +++---
|
||||||
|
1 files changed, 3 insertions(+), 3 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/howto/build_navy.txt b/howto/build_navy.txt
|
||||||
|
index 3fd3afb..0ee807e 100644
|
||||||
|
--- a/howto/build_navy.txt
|
||||||
|
+++ b/howto/build_navy.txt
|
||||||
|
@@ -119,8 +119,8 @@
|
||||||
|
- libxv-dev
|
||||||
|
- libusplash-dev
|
||||||
|
- latex-make
|
||||||
|
- - textlive-lang-cyrillic
|
||||||
|
- - textlive-latex-extra
|
||||||
|
+ - texlive-lang-cyrillic
|
||||||
|
+ - texlive-latex-extra
|
||||||
|
- dia
|
||||||
|
- python-pyrex
|
||||||
|
- libtool
|
||||||
|
@@ -128,7 +128,7 @@
|
||||||
|
- sox
|
||||||
|
- cython
|
||||||
|
- imagemagick
|
||||||
|
- - docutils
|
||||||
|
+ - python-docutils
|
||||||
|
|
||||||
|
#. на машине dinar: добавить свой открытый ssh-ключ в authorized_keys2 пользователя ddev
|
||||||
|
#. на своей машине: отредактировать /etc/sudoers (команда ``visudo``) примерно следующим образом::
|
||||||
|
--
|
||||||
|
1.5.6.5
|
Loading…
Reference in New Issue
Block a user