aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--brep/submit/submit-git.in39
-rw-r--r--tests/submit/submit-git.test6
2 files changed, 41 insertions, 4 deletions
diff --git a/brep/submit/submit-git.in b/brep/submit/submit-git.in
index 2f90217..badc084 100644
--- a/brep/submit/submit-git.in
+++ b/brep/submit/submit-git.in
@@ -183,6 +183,35 @@ set -o errtrace # Trap ERR in functions.
@import brep/submit/submit@
@import brep/submit/submit-git@
+# Parse the command line options.
+#
+committer_name="Submission Handler"
+committer_email="noreply@example.com"
+
+while [ $# -gt 0 ]; do
+ case $1 in
+ --committer-name)
+ shift
+ committer_name="$1"
+ shift
+ ;;
+ --committer-email)
+ shift
+ committer_email="$1"
+ shift
+ ;;
+ *)
+ break; # The end of options is encountered.
+ ;;
+ esac
+done
+
+if [ -z "$committer_name" -o -z "$committer_email" ]; then
+ error "$usage"
+fi
+
+# Parse the command line arguments.
+#
if [ "$#" -lt 2 -o "$#" -gt 3 ]; then
error "$usage"
fi
@@ -566,7 +595,15 @@ for i in {1..11}; do
git_add "$tgt_dir" "${a#$tgt_dir/}"
- run git -C "$tgt_dir" commit $gqo $gvo -F - <<EOF >&2
+ if [ -n "$email" ]; then
+ e="$email"
+ else
+ e="$committer_email"
+ fi
+
+ GIT_AUTHOR_EMAIL="$e" \
+ run git -c "user.name=$committer_name" -c "user.email=$committer_email" \
+-C "$tgt_dir" commit $gqo $gvo -F - <<EOF >&2
Add $name/$version to $s/$project
$(cat "$data_dir/request.manifest")
diff --git a/tests/submit/submit-git.test b/tests/submit/submit-git.test
index 5a73d65..20745ed 100644
--- a/tests/submit/submit-git.test
+++ b/tests/submit/submit-git.test
@@ -61,13 +61,13 @@ pkg_ctl="$prj_ctl/hello.git"
: none
:
$* 2>>~%EOE% != 0
- %\[.+\] \[brep:error\] \[ref \] \[brep-submit-git\]: usage: .+brep-submit-git <tgt-repo> \[<ref-repo>\] <dir>%
+ %\[.+\] \[brep:error\] \[ref \] \[brep-submit-git\]: usage: .+brep-submit-git \[<options>\] <tgt-repo> \[<ref-repo>\] <dir>%
EOE
: dir-only
:
$* $~/dir 2>>~%EOE% != 0
- %\[.+\] \[brep:error\] \[ref dir\] \[brep-submit-git\]: usage: .+brep-submit-git <tgt-repo> \[<ref-repo>\] <dir>%
+ %\[.+\] \[brep:error\] \[ref dir\] \[brep-submit-git\]: usage: .+brep-submit-git \[<options>\] <tgt-repo> \[<ref-repo>\] <dir>%
EOE
: ref-not-exist
@@ -126,7 +126,7 @@ pkg_ctl="$prj_ctl/hello.git"
git -C tgt log -1 >>~%EOO%
%commit .+%
- %Author: .+%
+ %Author: Submission Handler <user@example.org>%
%Date: .+%
Add libhello/0.1.0 to 1/alpha/hello