Skip to content

Conversation

@vathpela
Copy link
Contributor

Turns out aec58a9 did the right thing for /packed/ refs, but didn't work
correctly on /unpacked/ refs. So this patch gives unpacked refs the
same treatment.

Without the fix here, the test added will cause this traceback:

======================================================================
ERROR: Check that we find .git as a worktree file and find the worktree

Traceback (most recent call last):
File "/home/pjones/devel/github.com/GitPython/git/test/lib/helper.py", line 92, in wrapper
return func(self, path)
File "/home/pjones/devel/github.com/GitPython/git/test/test_repo.py", line 938, in test_git_work_tree_dotgit
self.assertIsInstance(repo.heads['aaaaaaaa'], Head)
File "/home/pjones/devel/github.com/GitPython/git/util.py", line 893, in getitem
raise IndexError("No item found with id %r" % (self._prefix + index))
IndexError: No item found with id 'aaaaaaaa'

Woops.

Signed-off-by: Peter Jones [email protected]

@vathpela
Copy link
ContributorAuthor

Don't apply this one just yet; I've discovered some more things I don't like, and it's better to fix them with a more systemic approach.

@vathpelavathpelaforce-pushed the worktrees branch 2 times, most recently from a1597f4 to 31ae954CompareAugust 22, 2017 21:12
@codecov-io
Copy link

codecov-io commented Aug 22, 2017

Codecov Report

Merging #654 into master will increase coverage by 0.17%.
The diff coverage is 100%.

Impacted file tree graph

@@ Coverage Diff @@## master #654 +/- ## ========================================== + Coverage 92.57% 92.74% +0.17%  ========================================== Files 61 61 Lines 9968 9971 +3 ========================================== + Hits 9228 9248 +20 + Misses 740 723 -17
Impacted FilesCoverage Δ
git/refs/symbolic.py96.11% <100%> (-0.08%)⬇️
git/refs/remote.py90% <100%> (-1.12%)⬇️
git/test/test_repo.py96.46% <100%> (+1.69%)⬆️
git/repo/base.py95.67% <100%> (+0.54%)⬆️
git/test/lib/helper.py85.46% <0%> (-2.33%)⬇️
git/test/test_remote.py97.27% <0%> (-0.55%)⬇️
git/objects/submodule/util.py76.75% <0%> (-0.44%)⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cf8dc25...d1c40f4. Read the comment docs.

Turns out aec58a9 did the right thing for /packed/ refs, but didn't work correctly on /unpacked/ refs. So this patch gives unpacked refs the same treatment. Without the fix here, the test added will cause this traceback: ====================================================================== ERROR: Check that we find .git as a worktree file and find the worktree ---------------------------------------------------------------------- Traceback (most recent call last): File "/home/pjones/devel/github.com/GitPython/git/test/lib/helper.py", line 92, in wrapper return func(self, path) File "/home/pjones/devel/github.com/GitPython/git/test/test_repo.py", line 938, in test_git_work_tree_dotgit self.assertIsInstance(repo.heads['aaaaaaaa'], Head) File "/home/pjones/devel/github.com/GitPython/git/util.py", line 893, in __getitem__ raise IndexError("No item found with id %r" % (self._prefix + index)) IndexError: No item found with id 'aaaaaaaa' Woops. Things I've learned: - test_remote doesn't work currently if you start on a branch. I think it never did? - Because of 346424d, all *sorts* of stuff in the test suite doesn't work if you name your development branch "packed-refs" (This seems like a bug...) Signed-off-by: Peter Jones <[email protected]>
@vathpela
Copy link
ContributorAuthor

Literally no idea why this is failing on AppVeyor. I'll try to have a look in the next couple of days, but it's pretty busy over here right now.

@Byron
Copy link
Member

Thanks a ton for your contribution, and my apologies for getting to this PR that late! Windows is constantly failing by now, so I choose to ignore it :/.

@ByronByron merged commit a5f0343 into gitpython-developers:masterSep 28, 2017
@vathpelavathpela deleted the worktrees branch September 28, 2017 17:26
riley-martine pushed a commit to riley-martine/GitPython that referenced this pull request Dec 7, 2023
worktrees: make non-packed refs also work correctly.
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

3 participants

@vathpela@codecov-io@Byron