Skip to content

Failed to create repo with Redmin 3.4.2.stable #34

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
guss77 opened this issue Oct 11, 2017 · 10 comments · Fixed by #37
Closed

Failed to create repo with Redmin 3.4.2.stable #34

guss77 opened this issue Oct 11, 2017 · 10 comments · Fixed by #37

Comments

@guss77
Copy link

guss77 commented Oct 11, 2017

My System:

Environment:
  Redmine version                3.4.2.stable
  Ruby version                   2.4.1-p111 (2017-03-22) [x86_64-linux]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               Mysql2
SCM:
  Subversion                     1.8.10
  Mercurial                      3.1.2
  Bazaar                         2.7.0
  Git                            2.1.4
  Filesystem                     
  GitRemote                      2.1.4
Redmine plugins:
  redmine_changeauthor           1.0.1
  redmine_git_remote             0.0.1
  redmine_omniauth_google        0.0.1
  time_logger                    0.5.4

This used to work, but after upgrading redmine to 3.4.2.stable, I can no longer create new GitRemote repositories. When I do I get a crash report. The log says:

NoMethodError (undefined method `[]' for nil:NilClass):
  plugins/redmine_git_remote/app/models/repository/git_remote.rb:78:in `initialize_clone'
  app/controllers/repositories_controller.rb:46:in `create'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

Looking further into it, it seems that Repository doesn't populate extra_info any more. I've added a debug log in git_remote.rb line 78, and attributes there contains:

... "login"=>"", "password"=>"", "root_url"=>"", "type"=>"Repository::GitRemote", 
"path_encoding"=>nil, "log_encoding"=>nil, "extra_info"=>nil, "identifier"=>"my-repo", 
"is_default"=>true, ...
@guss77
Copy link
Author

guss77 commented Oct 30, 2017

I've found a workaround:

  1. By providing a "Path to repository" value, even though the note says I don't have to, the repository gets created - though then trying to access the repository throws an error, again about missing extra_info.
  2. I then open the database and look at the repositories table and see that the field extra_info is empty for the new repository. I then update the table with a YAML text to set the extra_clone_url field like this: update repositories set extra_info = '---\nextra_clone_url: <remote-git-url>\n' where id = <repositor-id>; (with the actual values for the URL and repository database id).

After that, the first try to load the repository will fail with a warning about an unknown version, but a subsequent load will succeed to download the repository.

@ChristineATA
Copy link

Hi,
I have the same exact problem, but your workaround does not work for me.
My sytem :

Environment:
  Redmine version                3.4.3.stable
  Ruby version                   2.1.5-p273 (2014-11-13) [x86_64-linux-gnu]
  Rails version                  4.2.8
  Environment                    production
  Database adapter               Mysql2 
SCM:
  Git                            2.1.4
  Filesystem                     
  GitRemote                      2.1.4

And the error :

NoMethodError (undefined method `[]' for nil:NilClass):
  plugins/redmine_git_remote/app/models/repository/git_remote.rb:78:in `initialize_clone'
  app/controllers/repositories_controller.rb:46:in `create'
  lib/redmine/sudo_mode.rb:63:in `sudo_mode'

I could create the row by hand but i don't know how the plugin populate the fields.
Do your have an example ?

Thanks.

@jcppkkk
Copy link

jcppkkk commented Nov 17, 2017

This commits fix the create problem
Chevich123/redmine_git_remote@04d5f40

@guss77
Copy link
Author

guss77 commented Nov 17, 2017

@jcppkkk 's patch indeed solves the problem - nicely done! If you can create a pull request that would be great!

@dergachev
Copy link
Owner

dergachev commented Nov 17, 2017 via email

@ChristineATA
Copy link

Hi,

@jcppkkk patch is working for me too, thanks a lot !

@danielecr
Copy link

@jcppkkk Thank you, it works

@ferricoxide
Copy link

@jcppkkk patch fixes things: any chance that either @jcppkkk can submit a PR for @dergachev to merge or, since it's been a few months since this thread was opened and the fix has been verified by several people, just update the main trunk? I can submit a PR if @jcppkkk is unable and PR's the only way it will get in, but I don't want to submit the patch as though it were my own.

I just need this in the main trunk as soon as possible because I've got my RedMine deployed via an autoscaling group and manually-patching is pretty much a non-starter. I'd rather not have to have my own fork if I can avoid it. ;)

@dergachev
Copy link
Owner

@shahinam is looking at this

@shahinam
Copy link
Collaborator

shahinam commented Mar 2, 2018

@dergachev PR looks good. I have tested with Redmine 3.4 and also with 3.3.

shahinam added a commit that referenced this issue Mar 7, 2018
Add extra_info to safe_attributes. fix #34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants