emacsorphanage / git-gutter

Emacs port of GitGutter which is Sublime Text Plugin
834 stars 70 forks source link

Use `--` to separate paths from revisions #186

Closed hirose31 closed 3 years ago

hirose31 commented 3 years ago

This PR add -- argument to separate paths from revisions explicitly.

git diff get confused when there is a branch with the same name as the file name.

$ echo '; blah' >> Cask

$ git --no-pager diff -U0 Cask
diff --git a/Cask b/Cask
index 5996224..341da34 100644
--- a/Cask
+++ b/Cask
@@ -8,0 +9 @@
+; blah

### create a branch named `Cask`
$ git checkout -b Cask
Switched to a new branch 'Cask'

$ git checkout  master
M       Cask
Switched to branch 'master'
Your branch is up to date with 'origin/master'.

### git diff get confused
$ git --no-pager diff -U0 Cask
fatal: ambiguous argument 'Cask': both revision and filename
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

### add `--` to separate path
$ git --no-pager diff -U0 -- Cask
diff --git a/Cask b/Cask
index 5996224..341da34 100644
--- a/Cask
+++ b/Cask
@@ -8,0 +9 @@
+; blah
jcs090218 commented 3 years ago

Thanks for contribution!