Consolidate create/clone with Repo/Worktree #57
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
github_actions
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
datalad/datalad-core#57
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
These two pieces are from two different waves of the development, the latter being the older.
There is no some overlap in functionality and also some duplication of costs that prevent them from being used together efficiently.
Looking at the present implementation, I think:
Repo.init_atshould be a frontend tocreate_repo()(it could also be removed, butWorktree.init_atis meaninful and removal would taint the symmetry. Not sure yet)Repo|Worktree.init()should perform no checks. Otherwise these would be pointless when these objects are used from within functions likeclone()orcreate(). All checks should migrate to a respectivefrom_pathclass method.Worktree.init_annex()to exist. This is not as feature rich ascreate()and placement is a bit oddOverall, continued development needs a decision on the desired design.
Repo|Worktreeobjects have any "manipulator" (likeinit_at), or should they at most have "interogators"Right now I am leaning towards the following model
Pathdirectly and then do validation of that internallycreate|clonereturnRepo|Worktreerather than nothing (status quo)Repo|Worktreecan be created (__init__()) cheaply, in particular without filesystem interaction, and assume "valid". Dedicated methods likefrom_path()are provided for safer operation, for when such costs are ok.Repolooses itsinit_at(). It would need to be frontend forcreate_repo(). But then it would still not provide the functionality ofcreate(), and it would also introduce circularity whenReporequirescreate*()andcreate()requiresRepoas a return value also.create()should becomecreate_dataset()to make room for acreate_worktree()Worktreelooses itsinit_at()in favor of acreate_worktree(), which takes aRepoinstance as a parameter