gitless
gitless copied to clipboard
Crash when tracking a deleted file
- init repo
- Add some files
- gl track *.py
- rm useless.py
- gl status
And then see this error:
On branch master, 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.5
Traceback (most recent call last): File "/usr/local/Cellar/gitless/0.8.5_2/libexec/lib/python2.7/site-packages/gitless/cli/gl.py", line 82, in main return SUCCESS if args.func(args, repo) else ERRORS_FOUND File "/usr/local/Cellar/gitless/0.8.5_2/libexec/lib/python2.7/site-packages/gitless/cli/gl_status.py", line 45, in main for f in curr_b.status(): File "/usr/local/Cellar/gitless/0.8.5_2/libexec/lib/python2.7/site-packages/gitless/core.py", line 762, in status yield self.FileStatus(fp, *self._st_map[git_s]) KeyError: 513
I get the same error if I delete the file and then try to make a commit. My traceback reveals that the issue seems to be Gitless trying to remove from the Git index without checking it for the existence of a file. Rather than ignore the bad call, Git returns an error.
0.8.5
Traceback (most recent call last): File "build/bdist.linux-i686/egg/gitless/cli/gl.py", line 82, in main return SUCCESS if args.func(args, repo) else ERRORS_FOUND File "build/bdist.linux-i686/egg/gitless/cli/gl_commit.py", line 73, in main ci = curr_b.create_commit(commit_files, msg, partials=partials) File "build/bdist.linux-i686/egg/gitless/core.py", line 1202, in create_commit msg, get_tree_and_update_index(), # the commit tree File "build/bdist.linux-i686/egg/gitless/core.py", line 1174, in get_tree_and_update_index update() File "build/bdist.linux-i686/egg/gitless/core.py", line 1167, in update index.remove(git_f) File "/usr/local/lib/python2.7/dist-packages/pygit2/index.py", line 172, in remove check_error(err, True) File "/usr/local/lib/python2.7/dist-packages/pygit2/errors.py", line 53, in check_error raise IOError(message) IOError: Index does not contain myfile.html at stage 0
Line 1167 in gitless/core.py is the place of blame it seems (unless we blame Git for being a stickler).
If I try untracking the files, then it complains about them being at the head and not in the working directory. If I correct the index using Git, then Gitless complains about not being able to mark the files when switching between branching. The issue seems to be that Gitless has some kind of cache that isn't in sync with Git's.
We're a few versions down the line and I ran into the same crash above. It seems I can get out of the broken state by simply making the commit with git. I think the file was git rmed by my IDE, causing the problem. As pointed out above, I think this is an issue of syncing cache states.