fix: multiple safety check and sync improvements
- bd-dtm: Changed stderr printing to use SafetyWarnings in worktree.go - bd-ciu: Fixed non-deterministic output order in formatVanishedIssues - bd-dmd: Removed duplicate safety check message in sync.go - bd-k2n: PushSyncBranch now recreates worktree if cleaned up - bd-c5m: Fixed string(rune()) in tests to use strconv.Itoa - bd-8uk: Added test for SafetyWarnings population - bd-1kf: Fixed mergePriority to handle negative priorities - bd-xo9: Documented sync.require_confirmation_on_mass_delete config 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -427,7 +427,7 @@ func mergeNotes(base, left, right string) string {
|
||||
|
||||
// mergePriority handles priority merging - on conflict, higher priority wins (lower number)
|
||||
// Special case: 0 is treated as "unset/no priority" due to Go's zero value.
|
||||
// Any explicitly set priority (>0) wins over 0. (bd-d0t fix)
|
||||
// Any explicitly set priority (!=0) wins over 0. (bd-d0t fix, bd-1kf fix)
|
||||
func mergePriority(base, left, right int) int {
|
||||
// Standard 3-way merge for non-conflict cases
|
||||
if base == left && base != right {
|
||||
@@ -442,10 +442,11 @@ func mergePriority(base, left, right int) int {
|
||||
// True conflict: both sides changed to different values
|
||||
|
||||
// bd-d0t fix: Treat 0 as "unset" - explicitly set priority wins over unset
|
||||
if left == 0 && right > 0 {
|
||||
// bd-1kf fix: Use != 0 instead of > 0 to handle negative priorities
|
||||
if left == 0 && right != 0 {
|
||||
return right // right has explicit priority, left is unset
|
||||
}
|
||||
if right == 0 && left > 0 {
|
||||
if right == 0 && left != 0 {
|
||||
return left // left has explicit priority, right is unset
|
||||
}
|
||||
|
||||
|
||||
@@ -563,6 +563,35 @@ func TestMergePriority(t *testing.T) {
|
||||
right: 2,
|
||||
expected: 2, // right changed from 0 to 2
|
||||
},
|
||||
// bd-1kf fix: negative priorities should be handled consistently
|
||||
{
|
||||
name: "bd-1kf: negative priority should win over unset (0)",
|
||||
base: 2,
|
||||
left: 0,
|
||||
right: -1,
|
||||
expected: -1, // negative priority is explicit, should win over unset
|
||||
},
|
||||
{
|
||||
name: "bd-1kf: negative priority on left should win over unset (0) on right",
|
||||
base: 2,
|
||||
left: -1,
|
||||
right: 0,
|
||||
expected: -1, // negative priority is explicit, should win over unset
|
||||
},
|
||||
{
|
||||
name: "bd-1kf: conflict between negative priorities - lower wins",
|
||||
base: 2,
|
||||
left: -2,
|
||||
right: -1,
|
||||
expected: -2, // -2 is higher priority (more urgent) than -1
|
||||
},
|
||||
{
|
||||
name: "bd-1kf: negative vs positive priority conflict",
|
||||
base: 2,
|
||||
left: -1,
|
||||
right: 1,
|
||||
expected: -1, // -1 is higher priority (lower number) than 1
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range tests {
|
||||
|
||||
Reference in New Issue
Block a user