Skip to content

Deleting a branch does not remove the associated [branch "..."] section from .git/config #728

@mlcui-corp

Description

@mlcui-corp

Description of the bug

I took a quick look at my .git/config and saw that there were a few [branch "..."] sections from branches that were deleted from a git sync. It seems like hook-detect-empty-commit isn't deleting these config sections as a git branch -d would.

This is a very minor bug - the only issues that occurs with this are:

  • a .git/config file which gets larger over time, and
  • creating a new branch with the same name as a previously git-branchless-deleted branch inherits the settings (remote, upstream, and more) of the old deleted branch.

This is probably an upstream libgit2 issue - see libgit2/libgit2#4582 for a very similar issue - but unlike #678 it seems like it could possibly be fixed from git-branchless.

Let me know if you want a concrete reproduction of this.

Expected behavior

Deleted branches have their [branch "..."] section in .git/config deleted.

Actual behavior

Deleted branches do not have their [branch "..."] section in .git/config deleted.

Version of rustc

No response

Automated bug report

No response

Version of git-branchless

2f0d57e

Version of git

git version 2.39.0.314.g84b9a713c41-goog

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions