Commit 0bf7c8f
authored
fix(branch): reject extra args with --rename/-m and add cycle detection (#718)
## Summary
Fixes #717
- Reject unexpected extra positional arguments when `--rename`/`-m` flag is used with `av branch`, preventing silent misuse where `-m 'message'` triggers a rename instead of branch creation
- Add visited-set cycle detection to `SubsequentBranches` and `SubsequentBranchesFiltered` so a corrupted branch graph (e.g., self-referencing parent) logs a warning instead of crashing with a stack overflow
## Test plan
- [ ] `av branch foo -m 'bar'` now returns a clear error instead of silently renaming
- [ ] `av branch --rename new-name` still works correctly
- [ ] `av branch old:new -m` still works (colon syntax for rename)
- [ ] Existing tests pass (`go test ./...`)1 parent a5cbc55 commit 0bf7c8f
2 files changed
Lines changed: 27 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
74 | 79 | | |
75 | 80 | | |
76 | 81 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
125 | 130 | | |
126 | 131 | | |
127 | 132 | | |
128 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
129 | 139 | | |
130 | | - | |
| 140 | + | |
131 | 141 | | |
132 | 142 | | |
133 | 143 | | |
| |||
136 | 146 | | |
137 | 147 | | |
138 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
139 | 154 | | |
140 | 155 | | |
141 | 156 | | |
142 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
143 | 162 | | |
144 | 163 | | |
145 | 164 | | |
146 | 165 | | |
147 | 166 | | |
| 167 | + | |
148 | 168 | | |
149 | | - | |
| 169 | + | |
150 | 170 | | |
151 | 171 | | |
152 | 172 | | |
| |||
0 commit comments