Skip to content

Staging fails when files are renamed during commit generation #83

@thomas-vilte

Description

@thomas-vilte

Description

I encountered a critical issue where the application fails to stage files when the changeset involves file renames. The tool attempts to stage the original filename rather than the new filename, causing the git operation to fail with a fatal error.

Reproduction Steps

  1. Rename a file in the repository (e.g., mv internal/agent/bootstrap/s3_reporter.go internal/agent/bootstrap/storage_reporter.go).
  2. Run the commit generation tool.
  3. Select the suggested commit message that includes the rename.
  4. Confirm the commit.

Expected Behavior

I expected the tool to correctly identify the file rename and stage the new filename (or handle the index update) so that the commit process completes successfully.

Actual Behavior

The CLI crashed with a fatal git error because it tried to add the old filename which no longer exists on the filesystem.

Error:
[ERROR] failed to stage file file=internal/agent/bootstrap/s3_reporter.go error=GIT: Failed to add file to staging (exit status 128) - fatal: specified path 'internal/agent/bootstrap/s3_reporter.go' did not match any files

Version

Latest

Additional Context

Logs from the failure:

📊 Changes

internal/agent/bootstrap/{s3_reporter.go => storage_reporter.go} | 0

.../agent/bootstrap/{s3_reporter_test.go => storage_reporter_test.go} | 0 
2 files changed, 0 insertions(+), 0 deletions(-)

Confirm commit? (y/n): y
⠋ 🧉 Adding files to staging...[ERROR] failed to stage file file=internal/agent/bootstrap/s3_reporter.go error=GIT: Failed to add file to staging (exit status 128) - fatal: specified path 'internal/agent/bootstrap/s3_reporter.go' did not match any files

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working as it should.fixBug fixesgoPull requests that update go codegood first issueGood for newcomers

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions