summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichal Domonkos <mdomonko@redhat.com>2022-08-18 13:56:58 +0200
committerPanu Matilainen <pmatilai@redhat.com>2022-09-01 16:21:48 +0300
commitc05b95b865cf2c981898846ee8269f2a8a0cfe66 (patch)
tree6b11b15d06b6af52d126c49e819fdfdcf9eb6e8f
parent5bef402da334595ed9302b8bca1acdf5e88bfe11 (diff)
downloadrpm-c05b95b865cf2c981898846ee8269f2a8a0cfe66.tar.gz
Fix upstream branch setting in "%autosetup -S git"
If the repo is already initialized when calling this macro and it's using a different branch name than "master" (see #2121) or the global git option init.defaultBranch is set differently (see #2120), the macro will fail at: %{__git} branch --set-upstream-to=master Instead of being overly clever, just track the original (start-point) branch by using --track when branching (see git-branch(1) for details). For brevity, combine this and branch creation into a single checkout command. This fixes commit 3a6b1d8fbf846d3f1b139d343fdfddebe99ae42b. Thanks Panu for the clarification and suggestion in #854! (cherry picked from commit 1f5ae2a6dd710de4a278087471bf0909ff9f6739)
-rw-r--r--macros.in4
1 files changed, 1 insertions, 3 deletions
diff --git a/macros.in b/macros.in
index d53ab5ed5..827e9a473 100644
--- a/macros.in
+++ b/macros.in
@@ -1164,9 +1164,7 @@ package or when debugging this package.\
%{__git} add --force .\
%{__git} commit %{-q} --allow-empty -a\\\
--author "%{__scm_author}" -m "%{NAME}-%{VERSION} base"\
-%{__git} branch rpm-build \
-%{__git} checkout rpm-build \
-%{__git} branch --set-upstream-to=master
+%{__git} checkout --track -b rpm-build
%__scm_apply_git(qp:m:)\
%{__git} apply --index --reject %{-p:-p%{-p*}} -\