sema icon indicating copy to clipboard operation
sema copied to clipboard

Not respecting gitconfig

Open djetelina opened this issue 1 year ago • 2 comments

Hey, love the tool, but the very first use I already had to amend a commit to change the author email, because my git config wasn't respected :(

What I mean by that, I have different git configs loaded (overriding author email) base on the directory git is called from.

[includeIf "gitdir:~/Documents/work/company/**"]
        path = ~/Documents/work/company/.gitconfig
---
# the other .gitconfig
[user]
    name = Ma Name
    email = [email protected]

Unfortunately, sema doesn't seem to respect that :(

djetelina avatar Oct 02 '24 14:10 djetelina

Hey there @djetelina!

Ye, that sounds very much plausible. During its early versions, sema used to rely on the native git command calling it directly though exec.Command. However, someone later suggested that we hop onto a git library that is supposed to be identical to the reference implementation CLI everyone uses.

Unfortunately, after making that switch, I realised that this library doesn't respect many things, including, for example, pre-commit hooks (which is a bummer).

Regarding the issue, here are some things that we can try:

  1. Bump the git library version and hope that they fixed it.
  2. Raise this issue with them and hope that they include things like hooks and .gitconfig into their implementation.
  3. Go back to the way it was, completely removing that library as a dependency but start depending on the user's git CLI currently installed on their machine.

I'd love to hear your opinion on the matter!

sharpvik avatar Oct 23 '24 22:10 sharpvik

I quickly tried to scan go-git issues to understand whether it works or not and I didn't come to a conclusion (there is an issue for it but it's unclear whether it's supposed to work or not from the discussion, but i'm not a golang person), if bumping the version fixes it, then that seems like the easiest way to fix it. If it does not, I don't see the harm in exec/benefit of using the library.

djetelina avatar Oct 26 '24 16:10 djetelina