Command to remove git-bug data from git repository

Labels: Easy pick help wanted

Timeline

Yuri D'Elia (wavexx) opened (edited)

At one point I was using an old version of git-bug on a repository that I stopped updating for a while. Today I wanted to use it again, and git-bug complained about the incompatible metadata format.

However I didn't want to upgrade the existing data, I just wanted to re-create the metadata from scratch.

I actually had an hard time finding out all the places/refs that one needed to remove before git-bug was happy to initialize a new repository.

I don't think a "remove from repository" command is necessary, but it would be nice to have an overview and/or list of commands that can be used to remove all refs, dirs and config entries used by git-bug from an existing repository.

To account for all past versions, so far these seem to be the following refs: refs/bugs/ refs/identities/ refs/remotes/*/bugs/, the "git-bug[.*]" entries from .git/config, the .git/git-bug directory.. (did I miss anything?)

Sascha (GlancingMind) commented

The Makefile does contain two targets (clean local bugs and clean local identities) which seem to remove the "not so obvious" directories. Though, they don't cleanup the .git/config and the .git/git-bug directory and a makefile is not particularly user friendly. So yeah, this is more a workaround then a proper solution.

Michael Muré (MichaelMure) added label help wanted

Michael Muré (MichaelMure) added label Easy pick

stefnotch (stefnotch) commented

I don't think a "remove from repository" command is necessary

Today I was searching for this after the migration, since not everything worked as intended. I'd greatly appreciate having such a command that lets me completely remove git-bug from a repository and then I can safely try again.

Michael Muré (MichaelMure) commented

Arguably, that could be a dedicated CLI subcommand.

Kalin Staykov (kalinstaykov) commented

I see that the make targets are using git commands to clean remote bugs and identities which might be non-trivial to implement without shelling out the commands or printing them for user consideration.

I can give this a shot if I know how that should be handled.

Michael Muré (MichaelMure) changed the title from Command to remove git-bug data from git repository to Command to remove git-bug data from git repository

Michael Muré (MichaelMure) commented

@zinderic sure, it seems like there is a consensus that it makes sense. From what I've seen, it's also a very common question/need, especially for newcomers.

I'm not so sure about the naming though, eject? cleanup? It doesn't fully feels right.

Now for the design:

  • in entity_actions.go there is already a Remove(), we can have a RemoveAll()
  • bubbling that up in entities/bug/bug_actions.go, the equivalent RemoveAll()
  • for identities, they don't rely on the "entity framework", so more code need to be added in entities/identity/identity_actions.go
  • to finish, a new command using LoadRepo() instead of LoadBackend() to bypass the cache and directly run the previous functions

Let me know if that make sense.

stefnotch (stefnotch) commented

I guess I'd be looking for a command named remove or uninstall. cleanup also sounds fine. eject would confuse me.

Uninstall might be misinterpreted as "globally uninstall git bug" though, so it might not be ideal.

Sascha (GlancingMind) commented

purge and wipe might also fit.

Kalin Staykov (kalinstaykov) commented

I opened PR https://github.com/MichaelMure/git-bug/pull/933 for this. I don't have a strong opinion what should be the name of the sub-command, for me personally cleanup, wipe, purge and remove would work just fine so I picked the first one but I can change it if you would prefer a different one.

Michael Muré (MichaelMure) commented

I like @GlancingMind's suggestion ... let's do ... wipe? According to https://wikidiff.com/wipe/purge it's slightly more correct while also not carrying the political/religious association.

Kalin Staykov (kalinstaykov) commented

OK, wipe it is then, I'll change it. Thank you for the PR review and the feedback, I'll work on it.

David Costa (zarelit) commented

git-annex uses uninit: uninit De-initialize git-annex and clean out repository.

Alec Lanter (kintar) commented

@zinderic : Are you still working on this? If not, I'll pick it up for you, but I don't want to step on your toes if you're just delayed and busy.

Michael Muré (MichaelMure) commented

#933 has been merged, we can close this.

Michael Muré (MichaelMure) closed the bug