Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emulab-devel
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
143
Issues
143
List
Boards
Labels
Service Desk
Milestones
Merge Requests
6
Merge Requests
6
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
emulab
emulab-devel
Commits
1ec3af6c
Commit
1ec3af6c
authored
Aug 20, 2013
by
Robert Ricci
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
First working version!
parent
5a4ed942
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
2 deletions
+30
-2
tools/git/gitmaild
tools/git/gitmaild
+30
-2
No files found.
tools/git/gitmaild
View file @
1ec3af6c
...
...
@@ -29,6 +29,7 @@ print "GITMAIL is $GITMAIL\n";
my
$TOKEN
=
"";
my
$BASEURL
=
"
http://git.flux.utah.edu/
";
my
$BASEPATH
=
"
/home/git/repositories
";
my
$DEFAULT_ARCHIVEMAIL
=
'
ricci@cs.utah.edu
';
sub
run_gitmail
($);
...
...
@@ -74,11 +75,28 @@ sub run_gitmail($) {
my
$repodir
=
$BASEPATH
.
"
/
"
.
$repoinfo
->
{"
path_with_namespace
"}
.
"
.git
";
chdir
$repodir
;
my
%options
;
$options
{'
archivemail
'}
=
$DEFAULT_ARCHIVEMAIL
;
$options
{'
mailfrom
'}
=
$userinfo
->
{
name
}
.
"
<
"
.
$userinfo
->
{
email
}
.
"
>
";
my
$optionstr
=
format_options
(
%options
);
print
"
optionstr is '
$optionstr
'
\n
";
#
# Run gitmail in test mode for now
#
my
$pid
=
open3
(
\
*CHLD_IN
,
\
*CHLD_OUT
,
\
*CHLD_ERR
,
"
$GITMAIL
-d -t
");
my
$pid
=
open3
(
\
*CHILD_IN
,
\
*CHILD_OUT
,
\
*CHILD_ERR
,
"
$GITMAIL
$optionstr
");
#
# Pass along the commit information we were given, in the form expected
# by a git commit hook
#
print
CHILD_IN
$refline
.
"
\n
";
close
CHILD_IN
;
waitpid
$pid
,
0
;
print
STDOUT
<
CHILD_OUT
>
;
print
STDOUT
<
CHILD_ERR
>
;
...
...
@@ -101,3 +119,13 @@ sub call_gitlab_api($) {
# Error checking
return
decode_json
(
$response
->
content
);
}
#
# Re-format a hash as a string sutable for passing to gitmail
# TODO: support mutiple options
# TODO: proper command line escaping
#
sub
format_options
(@)
{
my
%opt
=
@_
;
return
join
("
",
map
{
"
-o
"
.
$_
.
"
='
$opt
{
$_
}'
"}
keys
%opt
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment