Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amending initial commit throws and logs exception #4972

Closed
westbury opened this issue Apr 23, 2019 · 4 comments · Fixed by #5451
Closed

Amending initial commit throws and logs exception #4972

westbury opened this issue Apr 23, 2019 · 4 comments · Fixed by #5451
Labels
bug bugs found in the application git issues related to git

Comments

@westbury
Copy link
Contributor

Description

When attempting to amend the initial commit, an exception is thrown. This was discovered when testing #4528 (comment) but the problem occurs on the master branch so I'm opening a separate issue.

Expect either:

  1. The 'Amend' button is disabled when on the initial commit, or
  2. The initial commit is amended. This may be rather more complicated as we would have to use 'git rebase --root' or something like it, so special case code with the view in a special 'no commits yet' state etc.

Reproduction Steps

Find a Git repository that does not have many commits and amend until one gets to the initial commit.

OS and Theia version:

Master branch, seen on both Mac and Windows

Diagnostics:
root ERROR The command git reset HEAD~ --soft exited with an unexpected code: 128. The caller should either handle this error, or expect that exit code.
root ERROR fatal: ambiguous argument 'HEAD~': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'

root ERROR Request exec failed with error: fatal: ambiguous argument 'HEAD~': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
GitError: fatal: ambiguous argument 'HEAD~': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'

at new GitError (C:\Users\nigwes01\git\mbs-ide\node_modules\dugite-extra\src\core\git.ts:89:9)
at Object.<anonymous> (C:\Users\nigwes01\git\mbs-ide\node_modules\dugite-extra\src\core\git.ts:275:15)
at step (C:\Users\nigwes01\git\mbs-ide\node_modules\dugite-extra\lib\core\git.js:50:23)
at Object.next (C:\Users\nigwes01\git\mbs-ide\node_modules\dugite-extra\lib\core\git.js:31:53)
at fulfilled (C:\Users\nigwes01\git\mbs-ide\node_modules\dugite-extra\lib\core\git.js:22:58)
at process._tickCallback (internal/process/next_tick.js:68:7)

root ERROR Uncaught Exception: GitError: fatal: ambiguous argument 'HEAD~': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'
root ERROR GitError: fatal: ambiguous argument 'HEAD~': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git [...] -- [...]'

@kittaakos
Copy link
Contributor

kittaakos commented Apr 23, 2019

It was also mentioned here: #4528 (comment)

Edit: And in the initial description too, sorry for the noise.

@kittaakos kittaakos added bug bugs found in the application git issues related to git labels Apr 23, 2019
@kittaakos
Copy link
Contributor

  1. The 'Amend' button is disabled when on the initial commit

+1 for this. It is straightforward to implement, no custom amend code is required.

@westbury
Copy link
Contributor Author

I totally agree that simply disabling the 'amend' on the initial commit is the way to go.

Is it worth fixing this given #4279 ? I don't know what the plan is for migrating all the current Git UI for that PR. Other PRs such as #4528 are also rather waiting on the outcome of the vscode scm api work.

@kittaakos
Copy link
Contributor

I totally agree that simply disabling the 'amend' on the initial commit is the way to go.

OK, then let's do this.

Is it worth fixing this given #4279 ? I don't know what the plan is for migrating all the current Git UI for that PR. Other PRs such as #4528 are also rather waiting on the outcome of the vscode scm api work.

I do not know much about SCM API plans either. @akosyakov, is it possible to get the Git amend enhancements (#4528) to the master before the SCM API changes (#4279). Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application git issues related to git
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants