-
Notifications
You must be signed in to change notification settings - Fork 375
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
Only configure git user if needed #3472
base: master
Are you sure you want to change the base?
Conversation
Not sure if this is really the right thing to do here. Many people will have a name and email set in their global git config. This change makes it impossible to overwrite that via macros. I can imagine people not wanting their general git settings ending up in there. |
If you have proper git formatted patches, I think you'll have better luck with -S git_am instead of plain -S git, the latter is really only intended to get random patches under at least a little bit of version control. |
Not sure what you mean. You can still set the
I'm using
In case it's relevant, this is my usual workflow when doing an RPM package update:
|
This is easy to agree with. And easist dealt with by adding --no-signoff to our git commit commands, it's the right thing to do really. |
Unfortunately won't help me. ;-) It's not signing-off the patches when it makes them ( Alternatively, if we want to stay with the rpm-build user in all cases, adding a line of |
Oh, I didn't know format-patches would apply signoffs too. Seems kinda strange, but then in an email-based workflow... In any case, this already is a case of whack-a-mole, the git usage inside rpmbuild is nothing like any normal repo usage is, so we keep running into these wrinkles every now and then. This sure isn't the first, nor the last. But you said you're using git_am. In which case rpm really shouldn't override the author at all. So that seems like the real bug here. The non-am version was added first and there the user/email simply isn't expected to exist and rpm has to put something there, whereas with git am the user info has to be there already. So I think the right thing to do, really, is to separate the setup of these two different forms. Right now, git_am setup simply calls git setup. |
@pmatilai Oh, now I think I'm getting the problem @ffesti was worried about – when using just Based on the feedback, I'm turning this PR into a draft; let me try to implement the setup split for |
Configuration requirements for `git` and `git_am` can be different enough so that that these two should not share the setup routine in it's entirety [1]. On the other hand, some parts of the setup can (and should) be kept same in both approaches. [1]: rpm-software-management#3472 This splits the `%__scm_setup_git` macro into several named steps, which are then combined as needed. It also implements the first difference between `git` and `git_am` – the author is no longer configured when using `git_am`.
So, the attempt is here. I'm splitting the original setup macros into several named steps, then combining them back as needed. I'm not 100% satisfied with the names, but I figured they are good enough to throwing the implementation up for discussion. |
Looks good to me overall, two suggestions though:
|
Thinking about it again, 2. might not be worth the trouble (you'd need to duplicate the macro body in the first commit) perhaps, so take that with a pinch of salt 😄 |
|
Configuration requirements for `git` and `git_am` can be different enough so that that these two should not share the setup routine in it's entirety [1]. On the other hand, some parts of the setup can (and should) be kept same in both approaches. [1]: rpm-software-management#3472 This splits the `%__scm_setup_git` macro into several named steps, that are later combined. This will allow for future differentiation of `git` and `git_am` by customizing (only) the relevant step(s).
With `-S git_am`, the author has to be already specified in the commits. Configuring the user in this case can lead to unexpected authorship overrides [1]. [1]: rpm-software-management#3472
Since I was going back to reword the commit, it was not that hard to split it into two. Let me know if this looks good to you. |
There are multiple git behaviors linked to valid user configuration; one among them is the --signoff flag and/or
format.signOff
configuration. Always setting the user torpm-build <rpm-build>
can then cause git to emit nonsense lines, which can not be easily turned off just for the affected repositories.Setting the user only if one is not already configured should give best of both worlds – git will not bail out on unknown user and the actual author of commits will be kept in Signed-off-By trailers.
I did not manage to run the test suite, so I'm hoping for CI to kick in. 🤞