Skip to content

tests fail if reflog is empty #286

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

Closed
moben opened this issue Apr 22, 2015 · 3 comments
Closed

tests fail if reflog is empty #286

moben opened this issue Apr 22, 2015 · 3 comments

Comments

@moben
Copy link
Contributor

moben commented Apr 22, 2015

When the reflog for the current branch has only 1 entry (I don't think "empty" is technically possible), tests fail with

======================================================================
ERROR: test_rev_parse (git.test.test_repo.TestRepo)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/root/GitPython/git/test/test_repo.py", line 654, in test_rev_parse
    assert rev_parse('@{1}') != head.commit
  File "/root/GitPython/git/repo/fun.py", line 233, in rev_parse
    raise IndexError("Invalid revlog index: %i" % revlog_index)
IndexError: Invalid revlog index: -2
-------------------- >> begin captured stdout << ---------------------
failed on 0.1
failed on 0.2

--------------------- >> end captured stdout << ----------------------

If I for example create an empty commit with

git commit --allow-empty --message test

they pass.

You can reproduce this easily by cloning the GitPython repo to a new directory.

@Byron
Copy link
Member

Byron commented Apr 22, 2015

This is a known issue, and is currently overcome by preparing the repository after checkout, on travis at least.

Feel free to suggest a solution, however, to me it seems the main culprit is that GitPython uses its own repository in read-only mode at all. This is bad and shouldn't be done, but also speeds up tests considerably.

One could consider rewriting tests to setup their own sandboxes from scratch, but so far I didn't get around that.

Thus, to me this issue is "won't fix", but I am open to suggestions if they don't involve a massive amount of work coming my way :).

@moben
Copy link
Contributor Author

moben commented May 4, 2015

Sorry for forgetting about this.

I don't really have an idea of how to fix this, so we just use something similar to what travis does in our package for now.

@Byron
Copy link
Member

Byron commented May 5, 2015

No need to apologize, I am happy you got it to work on your end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants