DUP-GO-10/11: abs-path dir validation duplicated across worktree and git handlers #48
Labels
No labels
backend
bug
chore
duplication
effort:complex
effort:medium
effort:trivial
enhancement
frontend
fullstack
priority:high
ready-for-agent
refactor
security
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
dries/ocman#48
Loading…
Add table
Add a link
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?
Summary
The same 5-line block for validating the
dirquery parameter appears in at least 4 places across two files:internal/server/handlers_worktree.golines 60–68 (handleWorktreeList)internal/server/handlers_worktree.golines 95–103 (handleWorktreeDefaultBaseRef)internal/server/handlers_worktree.golines 128+ (handleWorktreeCreateAndLaunch)internal/server/handlers_git.golines 93–101 (handleGitDiff)Duplicated block
Additionally,
handleWorktreeListandhandleWorktreeDefaultBaseRefboth duplicate theResolveRepoRooterror-handling block (~15 lines each).Fix
parseAbsDir(w http.ResponseWriter, r *http.Request) (string, bool)for the dir validationresolveWorktreeRoot(w, r) (string, bool)for the full dir+repoRoot resolutionEffort
Trivial.