<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -210,8 +210,10 @@ module GHI::CLI #:nodoc:
 
       remotes = `git config --get-regexp remote\..+\.url`.split /\n/
       repo_expression = %r{([^:/]+)/([^/\s]+)(?:\.git)$}
-      remotes.find { |r| r.include? &quot;github.com&quot; }.match repo_expression
-      @user, @repo = $1, $2
+      if remote = remotes.find { |r| r.include? &quot;github.com&quot; }
+        remote.match repo_expression
+        @user, @repo = $1, $2
+      end
 
       option_parser.parse!(*args)
 </diff>
      <filename>lib/ghi/cli.rb</filename>
    </modified>
    <modified>
      <diff>@@ -19,7 +19,6 @@ describe GHI::CLI::Executable do
       end
 
       after :each do
-        @cli.stub!(:`).and_return &quot;stub@github.com:localuser/ghi.git&quot;
         @cli.should_receive(@action)
         @cli.parse! @args
         @cli.action.should == @action
@@ -38,175 +37,186 @@ describe GHI::CLI::Executable do
         end
       end
 
-      it &quot;should parse -l as list open&quot; do
-        @args = [&quot;-l&quot;]
-        @action, @state = :list, :open
+      it &quot;should always parse -r&quot; do
+        @args = [&quot;-rremoteuser/remoterepo&quot;, &quot;-l&quot;]
+        @action, @state, @user, @repo = :list, :open, &quot;remoteuser&quot;, &quot;remoterepo&quot;
       end
 
-      it &quot;should parse -lo as list open&quot; do
-        @args = [&quot;-lo&quot;]
-        @action, @state = :list, :open
-      end
+      describe &quot;inside a repository&quot; do
+        after :each do
+          @cli.stub!(:`).and_return &quot;stub@github.com:localuser/ghi.git&quot;
+        end
 
-      it &quot;should parse -lc as list closed&quot; do
-        @args = [&quot;-lc&quot;]
-        @action, @state = :list, :closed
-      end
+        it &quot;should parse -l as list open&quot; do
+          @args = [&quot;-l&quot;]
+          @action, @state = :list, :open
+        end
 
-      it &quot;should parse -l2 as show issue 2&quot; do
-        @args = [&quot;-l2&quot;]
-        @action, @number = :show, 2
-      end
+        it &quot;should parse -lo as list open&quot; do
+          @args = [&quot;-lo&quot;]
+          @action, @state = :list, :open
+        end
 
-      it &quot;should parse -l 'term' as search open for 'term'&quot; do
-        @args = [&quot;-l&quot;, &quot;term&quot;]
-        @action, @state, @term = :search, :open, &quot;term&quot;
-      end
+        it &quot;should parse -lc as list closed&quot; do
+          @args = [&quot;-lc&quot;]
+          @action, @state = :list, :closed
+        end
 
-      it &quot;should parse -o as open new issue&quot; do
-        @args = [&quot;-o&quot;]
-        @action = :open
-      end
+        it &quot;should parse -l2 as show issue 2&quot; do
+          @args = [&quot;-l2&quot;]
+          @action, @number = :show, 2
+        end
 
-      it &quot;should parse -o 'New Issue' as open issue with title 'New Issue'&quot; do
-        @args = [&quot;-o&quot;, &quot;New Issue&quot;]
-        @action, @title = :open, &quot;New Issue&quot;
-      end
+        it &quot;should parse -l 'term' as search open for 'term'&quot; do
+          @args = [&quot;-l&quot;, &quot;term&quot;]
+          @action, @state, @term = :search, :open, &quot;term&quot;
+        end
 
-      it &quot;should parse -om 'New Issue' as open issue with'New Issue'&quot; do
-        @args = [&quot;-om&quot;, &quot;New Issue&quot;]
-        @action, @title = :open, &quot;New Issue&quot;
-      end
+        it &quot;should parse -o as open new issue&quot; do
+          @args = [&quot;-o&quot;]
+          @action = :open
+        end
 
-      it &quot;should parse -o 'New Issue' -m as open 'New Issue' in $EDITOR&quot; do
-        @args = [&quot;-o&quot;, &quot;New Issue&quot;, &quot;-m&quot;]
-        @action, @title, @commenting = :open, &quot;New Issue&quot;, true
-      end
+        it &quot;should parse -o 'New Issue' as open issue with title 'New Issue'&quot; do
+          @args = [&quot;-o&quot;, &quot;New Issue&quot;]
+          @action, @title = :open, &quot;New Issue&quot;
+        end
 
