fix bug that repository with read can't be created...
...when git global user name and...
... | ... |
@@ -22,6 +22,8 @@ script/hypnotoad.pid |
22 | 22 |
extlib/* |
23 | 23 |
gitprep.my.conf |
24 | 24 |
data/rep/* |
25 |
+data/work/* |
|
26 |
+!data/work/.gitignore |
|
25 | 27 |
data/gitprep.db |
26 | 28 |
!data/rep/.gitignore |
27 | 29 |
setup/log/* |
... | ... |
@@ -11,6 +11,7 @@ |
11 | 11 |
- separete database creating logic to setup_database script |
12 | 12 |
- add name and mail column to user table. mail is required for user registration. |
13 | 13 |
- add user update page |
14 |
+ - fix bug that repository with read can't be created when git global user name and email |
|
14 | 15 |
1.12 (7 Feb 2016) |
15 | 16 |
- Catch up latest Github design. |
16 | 17 |
- Fix bug that relative image path in README.md and blob html. |
... | ... |
@@ -710,14 +710,35 @@ sub _create_rep { |
710 | 710 |
Gitprep::Util::run_command(@git_add_cmd) |
711 | 711 |
or croak "Can't execute git add: @git_add_cmd"; |
712 | 712 |
|
713 |
+ # Set user name |
|
714 |
+ my @git_config_user_name = $git->cmd_rep( |
|
715 |
+ $temp_work, |
|
716 |
+ "--work-tree=$temp_work", |
|
717 |
+ 'config', |
|
718 |
+ 'user.name', |
|
719 |
+ $user |
|
720 |
+ ); |
|
721 |
+ Gitprep::Util::run_command(@git_config_user_name) |
|
722 |
+ or croak "Can't execute git config: @git_config_user_name"; |
|
723 |
+ |
|
724 |
+ # Set user mail |
|
725 |
+ my $user_mail = $self->app->dbi->model('user')->select('mail', where => {id => $user})->value; |
|
726 |
+ my @git_config_user_mail = $git->cmd_rep( |
|
727 |
+ $temp_work, |
|
728 |
+ "--work-tree=$temp_work", |
|
729 |
+ 'config', |
|
730 |
+ 'user.email', |
|
731 |
+ "$user_mail" |
|
732 |
+ ); |
|
733 |
+ Gitprep::Util::run_command(@git_config_user_mail) |
|
734 |
+ or croak "Can't execute git config: @git_config_user_mail"; |
|
735 |
+ |
|
713 | 736 |
# Commit |
714 |
- my $author = "$user <$user\@localhost>"; |
|
715 | 737 |
my @git_commit_cmd = $git->cmd_rep( |
716 | 738 |
$temp_work, |
717 | 739 |
"--work-tree=$temp_work", |
718 | 740 |
'commit', |
719 | 741 |
'-q', |
720 |
- "--author=$author", |
|
721 | 742 |
'-m', |
722 | 743 |
'first commit' |
723 | 744 |
); |
... | ... |
@@ -279,7 +279,11 @@ |
279 | 279 |
% } |
280 | 280 |
% } else { |
281 | 281 |
<a class="btn btn-small" href="<%= url_for("/$user/$project/compare/$bname") %>"> |
282 |
- Compare |
|
282 |
+ % if ($api->logined) { |
|
283 |
+ New pull request |
|
284 |
+ % } else { |
|
285 |
+ Compare |
|
286 |
+ % } |
|
283 | 287 |
</a> |
284 | 288 |
% if ($api->logined($user)) { |
285 | 289 |
<form action="<%= url_for->query(op => 'delete') %>" method="post" style="display:inline-block"> |
... | ... |
@@ -127,7 +127,7 @@ note 'Admin page'; |
127 | 127 |
$t->content_like(qr/Two password/); |
128 | 128 |
|
129 | 129 |
# Create user |
130 |
- $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', name => 'Kimoto', mail => 'kimoto@foo.com', password => 'a', password2 => 'a'}); |
|
130 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', name => 'Kimoto', mail => 'kimoto@gitprep.example', password => 'a', password2 => 'a'}); |
|
131 | 131 |
$t->content_like(qr/Success.*created/); |
132 | 132 |
} |
133 | 133 |
|
... | ... |
@@ -136,7 +136,7 @@ note 'Admin page'; |
136 | 136 |
$t->content_like(qr/Admin Users/); |
137 | 137 |
$t->content_like(qr/kimoto/); |
138 | 138 |
$t->content_like(qr/Kimoto/); |
139 |
- $t->content_like(qr/kimoto\@foo\.com/); |
|
139 |
+ $t->content_like(qr/kimoto\@gitprep\.example/); |
|
140 | 140 |
|
141 | 141 |
note 'Admin page - Reset password'; |
142 | 142 |
{ |
... | ... |
@@ -165,19 +165,19 @@ note 'Admin page'; |
165 | 165 |
note 'Admin page - Update user'; |
166 | 166 |
{ |
167 | 167 |
# Create user |
168 |
- $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-update', name => 'Kimoto-Update', mail => 'kimoto-update@foo.com', password => 'a', password2 => 'a'}); |
|
168 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-update', name => 'Kimoto-Update', mail => 'kimoto-update@gitprep.example', password => 'a', password2 => 'a'}); |
|
169 | 169 |
$t->content_like(qr/kimoto-update/); |
170 | 170 |
|
171 | 171 |
# Update user |
172 |
- $t->post_ok('/_admin/user/update?op=update', form => {id => 'kimoto-update', name => 'Kimoto-Update2', mail => 'kimoto-update2@foo.com'}); |
|
172 |
+ $t->post_ok('/_admin/user/update?op=update', form => {id => 'kimoto-update', name => 'Kimoto-Update2', mail => 'kimoto-update2@gitprep.example'}); |
|
173 | 173 |
$t->content_like(qr/Kimoto-Update2/); |
174 |
- $t->content_like(qr/kimoto-update2\@foo\.com/); |
|
174 |
+ $t->content_like(qr/kimoto-update2\@gitprep\.example/); |
|
175 | 175 |
} |
176 | 176 |
|
177 | 177 |
note 'Admin page - Delete user'; |
178 | 178 |
{ |
179 | 179 |
# Create user |
180 |
- $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-tmp', mail => 'kimoto-tmp@foo.com', password => 'a', password2 => 'a'}); |
|
180 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto-tmp', mail => 'kimoto-tmp@gitprep.example', password => 'a', password2 => 'a'}); |
|
181 | 181 |
$t->content_like(qr/kimoto-tmp/); |
182 | 182 |
$t->get_ok('/_admin/users'); |
183 | 183 |
$t->content_like(qr/kimoto-tmp/); |
... | ... |
@@ -229,9 +229,9 @@ note 'Reset password'; |
229 | 229 |
$t->content_like(qr/Admin/); |
230 | 230 |
|
231 | 231 |
# Create user |
232 |
- $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', mail => 'kimoto1@foo.com', password => 'a', password2 => 'a'}); |
|
232 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', mail => 'kimoto1@gitprep.example', password => 'a', password2 => 'a'}); |
|
233 | 233 |
$t->content_like(qr/kimoto1/); |
234 |
- $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@foo.com', password => 'a', password2 => 'a'}); |
|
234 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@gitprep.example', password => 'a', password2 => 'a'}); |
|
235 | 235 |
$t->content_like(qr/kimoto2/); |
236 | 236 |
|
237 | 237 |
# Logout |
... | ... |
@@ -276,9 +276,9 @@ note 'Profile'; |
276 | 276 |
$t->post_ok('/_login?op=login', form => {id => 'admin', password => 'a'}); |
277 | 277 |
|
278 | 278 |
# Create user |
279 |
- $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', mail => 'kimoto1@foo.com', password => 'a', password2 => 'a'}); |
|
279 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto1', mail => 'kimoto1@gitprep.example', password => 'a', password2 => 'a'}); |
|
280 | 280 |
$t->content_like(qr/kimoto1/); |
281 |
- $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@foo.com', password => 'a', password2 => 'a'}); |
|
281 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@gitprep.example', password => 'a', password2 => 'a'}); |
|
282 | 282 |
$t->content_like(qr/kimoto2/); |
283 | 283 |
|
284 | 284 |
# Login as kimoto1 |
... | ... |
@@ -323,7 +323,7 @@ note 'Profile'; |
323 | 323 |
$t->content_like(qr/first commit/); |
324 | 324 |
$t->content_like(qr/t2\.git/); |
325 | 325 |
$t->content_like(qr/README\.md/); |
326 |
- $t->content_like(qr/kimoto1\@localhost/); |
|
326 |
+ $t->content_like(qr/kimoto1\@gitprep\.example/); |
|
327 | 327 |
$t->content_like(qr/Hello/); |
328 | 328 |
|
329 | 329 |
# Settings page(don't has README) |
... | ... |
@@ -566,9 +566,9 @@ note 'Private repository and collaborator'; |
566 | 566 |
$t->content_like(qr/Admin/); |
567 | 567 |
|
568 | 568 |
# Create user |
569 |
- $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', mail => 'kimoto@foo.com', password => 'a', password2 => 'a'}); |
|
569 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto', mail => 'kimoto@gitprep.example', password => 'a', password2 => 'a'}); |
|
570 | 570 |
$t->content_like(qr/Success.*created/); |
571 |
- $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@foo.com', password => 'a', password2 => 'a'}); |
|
571 |
+ $t->post_ok('/_admin/user/create?op=create', form => {id => 'kimoto2', mail => 'kimoto2@gitprep.example', password => 'a', password2 => 'a'}); |
|
572 | 572 |
$t->content_like(qr/Success.*created/); |
573 | 573 |
|
574 | 574 |
# Login as kimoto |