Skip to content

Commit 25eb226

Browse files
committed
Now worktree.path returns path to worktree dir
Instead of path to .git file within the worktree directory. This is a breaking change. And start changelog for the upcoming release. Issue #803
1 parent 9a4e031 commit 25eb226

7 files changed

+61
-23
lines changed

CHANGELOG.rst

+29
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,32 @@
1+
0.28.0 (UNRELEASED)
2+
-------------------------
3+
4+
- Upgrade to libgit2 0.28
5+
6+
- Add fat wheels for Linux
7+
`#793 <https://github.com/libgit2/pygit2/issues/793>`_
8+
`#869 <https://github.com/libgit2/pygit2/pull/869>`_
9+
`#874 <https://github.com/libgit2/pygit2/pull/874>`_
10+
`#875 <https://github.com/libgit2/pygit2/pull/875>`_
11+
`#883 <https://github.com/libgit2/pygit2/pull/883>`_
12+
13+
- New `pygit2.Mailmap`, see documentation
14+
`#804 <https://github.com/libgit2/pygit2/pull/804>`_
15+
16+
- New `Repository.apply(...)` wraps `git_apply(..)`
17+
`#841 <https://github.com/libgit2/pygit2/issues/841>`_
18+
`#843 <https://github.com/libgit2/pygit2/pull/843>`_
19+
20+
- Tests improvements
21+
`#873 <https://github.com/libgit2/pygit2/pull/873>`_
22+
23+
Breaking changes:
24+
25+
- Now `worktree.path` returns the path to the worktree directory, not to the
26+
`.git` file within. To get the path to the `.git` file just append `.git`
27+
`#803 <https://github.com/libgit2/pygit2/issues/803>`_
28+
29+
130
0.27.4 (2019-01-19)
231
-------------------------
332

docs/index.rst

+11-9
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,21 @@ Usage guide:
3535
repository
3636
oid
3737
objects
38-
references
39-
revparse
40-
log
41-
working-copy
38+
39+
backends
40+
blame
41+
config
4242
diff
43+
features
44+
log
45+
mailmap
4346
merge
44-
config
47+
references
4548
remotes
46-
submodule
47-
blame
49+
revparse
4850
settings
49-
features
50-
backends
51+
submodule
52+
working-copy
5153

5254

5355
Indices and tables

docs/mailmap.rst

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
**********************************************************************
2+
Mailmap
3+
**********************************************************************
4+
5+
.. autoclass:: pygit2.Mailmap
6+
:members:

docs/repository.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,17 @@ Below there are some general attributes and methods:
6565
.. autoattribute:: pygit2.Repository.is_bare
6666
.. autoattribute:: pygit2.Repository.is_empty
6767
.. autoattribute:: pygit2.Repository.default_signature
68-
.. automethod:: pygit2.Repository.read
69-
.. automethod:: pygit2.Repository.write
68+
69+
.. automethod:: pygit2.Repository.apply
7070
.. automethod:: pygit2.Repository.ahead_behind
71-
.. automethod:: pygit2.Repository.descendant_of
7271
.. automethod:: pygit2.Repository.create_reference
72+
.. automethod:: pygit2.Repository.descendant_of
7373
.. automethod:: pygit2.Repository.describe
74+
.. automethod:: pygit2.Repository.free
7475
.. automethod:: pygit2.Repository.path_is_ignored
76+
.. automethod:: pygit2.Repository.read
7577
.. automethod:: pygit2.Repository.reset
7678
.. automethod:: pygit2.Repository.revert_commit
7779
.. automethod:: pygit2.Repository.state_cleanup
80+
.. automethod:: pygit2.Repository.write
7881
.. automethod:: pygit2.Repository.write_archive
79-
.. automethod:: pygit2.Repository.free

src/reference.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ PyDoc_STRVAR(Reference_type__doc__,
342342
PyObject *
343343
Reference_type__get__(Reference *self)
344344
{
345-
git_ref_t c_type;
345+
git_reference_t c_type;
346346

347347
CHECK_REFERENCE(self);
348348
c_type = git_reference_type(self->reference);

src/worktree.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,15 @@ PyDoc_STRVAR(Worktree_name__doc__,
3939
PyObject *
4040
Worktree_name__get__(Worktree *self)
4141
{
42-
return to_unicode(self->worktree->name, NULL, NULL);
42+
return to_unicode(git_worktree_name(self->worktree), NULL, NULL);
4343
}
4444

4545
PyDoc_STRVAR(Worktree_path__doc__,
4646
"Gets path worktree\n");
4747
PyObject *
4848
Worktree_path__get__(Worktree *self)
4949
{
50-
return to_unicode(self->worktree->gitlink_path, NULL, NULL);
50+
return to_unicode(git_worktree_path(self->worktree), NULL, NULL);
5151
}
5252

5353
PyDoc_STRVAR(Worktree_git_path__doc__,

test/test_repository.py

+6-7
Original file line numberDiff line numberDiff line change
@@ -687,21 +687,20 @@ def test_worktree(self):
687687
os.rmdir(worktree_dir)
688688

689689
def _check_worktree(worktree):
690-
path = os.path.realpath(
691-
os.path.join(worktree_dir, '.git'))
692-
git_path = os.path.realpath(
693-
os.path.join(self.repo.path, 'worktrees', worktree_name))
694-
695690
# Confirm the name attribute matches the specified name
696691
assert worktree.name == worktree_name
697692
# Confirm the path attribute points to the correct path
698-
assert os.path.realpath(worktree.path) == path
693+
assert os.path.realpath(worktree.path) == worktree_dir
699694
# The "gitdir" in a worktree should be a file with a reference to
700695
# the actual gitdir. Let's make sure that the path exists and is a
701696
# file.
702-
assert os.path.isfile(path)
697+
assert os.path.isfile(os.path.join(worktree_dir, '.git'))
698+
703699
# Confirm the git_path attribute points to the correct path
700+
git_path = os.path.realpath(
701+
os.path.join(self.repo.path, 'worktrees', worktree_name))
704702
assert os.path.realpath(worktree.git_path) == git_path
703+
705704
# Confirm the worktree directory in the main checkout's gitdir
706705
# actually exists
707706
assert os.path.isdir(git_path)

0 commit comments

Comments
 (0)