Error "Undefined local variable or method `path' for main:Object"

Issue #21 resolved
Matthieu Moquet created an issue

Hello,

I post here an issue I currently have when using the pull-request or browse commands. I don't know ruby well to understand the problem. Is here the stack trace:

➜ stash --version
Atlassian Stash CLI 0.3.0

➜ stash pull-request master --trace
/Library/Ruby/Gems/2.0.0/gems/atlassian-stash-0.3.0/bin/stash:31:in `repo_config': undefined local variable or method `path' for main:Object (NameError)
    from /Library/Ruby/Gems/2.0.0/gems/atlassian-stash-0.3.0/bin/stash:69:in `extract_reviewers'
    from /Library/Ruby/Gems/2.0.0/gems/atlassian-stash-0.3.0/bin/stash:94:in `block (2 levels) in <top (required)>'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/command.rb:180:in `call'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/command.rb:155:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/runner.rb:422:in `run_active_command'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/runner.rb:82:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/delegates.rb:8:in `run!'
    from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/import.rb:10:in `block in <top (required)>'

Thanks for your help.

Comments (21)

  1. Joanne Daudier

    I have the same bug. It happened after I upgraded to the latest version. Help please!

    I also ran stash configure already.

    /Library/Ruby/Gems/2.0.0/gems/atlassian-stash-0.3.0/bin/stash:31:in `repo_config': undefined local variable or method `path' for main:Object (NameError)
        from /Library/Ruby/Gems/2.0.0/gems/atlassian-stash-0.3.0/bin/stash:23:in `load_config'
        from /Library/Ruby/Gems/2.0.0/gems/atlassian-stash-0.3.0/bin/stash:119:in `block (2 levels) in <top (required)>'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/command.rb:180:in `call'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/command.rb:180:in `call'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/command.rb:155:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/runner.rb:422:in `run_active_command'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/runner.rb:82:in `run!'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/delegates.rb:8:in `run!'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/import.rb:10:in `block in <top (required)>'
    
  2. Matthieu Moquet reporter

    Yes, I already ran stash configure.

    In fact, I was using the stash clt for several weeks now and it suddenly stop working yesterday.

    I updated my git binary to (from 1.x to 2.x) last week, and the stash command said something like "stash requires using git 1.9.6 or above (you're using git 2.1.2), you should upgrade it." (that was a nonsense, but it was just a warning, the command still worked). I was using ruby 1.9.3 and then (I don't know why) it displayed me that error message.

    I've upgraded my ruby version to 2.0, the git version warning disappear, but the command is still not working.

  3. Joanne Daudier

    @sebr Hi Seb: Any update on this bug? This was working for me until I upgraded to the latest Stash CLI version. If you can't fix the bug, can you tell me how I can revert back to my previous version?

  4. Matthieu Moquet reporter

    Btw my ~/.stashconfig.yml looks like:

    ---
    stash_url: https://stash.example.net/
    username: foobar
    
  5. Seb Ruiz Account Deactivated

    Hi all, can you please update your gem to v 0.3.1 – I believe I have fixed the issue, but would be great to get some verification.

    Sorry for the inconvenience!

  6. Seb Ruiz Account Deactivated

    Update the version of the command line tools you are using to the latest release - 0.3.1

  7. Joanne Daudier

    @sebr I did and this is the error i'm getting now...

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/uri/common.rb:267:in `extract': undefined method `scan' for nil:NilClass (NoMethodError)
        from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/uri/common.rb:813:in `extract'
        from /Library/Ruby/Gems/2.0.0/gems/atlassian-stash-0.3.1/lib/atlassian/stash/git.rb:20:in `get_remote_url'
        from /Library/Ruby/Gems/2.0.0/gems/atlassian-stash-0.3.1/bin/stash:126:in `block (2 levels) in <top (required)>'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/command.rb:180:in `call'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/command.rb:180:in `call'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/command.rb:155:in `run'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/runner.rb:422:in `run_active_command'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/runner.rb:82:in `run!'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/delegates.rb:8:in `run!'
        from /Library/Ruby/Gems/2.0.0/gems/commander-4.1.6/lib/commander/import.rb:10:in `block in <top (required)>'
    
  8. Seb Ruiz Account Deactivated

    Thanks - can you please:

    • show me the complete command you are running
    • paste the output of git remote -v.
  9. Joanne Daudier
    origin  http://jdaudier@git.infor.com/scm/~jdaudier/rhythm-prod.git (fetch)
    origin  http://jdaudier@git.infor.com/scm/~jdaudier/rhythm-prod.git (push)
    upstream    ssh://git@git.infor.com:7999/rhy/rhythm-prod.git (fetch)
    upstream    ssh://git@git.infor.com:7999/rhy/rhythm-prod.git (push)
    
  10. Seb Ruiz Account Deactivated

    Thanks Joanne. I believe the issue is that it was picking up the incorrect remote. I think I have fixed it, and have added much better logging when something goes wrong. Version 0.3.2 has been released – if you could please try it out and let me know if you have any further troubles that would be v helpful.

    Thanks!

  11. Joanne Daudier

    Cool! Works now. Is there a way to alias a stash command with arguments? When I pull down a PR for review, I do this git fetch upstream refs/pull-requests/$PR_NO/from:$NEW_LOCAL_BRANCH

    I want to be able to fill in the PR_NO and NEW_LOCAL_BRANCH via the terminal command.

  12. Joanne Daudier

    I can but git alias doesn't allow you to pass in variables does it? I need to pass in arguments for the PR # and branch name.

  13. Seb Ruiz Account Deactivated

    I linked you to the section of the help page titled "Advanced aliases with arguments"

  14. Joanne Daudier

    Oh I see. I couldn't figure out how to do it though. Any tips?

    I tried adding this alias in my .gitconfig but it didn't work

    pr = !sh -c 'fetch upstream refs/pull-requests/$1/from:$2'

  15. Joanne Daudier

    Also, how do I use this alias from my terminal? I tried a couple of different ways with no success.

    create-pull-request = !sh -c 'stash pull-request $0'

  16. Log in to comment