Commit b2e9e6a
authored
Add support for git worktrees (#353)
Adds numbering & aliasing for branches currently checked out by git
worktrees.
Previously, if you were to create a new git worktree, the branch does
not get picked up with scm_breeze's numbering:
```
$ gco -b tmp && gco - && gco -b tmp2 && gco -
$ git worktree add /tmp/scm_breeze_tmp tmp
$ gb
* [1] main
+ tmp
[3] tmp2
$ gco 2
error: pathspec '+ tmp' did not match any file(s) known to git
```
With this change, worktrees now appear to the user as "just another
branch." Using scm_breeze aliases, you can swap branches seamlessly,
using numeric aliases and without needing to manually remember & change
directories.
```
$ gb
* [1] main
+ [2] tmp
[3] tmp2
$ gco 2
Switching to worktree: /tmp/scm_breeze_tmp
```
The `+` distinguishes between branches currently checked out in separate
worktrees2 files changed
+40
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
34 | 36 | | |
35 | 37 | | |
36 | 38 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
37 | | - | |
| 37 | + | |
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
44 | 78 | | |
45 | 79 | | |
46 | 80 | | |
| |||
0 commit comments