This project is archived and is in readonly mode.

#3743 ✓invalid
Nate Wiger

script/plugin install git://whatever does nothing

Reported by Nate Wiger | January 19th, 2010 @ 02:17 AM | in 3.0.2

Been this way for a while. Borked in 2.3 and 3.0pre. Either script/plugin should be removed or it should really be fixed :-(

[nwiger@sliver:testapp]$ script/plugin install git://github.com/fesplugas/typus.git
Initialized empty Git repository in /Users/nwiger/Workspace/testapp/vendor/plugins/typus/.git/
[nwiger@sliver:testapp]$ ll vendor/plugins/
total 0
drwxr-xr-x  3 nwiger  staff  102 Jan 18 08:09 .
drwxr-xr-x  4 nwiger  staff  136 Jan 18 08:08 ..
-rw-r--r--  1 nwiger  staff    0 Jan 18 08:08 .gitkeep

Comments and changes to this ticket

  • Rizwan Reza

    Rizwan Reza January 19th, 2010 @ 06:41 AM

    It doesn't give me any problems. What git version are you using?

  • Nate Wiger

    Nate Wiger January 21st, 2010 @ 11:19 PM

    [nwiger@example.com]$ git --version

      git version 1.5.6
      [nwiger@example.com]$ which git
      /usr/local/bin/git
      [nwiger@example.com]$ uname -a
      Darwin example.com 9.8.0 Darwin Kernel Version 9.8.0: Wed Jul 15 16:55:01 PDT 2009; root:xnu-1228.15.4~1/RELEASE_I386 i386
    
  • Nate Wiger

    Nate Wiger January 21st, 2010 @ 11:58 PM

    • Tag changed from 3.0pre, bug, plugin, scriptplugin to 2.3.5, 3.0pre, bug, patch, plugin, scriptplugin

    Updated to latest git from git-scm.com, and Rails 2.3.5, and it still fails.

    The reason is that it appears rails-2.3.5/lib/commands/plugin.rb is trying use git pull to grab the plugin code (see the install_using_git method), which doesn't work right.

    Example: script/plugin install git://github.com/fesplugas/typus.git

    mkdir vendor/plugins/typus
    cd vendor/plugins/typus
    git init
    git pull --depth 1 git://github.com/fesplugas/typus.git
    

    That last line exits 1, but that error is being masked by the install_using_git method, and the directory is just rm -rf'ed.

    I'm not sure the reasoning behind git init then git pull since a simple git clone works:

    cd vendor/plugins
    git clone -q git://github.com/fesplugas/typus.git
    

    The following patch to the install_using_git method fixes the issue.

    I also tested using a template, which now works: rails typustest -m http://gist.github.com/86613.txt

  • Prem Sichanugrist (sikachu)

    Prem Sichanugrist (sikachu) February 2nd, 2010 @ 08:29 AM

    • State changed from “new” to “invalid”

    Sorry, but I can't reproduce this problem on both 2.3.5 and master

    I don't really know why they were doing init and pull, but doing so will leave you with plugin which not on any branch, and not tracking the remote.

  • Nate Wiger

    Nate Wiger February 5th, 2010 @ 04:32 AM

    WOW, Prem, thanks a ton. You have been so helpful. So let me get this straight:

    • I give you an exact version of git to use
    • I give you exact steps to follow
    • I give you a patch to FIX the problem

    And you close the ticket as invalid.

    Did you actually try any of the above three?

    If I'm hitting this, it means other people are too. I will be glad to help track it down further, and of course there's always the possibility that it's a configuration/firewall/SSH problem on my end. But EITHER WAY, even if that is the case, at the very least this ticket should result in improved documentation.

    Please reopen, you can email me directly so we can sort this out.

    Nate Wiger
    PlayStation

  • Matt Aimonetti (mattetti)

    Matt Aimonetti (mattetti) February 5th, 2010 @ 05:00 AM

    • State changed from “invalid” to “open”
    • Assigned user set to “Matt Aimonetti (mattetti)”
    • Milestone cleared.

    Thanks Nate, that seems like a valid problem to me. The generator moved in rails3 and your patch won't apply.
    Give me some time to review the different options and make sure we cover all cases (like trying to install to update a plugin from a got repo) and even maybe ping some git experts to see what they think.

    • Matt
  • Prem Sichanugrist (sikachu)

    Prem Sichanugrist (sikachu) February 6th, 2010 @ 03:54 PM

    • State changed from “open” to “incomplete”

    I've tried my best, Nate. I spent a whole day of my time building an ubuntu 9.10 VM, and then install Git 1.5.6 on it. Sorry, but I couldn't reproduce your problem.

    Here's my output:

    sikachu@sikachu-ubuntu:~$ cd blog
    sikachu@sikachu-ubuntu:~/blog$ git --version
    git version 1.5.6
    sikachu@sikachu-ubuntu:~/blog$ which git
    /usr/local/bin/git
    sikachu@sikachu-ubuntu:~/blog$ uname -a
    Linux sikachu-ubuntu 2.6.31-14-server #48-Ubuntu SMP Fri Oct 16 15:07:34 UTC 2009 x86_64 GNU/Linux
    sikachu@sikachu-ubuntu:~/blog$ script/plugin install git://github.com/fesplugas/typus.git
    Initialized empty Git repository in /home/sikachu/blog/vendor/plugins/typus/.git/
    warning: no common commits
    remote: Counting objects: 297, done.
    remote: Compressing objects: 100% (254/254), done.
    remote: Total 297 (delta 23), reused 155 (delta 3)
    Receiving objects: 100% (297/297), 155.98 KiB | 35 KiB/s, done.
    Resolving deltas: 100% (23/23), done.
    From git://github.com/fesplugas/typus
     * branch            HEAD       -> FETCH_HEAD
    sikachu@sikachu-ubuntu:~/blog$ ls -la vendor/plugins/
    total 12
    drwxr-xr-x 3 sikachu sikachu 4096 2010-02-06 22:36 .
    drwxr-xr-x 3 sikachu sikachu 4096 2010-02-06 21:29 ..
    drwxr-xr-x 9 sikachu sikachu 4096 2010-02-06 22:36 typus
    

    I also tried using your template, and it also installed fine.

    From your suggestion, if you change git init; git pull combination to git clone, it will break the ability to specify a revision you want to fetch since git clone doesn't support it.

    However, to update the documentation of something is always useful. Could you resubmit the patch to update the documentation? Git looks like a black box to me, and I don't know that there's a way to debug what's going on and made your installation fail.

  • Nate Wiger

    Nate Wiger February 12th, 2010 @ 11:39 PM

    I tracked this down to a conflict with ~/.gitconfig. If I remove these lines it works:

     [branch "master"]
       remote = origin
       merge = refs/heads/master
    

    It appears a naked git pull has problems with these settings.

    It's probably fair to say this should be a little footnote/gotcha somewhere in the plugin documentation. Where should it go?

  • Rizwan Reza

    Rizwan Reza March 28th, 2010 @ 11:47 AM

    Is this still a problem, Nate?

  • Nate Wiger

    Nate Wiger March 28th, 2010 @ 04:43 PM

    You can close it. My last post showed how to fix it.

  • Rizwan Reza

    Rizwan Reza March 28th, 2010 @ 04:53 PM

    • State changed from “incomplete” to “invalid”
  • Jeremy Kemper

    Jeremy Kemper October 15th, 2010 @ 11:01 PM

    • Milestone set to 3.0.2
    • Importance changed from “” to “Medium”
  • Dan Croak

    Dan Croak December 30th, 2010 @ 05:37 PM

    I just hit this problem as well on Rails 3.0.3. Removing the lines Nate identified solved the problem but it seems like there should be some smart code in Rails so it "just works" since it's so common for people to have this in their ~/.gitconfig:

    [branch "master"]
      remote = origin
      merge = refs/heads/master
    

    I'd be happy to have a hand at a patch if folks agree Rails should try to handle this.

  • bingbing

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>

Attachments

Pages