-      it &quot;should parse -o 'Issue' -m 'Body' as open 'Issue' with 'Body'&quot; do
-        @args = [&quot;-o&quot;, &quot;Issue&quot;, &quot;-m&quot;, &quot;Body&quot;]
-        @action, @title, @body = :open, &quot;Issue&quot;, &quot;Body&quot;
-      end
+        it &quot;should parse -om 'New Issue' as open issue with'New Issue'&quot; do
+          @args = [&quot;-om&quot;, &quot;New Issue&quot;]
+          @action, @title = :open, &quot;New Issue&quot;
+        end
 
-      it &quot;should parse -o2 as reopen issue 2&quot; do
-        @args = [&quot;-o2&quot;]
-        @action, @number = :reopen, 2
-      end
+        it &quot;should parse -o 'New Issue' -m as open 'New Issue' in $EDITOR&quot; do
+          @args = [&quot;-o&quot;, &quot;New Issue&quot;, &quot;-m&quot;]
+          @action, @title, @commenting = :open, &quot;New Issue&quot;, true
+        end
 
-      it &quot;should parse -o2 -m as reopen issue 2 with a comment&quot; do
-        @args = [&quot;-o2&quot;, &quot;-m&quot;]
-        @action, @number, @commenting = :reopen, 2, true
-      end
+        it &quot;should parse -o 'Issue' -m 'Body' as open 'Issue' with 'Body'&quot; do
+          @args = [&quot;-o&quot;, &quot;Issue&quot;, &quot;-m&quot;, &quot;Body&quot;]
+          @action, @title, @body = :open, &quot;Issue&quot;, &quot;Body&quot;
+        end
 
-      it &quot;should parse -o2 -m 'Comment' as reopen issue 2&quot; do
-        @args = [&quot;-o2&quot;, &quot;-m&quot;, &quot;Comment&quot;]
-        @action, @number, @body = :reopen, 2, &quot;Comment&quot;
-      end
+        it &quot;should parse -o2 as reopen issue 2&quot; do
+          @args = [&quot;-o2&quot;]
+          @action, @number = :reopen, 2
+        end
 
-      it &quot;should parse -ol as list open&quot; do
-        @args = [&quot;-ol&quot;]
-        @action, @state = :list, :open
-      end
+        it &quot;should parse -o2 -m as reopen issue 2 with a comment&quot; do
+          @args = [&quot;-o2&quot;, &quot;-m&quot;]
+          @action, @number, @commenting = :reopen, 2, true
+        end
 
-      it &quot;should parse -ou as return open issues url&quot; do
-        @args = [&quot;-ou&quot;]
-        @action = :url # Should state be :open?
-      end
+        it &quot;should parse -o2 -m 'Comment' as reopen issue 2&quot; do
+          @args = [&quot;-o2&quot;, &quot;-m&quot;, &quot;Comment&quot;]
+          @action, @number, @body = :reopen, 2, &quot;Comment&quot;
+        end
 
-      it &quot;should parse -cl as list closed&quot; do
-        @args = [&quot;-cl&quot;]
-        @action, @state = :list, :closed
-      end
+        it &quot;should parse -ol as list open&quot; do
+          @args = [&quot;-ol&quot;]
+          @action, @state = :list, :open
+        end
 
-      it &quot;should parse -c2 as close issue 2&quot; do
-        @args = [&quot;-c2&quot;]
-        @action, @number = :close, 2
-      end
+        it &quot;should parse -ou as return open issues url&quot; do
+          @args = [&quot;-ou&quot;]
+          @action = :url # Should state be :open?
+        end
 
-      it &quot;should parse -c2 -m as close issue 2 with a comment&quot; do
-        @args = [&quot;-c2&quot;, &quot;-m&quot;]
-        @action, @number, @commenting = :close, 2, true
-      end
+        it &quot;should parse -cl as list closed&quot; do
+          @args = [&quot;-cl&quot;]
+          @action, @state = :list, :closed
+        end
 
-      it &quot;should parse -c2 -m 'Fixed' as close issue 2 with 'Fixed'&quot; do
-        @args = [&quot;-c2&quot;, &quot;-m&quot;, &quot;Fixed&quot;]
-        @action, @number, @body = :close, 2, &quot;Fixed&quot;
-      end
+        it &quot;should parse -c2 as close issue 2&quot; do
+          @args = [&quot;-c2&quot;]
+          @action, @number = :close, 2
+        end
 
-      it &quot;should parse -m2 -c as close issue 2 with a comment&quot; do
-        @args = [&quot;-m2&quot;, &quot;-c&quot;]
-        @action, @number, @commenting = :close, 2, true
-      end
+        it &quot;should parse -c2 -m as close issue 2 with a comment&quot; do
+          @args = [&quot;-c2&quot;, &quot;-m&quot;]
+          @action, @number, @commenting = :close, 2, true
+        end
 
-      it &quot;should parse -cu as return closed issues url&quot; do
-        @args = [&quot;-cu&quot;]
-        @action, @state = :url, :closed
-      end
+        it &quot;should parse -c2 -m 'Fixed' as close issue 2 with 'Fixed'&quot; do
+          @args = [&quot;-c2&quot;, &quot;-m&quot;, &quot;Fixed&quot;]
+          @action, @number, @body = :close, 2, &quot;Fixed&quot;
+        end
 
-      it &quot;should parse -e2 as edit issue 2&quot; do
-        @args = [&quot;-e2&quot;]
-        @action, @number = :edit, 2
-      end
+        it &quot;should parse -m2 -c as close issue 2 with a comment&quot; do
+          @args = [&quot;-m2&quot;, &quot;-c&quot;]
+          @action, @number, @commenting = :close, 2, true
+        end
 
-      it &quot;should parse -rlocalrepo as localuser/localrepo&quot; do
-        GHI.stub!(:login).and_return &quot;localuser&quot;
-        @args = [&quot;-rlocalrepo&quot;, &quot;-l&quot;]
-        @action, @state, @user, @repo = :list, :open, &quot;localuser&quot;, &quot;localrepo&quot;
-      end
+        it &quot;should parse -cu as return closed issues url&quot; do
+          @args = [&quot;-cu&quot;]
+          @action, @state = :url, :closed
+        end
 
-      it &quot;should parse -rremoteuser/remoterepo as remoteuser/remoterepo&quot; do
-        @args = [&quot;-rremoteuser/remoterepo&quot;, &quot;-l&quot;]
-        @action, @state, @user, @repo = :list, :open, &quot;remoteuser&quot;, &quot;remoterepo&quot;
-      end
+        it &quot;should parse -e2 as edit issue 2&quot; do
+          @args = [&quot;-e2&quot;]
+          @action, @number = :edit, 2
+        end
 
-      it &quot;should parse -rremoteuser/remoterepo as a later argument&quot; do
-        @args = [&quot;-1&quot;, &quot;-rremoteuser/remoterepo&quot;]
-        @action, @number, @user, @repo = :show, 1, &quot;remoteuser&quot;, &quot;remoterepo&quot;
-      end
+        it &quot;should parse -rlocalrepo as localuser/localrepo&quot; do
+          GHI.stub!(:login).and_return &quot;localuser&quot;
+          @args = [&quot;-rlocalrepo&quot;, &quot;-l&quot;]
+          @action, @state, @user, @repo = :list, :open, &quot;localuser&quot;, &quot;localrepo&quot;
+        end
 
-      it &quot;should parse -t2 'tag' as label issue 2 with 'tag'&quot; do
-        @args = [&quot;-t2&quot;, &quot;tag&quot;]
-        @action, @number, @tag = :label, 2, &quot;tag&quot;
-      end
+        it &quot;should parse -rremoteuser/remoterepo as remoteuser/remoterepo&quot; do
+          @args = [&quot;-rremoteuser/remoterepo&quot;, &quot;-l&quot;]
+          @action, @state, @user, @repo = :list, :open, &quot;remoteuser&quot;, &quot;remoterepo&quot;
+        end
 
