Skip to content

gl status fails after resetting head of branch #195

Open
@mfischerq

Description

@mfischerq

I got the following error on "gl status" after I reset the head to the branch to a previous commit using "gl branch --set-head":

`On branch tmp, repo-directory //
✘ Some internal error occurred
➜ If you want to help, see http://gitless.com for info on how to report bugs and include the following information:

0.8.6

Traceback (most recent call last):
File "gitless/cli/gl.py", line 99, in main
File "gitless/cli/gl_status.py", line 45, in main
File "gitless/core.py", line 765, in status
KeyError: 513
`

Steps to reproduce:

  1. Create a new file (lets call it f.txt) in the branch and commit
  2. reset the head of the branch to a commit prior to this commit using "gl branch -sh"
  3. Contrary to my expectations, f.txt is still there and gl status shows it as tracked and "new file"
  4. Remove f.txt using the OS: "rm f.txt"
  5. "gl status" crashes

Other gl commands fail too from this point on. The only way to resolve this situation that I could find is to manually recreate the deleted file (touch f.txt).

I think there are really two issues here: the obvious that lets "gl status" crash and the "strange" behaviour of gl branch -sh. My expectation would be that resetting the head of a branch brings my workspace to a state that reflects this new head (possibly creating missing or removing non-existant files). This behaviour would be consistent to what "gl switch" does between branches.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions