From 77d585ceb8cb5b8085fe0a80a54d07d51da36c45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stan=C4=9Bk?= Date: Wed, 27 Nov 2024 14:45:37 +0100 Subject: [PATCH] Only configure git user if needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ` 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 --- macros.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/macros.in b/macros.in index 886d24c0bf..6f3399f7e1 100644 --- a/macros.in +++ b/macros.in @@ -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}\\\