-      it &quot;should parse -d2 'tag' as remove label 'tag' from issue 2&quot; do
-        @args = [&quot;-d2&quot;, &quot;tag&quot;]
-        @action, @number, @tag = :unlabel, 2, &quot;tag&quot;
-      end
+        it &quot;should parse -rremoteuser/remoterepo as a later argument&quot; do
+          @args = [&quot;-1&quot;, &quot;-rremoteuser/remoterepo&quot;]
+          @action, @number, @user, @repo = :show, 1, &quot;remoteuser&quot;, &quot;remoterepo&quot;
+        end
 
-      it &quot;should parse -m2 as comment on issue 2&quot; do
-        @args = [&quot;-m2&quot;]
-        @action, @number, @commenting = :comment, 2, true
-      end
+        it &quot;should parse -t2 'tag' as label issue 2 with 'tag'&quot; do
+          @args = [&quot;-t2&quot;, &quot;tag&quot;]
+          @action, @number, @tag = :label, 2, &quot;tag&quot;
+        end
 
-      it &quot;should parse -m2 'Comment' as comment 'Comment' on issue 2&quot; do
-        @args = [&quot;-m2&quot;, &quot;Comment&quot;]
-        @action, @number, @body = :comment, 2, &quot;Comment&quot;
-      end
+        it &quot;should parse -d2 'tag' as remove label 'tag' from issue 2&quot; do
+          @args = [&quot;-d2&quot;, &quot;tag&quot;]
+          @action, @number, @tag = :unlabel, 2, &quot;tag&quot;
+        end
 
-      it &quot;should parse -u as return open issues url&quot; do
-        @args = [&quot;-u&quot;]
-        @action = :url # Should state be :open?
-      end
+        it &quot;should parse -m2 as comment on issue 2&quot; do
+          @args = [&quot;-m2&quot;]
+          @action, @number, @commenting = :comment, 2, true
+        end
 
-      it &quot;should parse -uo as return open issues url&quot; do
-        @args = [&quot;-uo&quot;]
-        @action = :url # Should state be :open?
-      end
+        it &quot;should parse -m2 'Comment' as comment 'Comment' on issue 2&quot; do
+          @args = [&quot;-m2&quot;, &quot;Comment&quot;]
+          @action, @number, @body = :comment, 2, &quot;Comment&quot;
+        end
 
-      it &quot;should parse -uc as return open issues url&quot; do
-        @args = [&quot;-uc&quot;]
-        @action, @state = :url, :closed
-      end
+        it &quot;should parse -u as return open issues url&quot; do
+          @args = [&quot;-u&quot;]
+          @action = :url # Should state be :open?
+        end
 
-      it &quot;should parse -u2 as return issue 2 url&quot; do
-        @args = [&quot;-u2&quot;]
-        @action, @number = :url, 2
-      end
+        it &quot;should parse -uo as return open issues url&quot; do
+          @args = [&quot;-uo&quot;]
+          @action = :url # Should state be :open?
+        end
 
-      it &quot;should parse -uu as return unread issues url&quot; do
-        @args = [&quot;-uu&quot;]
-        @action, @state = :url, :unread
+        it &quot;should parse -uc as return open issues url&quot; do
+          @args = [&quot;-uc&quot;]
+          @action, @state = :url, :closed
+        end
+
+        it &quot;should parse -u2 as return issue 2 url&quot; do
+          @args = [&quot;-u2&quot;]
+          @action, @number = :url, 2
+        end
+
+        it &quot;should parse -uu as return unread issues url&quot; do
+          @args = [&quot;-uu&quot;]
+          @action, @state = :url, :unread
+        end
       end
     end
 </diff>
      <filename>spec/ghi/cli_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>5c80dde9604c0643c8874101c3f6bad5d320a153</id>
    </parent>
  </parents>
  <author>
    <name>Stephen Celis</name>
    <email>stephen@stephencelis.com</email>
  </author>
  <url>http://github.com/stephencelis/ghi/commit/bf20a4d385cd0bd6c674dc570f421444451af494</url>
  <id>bf20a4d385cd0bd6c674dc570f421444451af494</id>
  <committed-date>2009-08-26T17:34:36-07:00</committed-date>
  <authored-date>2009-08-26T17:34:36-07:00</authored-date>
  <message>Fix bug preventing invocation from non-GitHub repo directories.</message>
  <tree>b32aec11f012da4153829e732449adef3c14fbce</tree>
  <committer>
    <name>Stephen Celis</name>
    <email>stephen@stephencelis.com</email>
  </committer>
</commit>
