gfargo / gfargo/coco

split: fails when planned file is untracked/unstaged

Open
#2,129 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
14
Forks
1
Avg merge
5d 22h
Merged PRs (30d)
16

Description

Summary

coco commit --split fails when a file included in the generated split plan is itself untracked or has unstaged changes. This creates a chicken-and-egg problem when coco's own config file (.coco.json) is part of the commit.

Steps to Reproduce

  1. Have a repo with staged changes and an untracked .coco.json file
  2. Run coco commit --split
  3. Coco generates a split plan that includes .coco.json as one of the files to commit
  4. User confirms the plan
  5. Coco errors out:
Error: Cannot apply split plan because these files also have unstaged or untracked changes: .coco.json

Expected Behavior

Coco should be able to commit files that are in the split plan even if they're currently untracked. If a file is part of the plan, coco should stage it before applying the commit rather than treating it as a conflict.

Possible Solutions

  • Auto-stage files that are part of the approved plan before applying commits
  • Skip the dirty-check for files that are explicitly included in the plan
  • Exclude untracked files from the plan if they can't be handled, with a clear message

Environment

  • coco version: latest
  • OS: macOS
  • Node: v22.14.0

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the coco commit --split command and the dirty-check that produces the reported conflict for .coco.json; reproduce it with staged changes and an untracked or unstaged planned file. Done means a file explicitly included in the approved split plan can be committed without triggering the unstaged or untracked conflict.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, typescript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.