RichiH / vcsh

config manager based on Git

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

vcsh doesn't honor ~/.gitconfig

peti opened this issue · comments

My global ~/.gitconfig file defines

[branch]
        autosetuprebase = remote

to ensure that all branches are rebased after git pull (rather than trying to create a merge commit). None of my repositories managed with vcsh honor this setting, though, apprently because $HOME is a different thing than usual when vcsh is run.

I do not know but in the meantime you could try a quick bandaid by making use of vcsh hooks.

Place the following code

git config pull.rebase true

in .config/vcsh/hooks-enabled/pre-upgrade.pull-rebase and try it out!

@DancingQuanta, very cool, thank for for the suggestion. The work-around I had been using so far was to run:

$ vcsh foreach config --replace-all branch.$(git rev-parse --abbrev-ref HEAD).rebase true
$ vcsh foreach config --replace-all branch.autosetuprebase remote

This is not quite as a nice, but it worked okay'ish for me, too. Using the hook is superior, though, because it will set up new repositories correctly.

Does my suggestion fit your needs? You can keep this issue open if you needed answers to your original issue.

I still think it would be better if vcsh would honor ~/.gitconfig so that this whole dance with custom hooks is just unnecessary.

I don't see anything in vcsh which would prevent loading ~/.gitconfig, it seems to work just fine.

You can check with something like:

vcsh REPO_NAME config branch.autosetuprebase

and see if it says remote in your case.

Reading about branch.autoSetupRebase I understand that the setting affects only newly created local branches: only for these branch.NAME.rebase will be set to true, not for already existing branches.

I've checked in on this quite a few ways in 2.0.0 and can confirm that the ~/.gitconfig is used as usual inside of VCSH. The previous comment from @ao2 also has a way to confirm this.

I'm closing this for now but if you are having ongoing trouble do feel free to comment and we'll review the situation.