Uncommon / Xit

Mac OS X Git GUI
Other
981 stars 46 forks source link

Xit did broke my config and git aliases #461

Closed relikd closed 2 years ago

relikd commented 3 years ago

Thank you for deleting my perfectly working git config.

The app did write this to the config:

[fetch]
    prune = false

and thereby deleted all of my multi-line git aliases! All that ended with a backslash (\). For example, now all aliases look like this:

new-email = "!f() { git filter-branch -f --env-filter ' \

(There is no second line)

Uncommon commented 3 years ago

Sorry about the data loss. Where is the config file that got overwritten?

Config files are handled by libgit2, so I'll look into whether it supports backslash line continuations.

relikd commented 3 years ago

Thanks. I just did finish rewriting two of my most commonly used aliases. The config is stored at a default path, $HOME/.gitconfig.

Uncommon commented 3 years ago

I'm having trouble replicating this. Can you send me an example please?

relikd commented 3 years ago

Sure,

[alias]
    echo = !echo "this \
        is some text"

Then you launch Xit, open the settings menu, and check the box "prune branches". Every time you click the prune branches checkbox, a few lines of the git config will be deleted.

https://user-images.githubusercontent.com/1321720/119700345-602c2180-be53-11eb-8b94-af67949e2fe2.mov

Uncommon commented 3 years ago

Thanks. Config reading & writing is handled by libgit2, which I'm using via Objective-Git which hasn't been updated in a while. I'm working on eliminating Objective-Git and just using libgit2 directly.

Uncommon commented 2 years ago

Updating to libgit2 1.3 unfortunately didn't fix this. Looks like I'll have to do a fix inside libgit2.

Uncommon commented 2 years ago

Fixed in 2532600e3dd9c0cd6d1cd96aac0cd5d3e6342012

Rather than trying to fix libgit2 (which would be complicated because you'd have to have an original and parsed version of every setting), I decided to address this by adding an app level config file to store any settings you change in Preferences. Xit should no longer modify your user config file.