Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git duet does not support git pull -r #54

Open
codeword opened this issue Sep 22, 2017 · 3 comments
Open

git duet does not support git pull -r #54

codeword opened this issue Sep 22, 2017 · 3 comments

Comments

@codeword
Copy link

Because git duet does not mess with the user entry in the git config it causes random users to be set as the committer on git commits that are being rebased.

To fix this git duet needs to set/change the actual user entry, allowing all other git commands to respect the 'pair/mob' that is attempting to make the commits.

steps to reproduce

GIVEN:
a ~/.git-authors file:

authors
  aa: Alice Abernathy:alice
  bb: Billy Bobsworthy:billy
email:
  example.com

and an entry in the ~/.gitconfig

....
[user]
	name = DONT EVER USE ME!!!!
	initials = nn
	email = nobody@nowhere.com
....

When the pair run

git duet aa bb
echo "some new stuff" > foo.txt
git add foo.txt
git duet-commit -m 'showing a bug'
git log --pretty=full -1

then they should see something like

commit 11122223334444555666aaaabbbccccddddeeefff
Author: Alice Abernathy <alice@example.com>
Commit: Alice Abernathy <alice@example.com>

    showing a bug

    Signed-off-by: Billy Bobsworthy <billy@example.com>

.... Great works as expected

But now some other team member has pushed a commit, and before I can push mine I need to rebase it ontop of some other persons commit

git pull -r

but now if we run
git log --pretty=full -1
we get something like:

commit 22223334444555666aaaabbbccccddddeeefffwhatever
Author: Alice Abernathy <alice@example.com>
Commit: DONT EVER USE ME!!! <nobody@nowhere.com>

    showing a bug

    Signed-off-by: Billy Bobsworthy <billy@example.com>

Essentially git is using the built in git rebase which knows nothing about the [duet "env"] entry in the git config and only knows how to use the [user] entry in the config.

To fix this I think git duet should always rotate one of the duet users into the [user] entry of the git config (similar to what the old ruby git-authors project did.

On a decent size teams that uses rebases to keep a sane commit history, this is an ever present problem and causes a majority of our git history to have undesired (and entirely wrong) users associated to the commits

@jszwedko
Copy link
Member

Hi @codeword,

Good point, that workflow is not directly compatible with git duet out-of-the-box.

You can set GIT_DUET_SET_GIT_USER_CONFIG=1 to have it also set the user git config. This is in the README, but could probably be made more prominent as I find git pull --rebase to be a pretty common workflow.

@codeword
Copy link
Author

Thanks for the response. I'm not sure when it was introduced but my current version does not seem to respect the flag....

+1 on making it more prominent (I think it should default on) as there are so many git commands that have the potential of needing to make new commits, and all of them will be using the [user] entry.

@jszwedko
Copy link
Member

This was added in 0.4.0. Let me know if you have a newer version that isn't respecting it.

I'll leave this open as a reminder to make it more prominent in the README, but I hesitate to change the default behavior just yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants