Skip to content

Commit 5f6f6b8

Browse files
committed
Split git setup to multiple macros
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]: #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`.
1 parent fe9a914 commit 5f6f6b8

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

macros.in

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1239,25 +1239,42 @@ Supplements: (%{name} = %{version}-%{release} and langpacks-%{1})\
12391239
%__scm_source_timestamp @${SOURCE_DATE_EPOCH:-${RPM_BUILD_TIME:?}}
12401240

12411241
# Git
1242-
%__scm_setup_git(q)\
1242+
%__scm_init_git(q)\
12431243
%{__git} init %{-q}\
1244+
1245+
%__scm_configure_git\
12441246
%{__git} config user.name "%{__scm_username}"\
1245-
%{__git} config user.email "%{__scm_usermail}"\
1246-
%{__git} config gc.auto 0\
1247+
%{__git} config user.email "%{__scm_usermail}"
1248+
1249+
%__scm_configure_git_common\
1250+
%{__git} config gc.auto 0
1251+
1252+
%__scm_import_git(q)\
12471253
%{__git} add --force .\
12481254
GIT_COMMITTER_DATE=%{__scm_source_timestamp} GIT_AUTHOR_DATE=%{__scm_source_timestamp}\\\
12491255
%{__git} commit %{-q} --allow-empty -a\\\
12501256
--author "%{__scm_author}" -m "%{NAME}-%{VERSION} base"\
12511257
%{__git} checkout --track -b rpm-build
12521258

1259+
%__scm_setup_git(q)\
1260+
%{expand:%__scm_init_git %{-q}}\
1261+
%{expand:%__scm_configure_git}\
1262+
%{expand:%__scm_configure_git_common}\
1263+
%{expand:%__scm_import_git %{-q}}
1264+
12531265
%__scm_apply_git(qp:m:)\
12541266
%{__git} apply --index --reject %{-p:-p%{-p*}} -\
12551267
GIT_COMMITTER_DATE=%{__scm_source_timestamp} GIT_AUTHOR_DATE=%{__scm_source_timestamp}\\\
12561268
%{__git} commit %{-q} -m %{-m*} --author "%{__scm_author}"
12571269

12581270
# Git, using "git am" (-m is unused)
1271+
%__scm_configure_git_am %{nil}
1272+
12591273
%__scm_setup_git_am(q)\
1260-
%{expand:%__scm_setup_git %{-q}}
1274+
%{expand:%__scm_init_git %{-q}}\
1275+
%{expand:%__scm_configure_git_am}\
1276+
%{expand:%__scm_configure_git_common}\
1277+
%{expand:%__scm_import_git %{-q}}
12611278

12621279
%__scm_apply_git_am(qp:m:)\
12631280
GIT_COMMITTER_DATE=%{__scm_source_timestamp}\\\

0 commit comments

Comments
 (0)