Closed cwlbraa closed 4 years ago
I wanted to make sure I understood the problem. Members of the team are using both git with
and git author
commands to record who is pairing with who.
In this case git author
is correctly setting the commit message.
In general, I recommend only using one git pairing tool at a time. I realize that git author
uses git together
under the covers. It wouldn't surprise me that there's odd behaviors.
I recommend only using one git pairing tool at a time.
This is not a straightforward recommendation.
git-author is a pairing tool that directly depends on having another pairing tool installed and usable. On CF teams, we move between teams' workstation setups all the time and everyone has a different set of commands they expect to work. It's fine if the other tools fail, but in this particular case we can't disable git with
or else git author
will no longer work. We can't easily stop team members or cross-team-pairs from erroneously using git with
, and that corrupts usage of git-author.
First, just want to confirm, the git with
is actually git-together with
?
Second, inside git author
, we actually called git-together with --global
.
In the repro, people set different authors with git with
and git author
. Where git author
correctly set the commit template message and global setting, and git with
correctly set the author and committer information locally for this repo.
However, that's confusing. We actually have 2 pairs working on the same commit. Hence this ends up the author
and committer
no longer consistent with the commit message template of Co-authored-by:
. I think that's the root cause of the issue.
I would recommend people to use consistent pairs, e.g.
git with cb am
git author cb am
Yup yup, I think you've described the issue pretty clearly, @xinzweb, but your recommendation is not ideal-- we work across many repos and we'd need to constantly re-run git with cb am
to keep things consistent.
All we really want is to force global state to be the only state. git-author is already trying to do this, but its git-together
dependency leaks through and still allows repo-local state to be set and read.
We have found a workaround, though, based on the observation that git with --clear
always correctly removes local state- it's ugly, but it seems to be working so far!
alias git="git-together with --clear 2>/dev/null || true ; git-together"
This took the CAPI team an eternity to track down, but when using git-author , we've noticed some inconsistency in whose names get applied to a commit if folks use aliases in combination with raw
git with
. Some folks here have reflexes aroundci
for "commit" andwith
forauthor
, and it's been causing lots of havoc.The bug is basically this:
The
git with
command sets the local repo's.git/config
file'sgit-together.active
, andgit author
(correctly) sets the same in${HOME}/.gitconfig
, and we end up with surprising commit messages because the local state sticks around in places where we wouldn't expect.