Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only configure git user if needed
Browse files Browse the repository at this point in the history
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 to `rpm-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.

Signed-off-by: Jan Staněk <jstanek@redhat.com>
khardix committed Nov 27, 2024
1 parent fe9a914 commit 77d585c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions macros.in
Original file line number Diff line number Diff line change
@@ -1241,8 +1241,8 @@ Supplements: (%{name} = %{version}-%{release} and langpacks-%{1})\
# Git
%__scm_setup_git(q)\
%{__git} init %{-q}\
%{__git} config user.name "%{__scm_username}"\
%{__git} config user.email "%{__scm_usermail}"\
%{__git} config --get user.name >/dev/null || %{__git} config user.name "%{__scm_username}"\
%{__git} config --get user.email >/dev/null || %{__git} config user.email "%{__scm_usermail}"\
%{__git} config gc.auto 0\
%{__git} add --force .\
GIT_COMMITTER_DATE=%{__scm_source_timestamp} GIT_AUTHOR_DATE=%{__scm_source_timestamp}\\\

0 comments on commit 77d585c

Please sign in to comment.