git-worktrees 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,335 @@
1
+ Metadata-Version: 2.5
2
+ Name: git-worktrees
3
+ Version: 0.1.0
4
+ Summary: Git worktree commands that refuse to lose work.
5
+ Project-URL: Bug reports, https://github.com/MihaiBojin/worktrees/issues/new
6
+ Project-URL: Source, https://github.com/MihaiBojin/worktrees
7
+ Author-email: Mihai Bojin <557584+MihaiBojin@users.noreply.github.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ Keywords: cli,git,worktree
11
+ Classifier: Development Status :: 3 - Alpha
12
+ Classifier: Intended Audience :: Developers
13
+ Classifier: License :: OSI Approved :: Apache Software License
14
+ Classifier: Natural Language :: English
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Requires-Python: >=3.11
21
+ Provides-Extra: dev
22
+ Requires-Dist: pre-commit==4.6.1; extra == 'dev'
23
+ Requires-Dist: pytest==9.1.1; extra == 'dev'
24
+ Description-Content-Type: text/markdown
25
+
26
+ # worktrees
27
+
28
+ Eight commands. Four of them answer a question and print it; four land you
29
+ somewhere, and those need ten lines of shell each, because a binary cannot
30
+ change its caller's directory.
31
+
32
+ | | |
33
+ | --- | --- |
34
+ | `gw` | the CLI itself, taking a subcommand. `worktrees` is the same program under its long name |
35
+ | `gws` | say which worktrees are finished, and why. Removes nothing, and has no flag that could |
36
+ | `gwp` | remove the ones `gws` marks removable, having asked first |
37
+ | `gwa NAME [BASE]` | create a worktree for `NAME` and land you in it |
38
+ | `gwl [QUERY]` | pick one of this repository's worktrees and land you in it |
39
+ | `gwm NEW` | rename this worktree's branch and move the checkout to match |
40
+ | `gwr [QUERY]` | remove a worktree whose branch is finished, and the branch |
41
+ | `gwnb NAME` | alpha. Fetch, then branch `NAME` off the head branch and check it out |
42
+ | `gwrot` | alpha. Start the next branch after this one, or catch the head branch up |
43
+
44
+ `gws` and `gwp` are what this tool is for and their behaviour is settled.
45
+
46
+ **`gwnb` and `gwrot` are alpha and may go.** They start branches rather than
47
+ worktrees, which is a different job from the one this repository exists to do,
48
+ and `origin new-branch` and `origin rotate` already do it. Only one of the two
49
+ sets survives. Until that is decided the names, the flags and the output may
50
+ change, and nothing should be built on top of them.
51
+
52
+ ## Install
53
+
54
+ ```console
55
+ uv tool install git+https://github.com/MihaiBojin/worktrees
56
+ ```
57
+
58
+ One venv of 124 KB serves every command name, at about 1 KB each, all of them
59
+ into `~/.local/bin`. A tag installs that release and nothing later:
60
+
61
+ ```console
62
+ uv tool install git+https://github.com/MihaiBojin/worktrees@v0.1.0
63
+ ```
64
+
65
+ Python 3.11 or newer, and no dependencies. The standard library answers every
66
+ question this asks, so an invocation pays for the interpreter and nothing
67
+ else.
68
+
69
+ Shell functions and completions arrive separately, through a plugin manager,
70
+ the same way any other plugin does. Nothing here ships shell code yet; when
71
+ it does, Fisher reads `functions/`, `completions/` and `conf.d/` from the
72
+ repository root and Antidote takes a `path:` into it:
73
+
74
+ ```console
75
+ fisher install MihaiBojin/worktrees
76
+ ```
77
+
78
+ ```
79
+ MihaiBojin/worktrees path:zsh/plugins/worktrees # in zsh_plugins.txt
80
+ ```
81
+
82
+ Neither manager puts a binary on `$PATH`, which is why the two installs stay
83
+ separate.
84
+
85
+ ## gws
86
+
87
+ ```console
88
+ $ gws
89
+ VERDICT BRANCH WHY
90
+ remove squash-merged squash-merged
91
+ keep dirty-work it has uncommitted changes
92
+ keep holds-secrets merged, but holds 2 ignored path(s); pass --delete-ignored
93
+ unknown never-pushed not merged into main, and no upstream says whether its commits were pushed
94
+
95
+ 1 removable, 2 kept, 1 unclear
96
+ ```
97
+
98
+ ### Three verdicts
99
+
100
+ Each is the instruction it gives. `unknown` is not `keep` with a softer
101
+ word.
102
+
103
+ | | means |
104
+ | --- | --- |
105
+ | `remove` | finished, and safe to remove. The reason says how it was proved: `merged`, `squash-merged`, or a ref reaching a detached commit |
106
+ | `keep` | something says no. Uncommitted work, the head branch, a lock, the worktree you are standing in, ignored files, or a branch simply not merged |
107
+ | `unknown` | it could not tell. A branch with no upstream is the usual one: nothing says whether its commits were pushed anywhere |
108
+
109
+ Where git cannot tell, the forge is asked. A branch merged as part of a
110
+ stack is that case: its changes reach the head branch across several
111
+ squashes, so the intermediate state it holds differs from the final one in
112
+ the same regions, and a diff cannot separate a stale branch from one with
113
+ work left. A merged pull request settles it, cross-checked against the
114
+ commits an upstream has not got, because a request speaks for what reached
115
+ it and nothing about what never did. `--no-forge` decides from git alone.
116
+
117
+ A record left behind by a directory somebody deleted by hand is nobody's
118
+ verdict. `gws` names how many there are; clearing them is `git worktree prune`,
119
+ which mutates, so `gwp` is what runs it.
120
+
121
+ ### Two holes in git
122
+
123
+ **A squash merge inverts `git branch -d`.** A branch whose change is already in
124
+ `main` reports `error: the branch 'x' is not fully merged` and points you at
125
+ `-D`, which deletes anything. By hand, `squashed` and `unmerged` are
126
+ indistinguishable: both report NOT merged, both sit one commit ahead. Opposite
127
+ correct actions, no signal between them.
128
+
129
+ The probe that separates them replays the branch's tree as one commit on the
130
+ merge base and asks `git cherry` whether that patch is already upstream. It
131
+ compares content rather than history, which is what a squash preserves.
132
+
133
+ **`git worktree remove` silently deletes ignored files.** With `.env` and
134
+ `node_modules/` present, `git status --porcelain` prints nothing,
135
+ `git worktree remove` exits 0 with no `--force`, and both are gone. Nothing in
136
+ git brings them back: no ref ever pointed at them. `gws` reads
137
+ `--ignored=traditional`, counts what would go, and marks the worktree `keep`
138
+ until you pass `--delete-ignored`.
139
+
140
+ ## gwp
141
+
142
+ ```console
143
+ $ gwp
144
+ squash-merged ~/git/.worktrees/squash-merged/repo
145
+ restore with: git branch squash-merged d79e417
146
+ remove 1 worktree(s)? [y/N]
147
+ ```
148
+
149
+ It removes exactly the rows `gws` marks `remove`, under the same flags, and one
150
+ function returns that set for both. What goes and what puts it back is printed
151
+ before anything does, and neither `--quiet` nor `--yes` silences it.
152
+
153
+ `-y` skips the question. A run whose stdin is not a terminal refuses rather
154
+ than blocking, because an agent or a pipe reaching a prompt would hang forever
155
+ holding the repository's worktrees:
156
+
157
+ ```console
158
+ $ gwp < /dev/null
159
+ not a terminal, so nothing can answer for the 1 above; pass --yes to remove them
160
+ ```
161
+
162
+ The checkout goes through plain `git worktree remove`, so every refusal git
163
+ makes still applies. The branch goes through `git branch -d`, never `-D`, so a
164
+ squash-merged branch keeps its ref after its worktree is gone.
165
+
166
+ There is no `--dry-run`. `gws` reports and `gwp` asks, so a flag meaning "do
167
+ not act" would be a no-op wearing the clothes of a safety feature, and somebody
168
+ would one day cite it as the reason a sweep was safe.
169
+
170
+ ## gwnb (alpha)
171
+
172
+ ```console
173
+ $ gwnb fix-parser
174
+ fix-parser from origin/main at 4a91c02
175
+ ```
176
+
177
+ Alpha, and a branch command rather than a worktree one. See the note above
178
+ the install section.
179
+
180
+ The base is `<remote>/<head>` as it stands after the fetch, not the local copy
181
+ of it, so the branch starts on top of what the server has and nothing has to be
182
+ rebased afterwards. It travels as a full ref, because git resolves a bare name
183
+ as a tag first and a repository holding a tag called `origin/main` would branch
184
+ from the tag.
185
+
186
+ `--no-track`, so the head branch does not become the new branch's upstream. A
187
+ branch that tracked it would take it as its upstream and `git push` would
188
+ target the head branch.
189
+
190
+ A failed fetch is not fatal. An offline machine still gets a branch, off
191
+ whatever it last saw, and the line at the end names the commit it got.
192
+
193
+ ## gwrot (alpha)
194
+
195
+ ```console
196
+ $ gwrot
197
+ fix-parser-2026-09-11_001 from origin/main at 4a91c02
198
+ ```
199
+
200
+ Alpha, on the same footing as `gwnb`.
201
+
202
+ It takes no argument. The name comes from the branch you are standing on,
203
+ with any suffix a previous rotation added already stripped, so four
204
+ rotations in a day give four siblings rather than one name carrying four
205
+ suffixes:
206
+
207
+ ```
208
+ fix-parser -> fix-parser-2026-09-11_001
209
+ fix-parser-2026-09-11_001 -> fix-parser-2026-09-11_002
210
+ fix-parser-2026-09-10_003 -> fix-parser-2026-09-11_001
211
+ ```
212
+
213
+ Three digits, so the sequence cannot be read as another field of the date. A
214
+ number is free only when neither `refs/heads/` nor the remote holds it, or
215
+ two people rotate into the same name.
216
+
217
+ On the head branch there is no chain to continue, so it catches that up
218
+ instead:
219
+
220
+ ```console
221
+ $ gwrot
222
+ main is at origin/main
223
+ ```
224
+
225
+ That is `merge --ff-only`, never a rebase: rewriting local commits on the
226
+ head branch is the class this tooling refuses everywhere else. Commits the
227
+ remote does not have are refused and listed, because they are a change of
228
+ their own and `gwnb` puts them on a branch.
229
+
230
+ ## gwa, gwl, gwm, gwr
231
+
232
+ Worktrees live at `<PARENT>/.worktrees/<NAME>/<REPO>`, derived rather than
233
+ configured, so two tools cannot disagree about a location neither can be
234
+ told. A branch name with slashes becomes directories, and the repository
235
+ name goes last, so `feat/oauth` cannot collide with `feat`.
236
+
237
+ ```console
238
+ $ gwa fix-parser # creates it and lands you in it
239
+ $ gwl parse # one match takes it outright
240
+ $ gwm parser-v2 # renames the branch and moves the checkout
241
+ $ gwr # removes the one you are standing in
242
+ ```
243
+
244
+ Each prints one destination on stdout and nothing else, which is what the
245
+ shell function reads. `gwr` prints a path **only** when you were standing in
246
+ what it removed; empty output means stay put.
247
+
248
+ `gwm` is the one that is not a convenience. Renaming the directory you are
249
+ standing in leaves the shell with a stale `$PWD` and every later command
250
+ failing:
251
+
252
+ ```console
253
+ $ git status
254
+ fatal: Unable to read current working directory: No such file or directory
255
+ ```
256
+
257
+ `gwl` with more than one match asks, numbered. Matching is substring first
258
+ and then subsequence, so `tst` finds `add-tests`, and a substring hit always
259
+ outranks a loose one. Without a terminal it refuses rather than blocking and
260
+ names `--list` and `--json`.
261
+
262
+ `gwr` refuses a branch that is not finished and says why, the same verdict
263
+ `gws` prints. `--force` removes the checkout and keeps the branch: the
264
+ worktree was in the way, the work was not.
265
+
266
+ ## Flags
267
+
268
+ `--branch NAME`, `--no-fetch`, `--delete-ignored`, `--json`, `-q`, `-v` and
269
+ `--explain` are shared by `gws` and `gwp`. `-y` is `gwp` alone. `gwnb` and
270
+ `gwrot` take `--no-fetch`, `--json`, `-q`, `-v` and `--explain`.
271
+
272
+ Data goes to stdout and diagnostics to stderr, including the prompt, so
273
+ `--json` is parseable in every mode.
274
+
275
+ ## From a prompt, and from a script
276
+
277
+ Every command here is a console script, so a script reaches it with no shell
278
+ loaded at all. `gws` and `gwnb` answer identically either way:
279
+
280
+ ```console
281
+ $ gws --json | jq -r '.verdicts[] | select(.verdict=="remove") | .branch'
282
+ fix-parser
283
+
284
+ $ fish -c 'gws --json' | jq '.verdicts | length'
285
+ 4
286
+
287
+ $ bash -c 'gwnb spike --json' | jq -r .base
288
+ refs/remotes/origin/main
289
+ ```
290
+
291
+ `gwp` is the one that reads the terminal, and it does so deliberately. With a
292
+ tty it asks; without one it refuses rather than blocking, because a script or
293
+ an agent reaching a prompt would hang holding the repository's worktrees:
294
+
295
+ ```console
296
+ $ gwp # at a prompt
297
+ squash-merged ~/git/.worktrees/squash-merged/repo
298
+ restore with: git branch squash-merged d79e417
299
+ remove 1 worktree(s)? [y/N] y
300
+ removed 1 worktree(s)
301
+
302
+ $ gwp < /dev/null # in a script, a pipe, a CI job
303
+ not a terminal, so nothing can answer for the 1 above; pass --yes to remove them
304
+
305
+ $ gwp --yes --json # what an agent runs
306
+ {"removed": ["squash-merged"], "failed": 0}
307
+ ```
308
+
309
+ Data is on stdout and every diagnostic on stderr, the prompt included, so
310
+ `--json` parses in all three cases.
311
+
312
+ ## What it refuses
313
+
314
+ Six git commands are refused wherever they appear, whatever flags are passed
315
+ and whatever a caller asks for:
316
+
317
+ ```
318
+ reset --hard a forced checkout or switch clean -f
319
+ push --force worktree remove --force branch -D
320
+ ```
321
+
322
+ The check runs on the argument list as it is about to be handed to git, so no
323
+ code path can assemble its way past one. `gws --explain` prints every git
324
+ command the program can issue, all 28 of them, marking the six that change
325
+ anything.
326
+
327
+ `--force-with-lease` is not `--force` and is allowed. `branch -d` is not
328
+ `branch -D` and is how a branch is deleted here: on git's own proof of merge,
329
+ or not at all.
330
+
331
+ ## Contributing
332
+
333
+ The Python, the tests and the release procedure are in
334
+ [docs/DEVELOPMENT.md](docs/DEVELOPMENT.md). The rules the code follows are in
335
+ [AGENTS.md](AGENTS.md).
@@ -0,0 +1,18 @@
1
+ worktrees/__init__.py,sha256=NHzb254l9gQY31NSEkRoeL2tSpMj0J_-jLzaQwcUDAs,263
2
+ worktrees/cli.py,sha256=c5AIhGLqYgeHm76CXQ-mTaZ2wouB-znn_1WnMeItFZM,24457
3
+ worktrees/forge.py,sha256=1h7Dx37wd1IzR20XtFDx6j7czeYzWck8cj2u_LaG4qk,2896
4
+ worktrees/git.py,sha256=7ZXyJQof-Jp0s7MWN5Wq8Nz0bEpMdR4dr_kWKtjQGQc,9588
5
+ worktrees/layout.py,sha256=9p3fHRhvVKSkLvoyiPAsT35MoytTffKjikqPyta8-Do,1793
6
+ worktrees/merged.py,sha256=UWs6Gyj6zFXQQLwS4fUwMgYYdb1VbimXBCzhH114uio,3393
7
+ worktrees/new_branch.py,sha256=aDn5NMviZo_Kr1GEPWNFmfDPzdMMEY3BWbr5LZWbTvk,2588
8
+ worktrees/pick.py,sha256=CD97wJ9N0EiMi6ak58i4sGgPoZWEH1lX7RaCtJ3G5eg,3642
9
+ worktrees/prune.py,sha256=8AsbnmGVpea3lINg8w92APhQHycV_VGKQyZjOjVlf4s,5327
10
+ worktrees/repo.py,sha256=I3ENTjOHulo2cRdAKpYa2uhZ6TXYrQbbGSmQdBsHAhQ,11217
11
+ worktrees/rotate.py,sha256=-zw_0qNp1IC_XK--NsWiZzPK8fMpX54reo3VLmH3BuY,4727
12
+ worktrees/verdicts.py,sha256=thhS5Q02ZLm0TYCa_Yw94RdTPJ-3r4jfuc8XGRLW4OA,5328
13
+ worktrees/worktree.py,sha256=BgS4IjJFyXghNwThyjKWIQF2PB0ZJ1EpvTPqxtIcpts,7276
14
+ git_worktrees-0.1.0.dist-info/METADATA,sha256=97A7sf0PVv1U5jhJCAVEelSQQlVRsFU5vXe0jptPlN4,12967
15
+ git_worktrees-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
16
+ git_worktrees-0.1.0.dist-info/entry_points.txt,sha256=6pGH1pmMRQB3PFhZrOFRpzq3mku4azrqIquLFLhsJyc,271
17
+ git_worktrees-0.1.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
18
+ git_worktrees-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.32.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,11 @@
1
+ [console_scripts]
2
+ gw = worktrees.cli:main
3
+ gwa = worktrees.cli:gwa
4
+ gwl = worktrees.cli:gwl
5
+ gwm = worktrees.cli:gwm
6
+ gwnb = worktrees.cli:gwnb
7
+ gwp = worktrees.cli:gwp
8
+ gwr = worktrees.cli:gwr
9
+ gwrot = worktrees.cli:gwrot
10
+ gws = worktrees.cli:gws
11
+ worktrees = worktrees.cli:main
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
worktrees/__init__.py ADDED
@@ -0,0 +1,8 @@
1
+ """Git worktree commands that refuse to lose work."""
2
+
3
+ from importlib.metadata import PackageNotFoundError, version
4
+
5
+ try:
6
+ __version__ = version("git-worktrees")
7
+ except PackageNotFoundError: # a source tree nothing has installed
8
+ __version__ = "0+unknown"