Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Using git rev-parse --show-toplevel to find repo root #105

Merged
merged 1 commit into from

2 participants

@galonsky

Fixes #104

--show-toplevel
Show the absolute path of the top-level directory.
https://www.kernel.org/pub/software/scm/git/docs/git-rev-parse.html

@ndbroadbent
Owner

Great, thanks!

@ndbroadbent ndbroadbent merged commit 22d0b3c into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  lib/git/status_shortcuts.rb
View
2  lib/git/status_shortcuts.rb
@@ -20,7 +20,7 @@
# # groups => 1: staged, 2: unmerged, 3: unstaged, 4: untracked
# --------------------------------------------------------------------
-@project_root = File.exist?(".git") ? Dir.pwd : `\git rev-parse --git-dir 2> /dev/null`.sub(/\/\.git$/, '').strip
+@project_root = File.exist?(".git") ? Dir.pwd : `\git rev-parse --show-toplevel 2> /dev/null`.strip
@git_status = `\git status --porcelain 2> /dev/null`
Something went wrong with that request. Please try again.