brackets-userland / brackets-git

brackets-git — git extension for adobe/brackets
Other
656 stars 193 forks source link

Unknown revision or path not in the working tree when clicking commit #1272

Open petetnt opened 8 years ago

petetnt commented 8 years ago

While testing out a user report on https://github.com/adobe/brackets/issues/11826#issuecomment-177193603, I installed brackets-git, created a new empty repo and created a file. When I open the commit window, I get the following error:

[brackets-git] call: git rev-list --left-right --count undefined/master...@{0}
Error: fatal: ambiguous argument 'undefined/master...@{0}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
    at Object.exports.toError (file:///C:/Users/***/AppData/Roaming/Brackets/extensions/user/zaggino.brackets-git/src/ErrorHandler.js:157:19)
    at NodeConnection.<anonymous> (file:///C:/Users/Pete/AppData/Roaming/Brackets/extensions/user/zaggino.brackets-git/src/Cli.js:185:44)
    at j (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/thirdparty/jquery-2.1.3.min.js:2:26911)
    at Object.k.fireWith (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/thirdparty/jquery-2.1.3.min.js:2:27724)
    at NodeConnection._receive (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/utils/NodeConnection.js:498:34)

Git 2.7.0, newest Brackets-Git, Brackets latest master

zaggino commented 8 years ago

cc @mattbell87

mattbell87 commented 8 years ago

Cheers will give this a look.

mattbell87 commented 8 years ago

Doesn't happen on mine, Git 2.5.0, latest Brackets and Brackets GIT. If you could provide exact steps that would be great.

Steps I tried:

  1. Create new folder
  2. Open folder in Brackets
  3. Click Init
  4. Added a new file
  5. Staged and Commited new file (Tick and commit button)

I may be able to code some checks for this anyway. I'd think the counters should be ignored if there is anything undefined.

petetnt commented 8 years ago

@mattbell87 Those were the exact steps, #1273 fixes the errors :+1:

mattbell87 commented 8 years ago

That's great! weird that it didn't happen on mine, maybe its my older version of git, I just use whatever is in the Fedora repos haha.

petetnt commented 8 years ago

FWIW it happened to me on Git 2.4.3 (or similar) too, updating it was one of the debugging steps. Maybe it's due to the Windows version of Git...

zaggino commented 8 years ago

@petetnt I've merged this with a bit of alteration, can you test latest master to make sure it's fixed? Thanks

petetnt commented 8 years ago

@zaggino works for me :+1: closing as fixed

petetnt commented 8 years ago

Hmm, now the issue came back, but when launching brackets (not when committing)

[brackets-git] call: git rev-list --left-right --count matt/fetch_head...@{0}
Error: fatal: ambiguous argument 'matt/fetch_head...@{0}': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
    at Object.exports.toError (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/dev/brackets-git/src/ErrorHandler.js:157:19)
    at NodeConnection.<anonymous> (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/extensions/dev/brackets-git/src/Cli.js:185:44)
    at j (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/thirdparty/jquery-2.1.3.min.js:2:26911)
    at Object.k.fireWith (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/thirdparty/jquery-2.1.3.min.js:2:27724)
    at NodeConnection._receive (file:///C:/Program%20Files%20(x86)/Brackets/dev/src/utils/NodeConnection.js:498:34)
zaggino commented 8 years ago

Added the -- separator to master, let me know if that helped @petetnt , I sadly can't reproduce this.

mattbell87 commented 8 years ago

I just tested this on Win10 with Git 2.7.0 and I still can't reproduce this either. Even on ab45d5d!

EDIT I did manage to finally reproduce it on ab45d5d. Though I can't see it on a5c44af or 2353c60 (latest 2 commits).

tuwid commented 7 years ago

having the same issue (expecting a git pull )

TASK [Pull git repository] *****************************************************
fatal: [34.251.209.14]: FAILED! => {"changed": false, "cmd": "/usr/bin/git reset --hard origin", "failed": true, "msg": "Failed to checkout branch master", "rc": 128, "stderr": "fatal: ambiguous argument 'origin': unknown revision or path not in the working tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\n", "stdout": "", "stdout_lines": []}