Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Unable to delete file when the repository will be empty #723

Copy link
Copy link
Closed
@Erouan50

Description

@Erouan50
Issue body actions

Hello,

First, thank you for this incredible package!

I get the following error when I try to remove the latest file in a repository and commit:

cannot create empty commit: clean working tree

I think the issue is due to the index entries being empty when the tree is built here:

if len(idx.Entries) == 0 && (opts == nil || !opts.AllowEmptyCommits) {

Here is a screenshot of my debugging session:

swappy-20230327-174441

You can see that the index entries are empty, but I have a change staged and ready to be committed.

Here is the code that you can use to reproduce my issue: https://gist.github.com/Erouan50/e2c8ec8d8ad21c7f3761b5f193ab6171#file-main-go

I'll create a pull request if you agree it is a bug.

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.