argocd-autopilot
argocd-autopilot copied to clipboard
Support gitconfig includeIf feature
I heavily rely on includeIf to split my work and personal profiles. With my gitconfig I get the following error when using argocd-autopilot:
INFO cloning repo: https://github.com/reegnz/argocd-autopilot-bug.git
INFO repository 'https://github.com/reegnz/argocd-autopilot-bug' was not found, trying to create it...
WARNING --provider not specified, assuming provider from url: github
INFO empty repository, initializing a new one with specified remote
FATAL failed to initialize repository: failed to commit while trying to initialize the branch. Error: failed to commit. Please make sure your gitconfig contains a name and an email
My current workaround is to put my user.name and user.email into ~/.gitconfig, but that's not great...
The problem is most definitely with go-git not supporting conditional includes with includeIf, see #388
It would be great if one could opt-out of using go-git and have argocd-autopilot shell out to the git command instead.
Here's my current gitconfig looks like:
~/.gitconfig:
[include]
path = ".gitconfig-private"
[includeIf "gitdir:~/work/"]
path = ".gitconfig-work"
~/.gitconfig-work:
[user]
name = My Name
email = [email protected]
~/.gitconfig-private:
[user]
name = My Name
email = [email protected]
This feature is definitely useful.
Looking at go-git, there's a ton of gitconfig issues, which makes me question even using it vs. just shelling out to git. See https://github.com/go-git/go-git/issues/395
Would it make sense dropping go-git and exec-ing with the system's own git cli instead?