pkgsrc-WIP-changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

mk/ Improve check if update of Git archive is necessary

Module Name:	pkgsrc-wip
Committed By:	Mateusz Poszwa <>
Pushed By:	f8l
Date:		Sat Mar 12 23:43:56 2022 +0000
Changeset:	ded1d8936bc29e0b133a55c40283c8bd29d47e86

Modified Files:

Log Message:
mk/ Improve check if update of Git archive is necessary

Git archives are supposed to be updated when update of Git working
area causes a change in ref related to the desired revision.
To achieve this, refs before and after update are compared.

Unfortunately the refs related to HEAD were probed around checkout
step, which caused the comparison to always result in a match.

This change moves the probes around fetch step which
actually updates the refs, and makes them check
the desired revision instead of hardcoded HEAD.

To see a diff of this commit:;a=commitdiff;h=ded1d8936bc29e0b133a55c40283c8bd29d47e86

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

 mk/ | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/mk/ b/mk/
index a1bc778ac6..5e4c1e2701 100644
--- a/mk/
+++ b/mk/
@@ -189,10 +189,12 @@ _GIT_CMD.checkout.${repo}= \
 	  remote set-branches origin '*';				\
 	${STEP_MSG} "Updating Git working area $$extractdir.";		\
+	revision=${_GIT_REV.${repo}:Q};					\
+	rev_before=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" show-ref "$$revision"`; \
 	${_GIT_CMDLINE.${repo}} -C "$$extractdir"			\
 	  fetch ${_GIT_FETCH_FLAGS.${repo}};				\
+	rev_after=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" show-ref "$$revision"`; \
-	revision=${_GIT_REV.${repo}:Q};					\
 	checkout_date=${CHECKOUT_DATE:Q};				\
 	if [ "$$checkout_date" ]; then					\
 	  ${STEP_MSG} "Checking out $$revision at $$checkout_date.";	\
@@ -202,10 +204,8 @@ _GIT_CMD.checkout.${repo}= \
 	    checkout ${_GIT_CHECKOUT_FLAGS} "$$ref";			\
 	else								\
 	  ${STEP_MSG} "Checking out $$revision.";			\
-	  rev_before=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" show-ref HEAD`; \
 	  ${_GIT_CMDLINE.${repo}} -C "$$extractdir"			\
 	    checkout ${_GIT_CHECKOUT_FLAGS} "$$revision";		\
-	  rev_after=`${_GIT_CMDLINE.${repo}} -C "$$extractdir" show-ref HEAD`; \
 	fi;								\
 	${STEP_MSG} "Updating submodules of $$extractdir.";		\

Home | Main Index | Thread Index | Old Index