git-project-core-plugins 0.0.26__tar.gz → 0.0.27__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/PKG-INFO +1 -1
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/_version.py +2 -2
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/docs/changelog.rst +21 -1
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/worktree.py +19 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/test_worktree.py +52 -9
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/.gitignore +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/COPYING +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/MANIFEST.in +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/docs/Makefile +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/docs/authors.rst +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/docs/conf.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/docs/index.rst +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/docs/intro.rst +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/docs/license.rst +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/docs/make.bat +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/hatch_build.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/pyproject.toml +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/requirements.txt +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/__init__.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/_commanddocs.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/artifact.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/branch.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/clone.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/common.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/config.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/help.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/init.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/src/git_project_core_plugins/run.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/common.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/conftest.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/test_artifact.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/test_branch.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/test_clone.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/test_config.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/test_help.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/test_init.py +0 -0
- {git_project_core_plugins-0.0.26 → git_project_core_plugins-0.0.27}/tests/test_run.py +0 -0
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '0.0.
|
|
22
|
-
__version_tuple__ = version_tuple = (0, 0,
|
|
21
|
+
__version__ = version = '0.0.27'
|
|
22
|
+
__version_tuple__ = version_tuple = (0, 0, 27)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
|
@@ -31,6 +31,25 @@ ChangeLog
|
|
|
31
31
|
`Unreleased`_
|
|
32
32
|
-------------
|
|
33
33
|
|
|
34
|
+
`0.0.27`_ - 2026-09-30
|
|
35
|
+
----------------------
|
|
36
|
+
Fixed
|
|
37
|
+
.....
|
|
38
|
+
- ``clone --worktree`` and ``init --worktree`` now write a ``.git`` file
|
|
39
|
+
beside the hidden bare clone, holding ``gitdir: .<urlname>.git``. The
|
|
40
|
+
container was not a repository before, so any tool that stood there and
|
|
41
|
+
asked git a question got nothing, and callers worked around it by reaching
|
|
42
|
+
for ``common_dir`` themselves.
|
|
43
|
+
|
|
44
|
+
It has to be a file. The hidden name exists because a go build run from the
|
|
45
|
+
container fails when a ``.git`` that resolves to a directory sits above the
|
|
46
|
+
module, since go then runs ``git status`` against the bare clone. A symlink
|
|
47
|
+
resolves to a directory and fails the same way. Go walks past a ``.git``
|
|
48
|
+
file, while git and pygit2 follow it, so a file serves both.
|
|
49
|
+
|
|
50
|
+
A repository that was already bare when ``init --worktree`` ran keeps its
|
|
51
|
+
``.git`` as the clone itself and gets no pointer.
|
|
52
|
+
|
|
34
53
|
`0.0.26`_ - 2026-09-27
|
|
35
54
|
----------------------
|
|
36
55
|
Added
|
|
@@ -73,5 +92,6 @@ Fixed
|
|
|
73
92
|
404. Issues named ``unknown/greened``, a leftover from hatch's project
|
|
74
93
|
template, and Documentation misspelled the package name.
|
|
75
94
|
|
|
76
|
-
.. _Unreleased: https://github.com/greened/git-project-core-plugins/compare/v0.0.
|
|
95
|
+
.. _Unreleased: https://github.com/greened/git-project-core-plugins/compare/v0.0.27...HEAD
|
|
96
|
+
.. _0.0.27: https://github.com/greened/git-project-core-plugins/compare/v0.0.26...v0.0.27
|
|
77
97
|
.. _0.0.26: https://github.com/greened/git-project-core-plugins/compare/v0.0.25...v0.0.26
|
|
@@ -612,6 +612,17 @@ class WorktreePlugin(Plugin):
|
|
|
612
612
|
|
|
613
613
|
return '.' + urlname
|
|
614
614
|
|
|
615
|
+
# Without this the container is not a repository, so anything
|
|
616
|
+
# that stands there and asks git a question gets nothing. It
|
|
617
|
+
# has to be a file. A symlink or a directory named ".git"
|
|
618
|
+
# brings back the go problem the hidden name avoids, because
|
|
619
|
+
# go's VCS search follows a ".git" that resolves to a
|
|
620
|
+
# directory and then runs "git status" against a bare clone.
|
|
621
|
+
# Go walks past a ".git" file, while git and pygit2 honour it.
|
|
622
|
+
def write_container_gitdir(container: Path, gitdir_name: str):
|
|
623
|
+
# Keep the pointer relative so the container still moves.
|
|
624
|
+
(container / '.git').write_text(f'gitdir: {gitdir_name}\n')
|
|
625
|
+
|
|
615
626
|
def worktree_command_clone(p_git, p_gitproject, p_project, clargs):
|
|
616
627
|
if clargs.worktree:
|
|
617
628
|
path = Path.cwd()
|
|
@@ -640,6 +651,8 @@ class WorktreePlugin(Plugin):
|
|
|
640
651
|
if not main:
|
|
641
652
|
main = self._choose_main_branch(p_git)
|
|
642
653
|
|
|
654
|
+
write_container_gitdir(Path(path).parent, Path(path).name)
|
|
655
|
+
|
|
643
656
|
# Detach HEAD so we can worktree main.
|
|
644
657
|
p_git.detach_head()
|
|
645
658
|
|
|
@@ -714,6 +727,12 @@ class WorktreePlugin(Plugin):
|
|
|
714
727
|
assert Path(p_git.get_gitdir()) == newgitdir
|
|
715
728
|
p_git.validate_config()
|
|
716
729
|
|
|
730
|
+
# After the reinit, so discovery resolves the clone
|
|
731
|
+
# the same way it did before. The already-bare path
|
|
732
|
+
# below keeps its .git as the clone itself, so only
|
|
733
|
+
# the renamed case gets a pointer.
|
|
734
|
+
write_container_gitdir(workarea_root, newgitdir.name)
|
|
735
|
+
|
|
717
736
|
if was_bare:
|
|
718
737
|
workarea_root = Path(p_git.get_gitdir()).parent
|
|
719
738
|
|
|
@@ -27,6 +27,7 @@ import common
|
|
|
27
27
|
import io
|
|
28
28
|
import os
|
|
29
29
|
from pathlib import Path
|
|
30
|
+
import pygit2
|
|
30
31
|
|
|
31
32
|
def test_worktree_add_arguments(reset_directory,
|
|
32
33
|
git,
|
|
@@ -177,6 +178,17 @@ def test_worktree_scope(reset_directory,
|
|
|
177
178
|
assert project.committish == 'master'
|
|
178
179
|
assert project.builddir == '/path/to/test'
|
|
179
180
|
|
|
181
|
+
def check_container_gitdir(container, hidden):
|
|
182
|
+
"""Assert the container points at the hidden clone with a .git file.
|
|
183
|
+
|
|
184
|
+
It has to be a file. A directory or a symlink named .git is what
|
|
185
|
+
breaks a go build run from the container, which is the whole reason
|
|
186
|
+
the clone is hidden in the first place.
|
|
187
|
+
"""
|
|
188
|
+
gitfile = Path(container) / '.git'
|
|
189
|
+
assert gitfile.is_file()
|
|
190
|
+
assert gitfile.read_text() == f'gitdir: {hidden}\n'
|
|
191
|
+
|
|
180
192
|
def test_worktree_clone(git_project_runner,
|
|
181
193
|
remote_repository):
|
|
182
194
|
repo_path = Path(f'.{Path(remote_repository.path).name}.git')
|
|
@@ -190,6 +202,8 @@ def test_worktree_clone(git_project_runner,
|
|
|
190
202
|
assert os.path.exists(repo_path)
|
|
191
203
|
assert os.path.exists('master')
|
|
192
204
|
|
|
205
|
+
check_container_gitdir(Path.cwd(), repo_path.name)
|
|
206
|
+
|
|
193
207
|
def test_worktree_clone_bare(git_project_runner,
|
|
194
208
|
remote_repository):
|
|
195
209
|
git_project_runner.run('.*',
|
|
@@ -204,9 +218,12 @@ def test_worktree_clone_bare(git_project_runner,
|
|
|
204
218
|
assert os.path.exists(repo_path)
|
|
205
219
|
assert os.path.exists('master')
|
|
206
220
|
|
|
221
|
+
check_container_gitdir(Path.cwd(), repo_path.name)
|
|
222
|
+
|
|
207
223
|
def test_worktree_clone_path(git_project_runner,
|
|
208
224
|
remote_repository):
|
|
209
225
|
repo_path = Path.cwd() / 'foo' / 'bar'
|
|
226
|
+
hidden = f'.{Path(remote_repository.path).name}.git'
|
|
210
227
|
|
|
211
228
|
git_project_runner.run('.*',
|
|
212
229
|
'',
|
|
@@ -215,11 +232,34 @@ def test_worktree_clone_path(git_project_runner,
|
|
|
215
232
|
remote_repository.path,
|
|
216
233
|
str(repo_path))
|
|
217
234
|
|
|
218
|
-
assert os.path.exists(
|
|
219
|
-
str(repo_path / f'.{Path(remote_repository.path).name}.git')
|
|
220
|
-
)
|
|
235
|
+
assert os.path.exists(str(repo_path / hidden))
|
|
221
236
|
assert os.path.exists(repo_path / 'master')
|
|
222
237
|
|
|
238
|
+
check_container_gitdir(repo_path, hidden)
|
|
239
|
+
|
|
240
|
+
def test_worktree_clone_container_is_discoverable(git_project_runner,
|
|
241
|
+
remote_repository):
|
|
242
|
+
"""Standing in the container has to answer, since that is the point."""
|
|
243
|
+
git_project_runner.run('.*',
|
|
244
|
+
'',
|
|
245
|
+
'clone',
|
|
246
|
+
'--worktree',
|
|
247
|
+
remote_repository.path)
|
|
248
|
+
|
|
249
|
+
hidden = f'.{Path(remote_repository.path).name}.git'
|
|
250
|
+
container = Path.cwd()
|
|
251
|
+
|
|
252
|
+
# pygit2 reaches the clone through the pointer file.
|
|
253
|
+
found = pygit2.discover_repository(str(container))
|
|
254
|
+
assert found is not None
|
|
255
|
+
assert Path(found).resolve() == (container / hidden).resolve()
|
|
256
|
+
|
|
257
|
+
# So does git-project's own view, which is what consumers use.
|
|
258
|
+
os.chdir(container)
|
|
259
|
+
git = git_project.Git()
|
|
260
|
+
assert git.has_repo()
|
|
261
|
+
assert git.is_bare_repository()
|
|
262
|
+
|
|
223
263
|
def test_worktree_init(git,
|
|
224
264
|
git_project_runner,
|
|
225
265
|
tmp_path_factory):
|
|
@@ -248,11 +288,14 @@ def test_worktree_init(git,
|
|
|
248
288
|
'init',
|
|
249
289
|
'--worktree')
|
|
250
290
|
|
|
251
|
-
|
|
252
|
-
|
|
291
|
+
hidden = f'.{Path(clone_url).parent.name}.git'
|
|
292
|
+
|
|
293
|
+
assert os.path.exists(workarea / hidden)
|
|
253
294
|
assert not os.path.exists(workarea / 'MergedRemote.txt')
|
|
254
295
|
assert os.path.exists(workarea / 'master')
|
|
255
296
|
|
|
297
|
+
check_container_gitdir(workarea, hidden)
|
|
298
|
+
|
|
256
299
|
def test_worktree_init_nonclean(git,
|
|
257
300
|
git_project_runner):
|
|
258
301
|
workarea = git.get_working_copy_root()
|
|
@@ -312,7 +355,7 @@ def test_worktree_init_main(git,
|
|
|
312
355
|
'--worktree')
|
|
313
356
|
|
|
314
357
|
assert os.path.exists(workarea / f'.{Path(clone_url).parent.name}.git')
|
|
315
|
-
|
|
358
|
+
check_container_gitdir(workarea, f'.{Path(clone_url).parent.name}.git')
|
|
316
359
|
assert not os.path.exists(workarea / 'MergedRemote.txt')
|
|
317
360
|
assert os.path.exists(workarea / 'main')
|
|
318
361
|
|
|
@@ -347,7 +390,7 @@ def test_worktree_init_main_master(git,
|
|
|
347
390
|
'--worktree')
|
|
348
391
|
|
|
349
392
|
assert os.path.exists(workarea / f'.{Path(clone_url).parent.name}.git')
|
|
350
|
-
|
|
393
|
+
check_container_gitdir(workarea, f'.{Path(clone_url).parent.name}.git')
|
|
351
394
|
assert not os.path.exists(workarea / 'MergedRemote.txt')
|
|
352
395
|
# Prefer main over master.
|
|
353
396
|
assert not os.path.exists(workarea / 'master')
|
|
@@ -386,7 +429,7 @@ def test_worktree_init_nomain(git,
|
|
|
386
429
|
'--worktree')
|
|
387
430
|
|
|
388
431
|
assert os.path.exists(workarea / f'.{Path(clone_url).parent.name}.git')
|
|
389
|
-
|
|
432
|
+
check_container_gitdir(workarea, f'.{Path(clone_url).parent.name}.git')
|
|
390
433
|
assert not os.path.exists(workarea / 'MergedRemote.txt')
|
|
391
434
|
assert not os.path.exists(workarea / 'master')
|
|
392
435
|
assert os.path.exists(workarea / 'newmain')
|
|
@@ -428,7 +471,7 @@ def test_worktree_init_nomain_multi(git,
|
|
|
428
471
|
stdin=io.StringIO('newmain'))
|
|
429
472
|
|
|
430
473
|
assert os.path.exists(workarea / f'.{Path(clone_url).parent.name}.git')
|
|
431
|
-
|
|
474
|
+
check_container_gitdir(workarea, f'.{Path(clone_url).parent.name}.git')
|
|
432
475
|
assert not os.path.exists(workarea / 'MergedRemote.txt')
|
|
433
476
|
assert not os.path.exists(workarea / 'master')
|
|
434
477
|
assert os.path.exists(workarea / 'newmain')
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|