argocd-autopilot icon indicating copy to clipboard operation
argocd-autopilot copied to clipboard

Support gitconfig includeIf feature

Open reegnz opened this issue 3 years ago • 2 comments

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]

reegnz avatar Mar 30 '22 14:03 reegnz

This feature is definitely useful.

pradeepnnv avatar Apr 03 '23 21:04 pradeepnnv

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?

reegnz avatar Apr 11 '24 11:04 reegnz