File tree Expand file tree Collapse file tree 2 files changed +29
-28
lines changed Expand file tree Collapse file tree 2 files changed +29
-28
lines changed Original file line number Diff line number Diff line change @@ -483,34 +483,8 @@ fi >>"$GIT_DIR"/COMMIT_EDITMSG
483
483
# Author
484
484
if test ' ' ! = " $use_commit "
485
485
then
486
- pick_author_script='
487
- /^author /{
488
- s/' \' ' /' \' ' \\' \'\' ' /g
489
- h
490
- s/^author \([^<]*\) <[^>]*> .*$/\1/
491
- s/' \' ' /' \' ' \' \'\' ' /g
492
- s/.*/GIT_AUTHOR_NAME=' \' ' &' \' ' /p
493
-
494
- g
495
- s/^author [^<]* <\([^>]*\)> .*$/\1/
496
- s/' \' ' /' \' ' \' \'\' ' /g
497
- s/.*/GIT_AUTHOR_EMAIL=' \' ' &' \' ' /p
498
-
499
- g
500
- s/^author [^<]* <[^>]*> \(.*\)$/\1/
501
- s/' \' ' /' \' ' \' \'\' ' /g
502
- s/.*/GIT_AUTHOR_DATE=' \' ' &' \' ' /p
503
-
504
- q
505
- }
506
- '
507
- encoding=$( git config i18n.commitencoding || echo UTF-8)
508
- set_author_env=` git show -s --pretty=raw --encoding=" $encoding " " $use_commit " |
509
- LANG=C LC_ALL=C sed -ne " $pick_author_script " `
510
- eval " $set_author_env "
511
- export GIT_AUTHOR_NAME
512
- export GIT_AUTHOR_EMAIL
513
- export GIT_AUTHOR_DATE
486
+ eval " $( get_author_ident_from_commit " $use_commit " ) "
487
+ export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL GIT_AUTHOR_DATE
514
488
fi
515
489
if test ' ' ! = " $force_author "
516
490
then
Original file line number Diff line number Diff line change @@ -53,6 +53,33 @@ require_work_tree () {
53
53
die " fatal: $0 cannot be used without a working tree."
54
54
}
55
55
56
+ get_author_ident_from_commit () {
57
+ pick_author_script='
58
+ /^author /{
59
+ s/' \' ' /' \' ' \\' \'\' ' /g
60
+ h
61
+ s/^author \([^<]*\) <[^>]*> .*$/\1/
62
+ s/' \' ' /' \' ' \' \'\' ' /g
63
+ s/.*/GIT_AUTHOR_NAME=' \' ' &' \' ' /p
64
+
65
+ g
66
+ s/^author [^<]* <\([^>]*\)> .*$/\1/
67
+ s/' \' ' /' \' ' \' \'\' ' /g
68
+ s/.*/GIT_AUTHOR_EMAIL=' \' ' &' \' ' /p
69
+
70
+ g
71
+ s/^author [^<]* <[^>]*> \(.*\)$/\1/
72
+ s/' \' ' /' \' ' \' \'\' ' /g
73
+ s/.*/GIT_AUTHOR_DATE=' \' ' &' \' ' /p
74
+
75
+ q
76
+ }
77
+ '
78
+ encoding=$( git config i18n.commitencoding || echo UTF-8)
79
+ git show -s --pretty=raw --encoding=" $encoding " " $1 " |
80
+ LANG=C LC_ALL=C sed -ne " $pick_author_script "
81
+ }
82
+
56
83
if [ -z " $LONG_USAGE " ]
57
84
then
58
85
LONG_USAGE=" Usage: $0 $USAGE "
You can’t perform that action at this time.
0 commit comments