Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-02-23 20:37:29 +0300
committerÆvar Arnfjörð Bjarmason <avarab@gmail.com>2021-02-23 20:56:09 +0300
commit29b7128d6bfea6f5357c2bd30d40a1aa26fd7d8f (patch)
tree96f487b2a557c92f9b01037eaf1928235b50fa56
parent8c3a416f8fbd8e1187e8d7869bd77f933e91be1b (diff)
Makefile: start fixing regression in c75c02f52avar/fix-mr-3151-regressions
Start fixing the regressions in c75c02f52 (Makefile: Do not re-clone repos when rebuilding git/libgit2, 2021-02-17) noted in [A]. What I said in that comment: This breaks e.g. upgrading from v2.29.0 to v2.29.1. There's multiple bugs here: 1. The clone is --depth=1, but not the fetch, so if you need to bump a version we switch to a full clone 2. You do e.g. "git fetch v2.29.1", but this does not create a refs/tags/v2.29.1 locally, we just put it into FETCH_HEAD, this is unlike the clone --branch option. Thus upgrading a version will fetch it successfully, but then we die on the "switch". 3. You're doing rev-parse --verify <thing>^{tree}. Presumably to not pass a full SHA-1, why not just cat-file -t <thing>? I tried fixing #1 (closed) by instead doing --no-tags <obj>:<obj> but that fails with trying to write a tag into refs/heads/. As an aside I think that's a bug in git's fetching logic, it should pick refs/tags/* as the local namespace in that case. Then writing everything into refs/tags/*. But now e.g. if you specify some SHA-1 it's just happenstance whether it works, did we slurp it down in the initial clone? This starts to fix at least some of that. Now if we see a new version we're going to create a refs/tags/* name for it (even if it's e.g. "master"). The --no-tags option is needed because that option really doesn't mean "no tags", it means "don't do tag following". Without it the "--depth 1" is pretty pointless. This is still going to be buggy in the case where you specify e.g. "master" but that ref has moved. A. https://gitlab.com/gitlab-org/gitaly/-/merge_requests/3151/diffs?commit_id=c75c02f52decfb1f89e30e15420d29207ccfa3ca#note_515460714
-rw-r--r--Makefile12
1 files changed, 7 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 62a2e6e75..bccb380d8 100644
--- a/Makefile
+++ b/Makefile
@@ -408,8 +408,9 @@ ${DEPENDENCY_DIR}/git.version: dependency-version | ${DEPENDENCY_DIR}
${LIBGIT2_INSTALL_DIR}/lib/libgit2.a: ${DEPENDENCY_DIR}/libgit2.version
${Q}if ! [ -d "${LIBGIT2_SOURCE_DIR}" ]; then \
${GIT} clone --depth 1 --branch ${LIBGIT2_VERSION} --quiet ${LIBGIT2_REPO_URL} ${LIBGIT2_SOURCE_DIR}; \
- elif ! git -C "${LIBGIT2_SOURCE_DIR}" rev-parse --quiet --verify ${LIBGIT2_VERSION}^{tree} >/dev/null; then \
- ${GIT} -C "${LIBGIT2_SOURCE_DIR}" fetch --quiet ${LIBGIT2_REPO_URL} ${LIBGIT2_VERSION}; \
+ fi
+ ${Q}if ! git -C "${LIBGIT2_SOURCE_DIR}" cat-file -t ${LIBGIT2_VERSION} 2>/dev/null; then \
+ ${GIT} -C "${LIBGIT2_SOURCE_DIR}" fetch --depth 1 --no-tags --quiet ${LIBGIT2_REPO_URL} ${LIBGIT2_VERSION}:refs/tags/${LIBGIT2_VERSION}; \
fi
${Q}rm -rf ${LIBGIT2_BUILD_DIR}
${Q}mkdir -p ${LIBGIT2_BUILD_DIR}
@@ -421,10 +422,11 @@ ifeq (${GIT_USE_PREBUILT_BINARIES},)
${GIT_INSTALL_DIR}/bin/git: ${DEPENDENCY_DIR}/git.version
${Q}if ! [ -d "${GIT_SOURCE_DIR}" ]; then \
${GIT} clone --depth 1 --branch ${GIT_VERSION} --quiet ${GIT_REPO_URL} ${GIT_SOURCE_DIR}; \
- elif ! git -C "${GIT_SOURCE_DIR}" rev-parse --quiet --verify ${GIT_VERSION}^{tree} >/dev/null; then \
- ${GIT} -C "${GIT_SOURCE_DIR}" fetch --quiet ${GIT_REPO_URL} ${GIT_VERSION}; \
fi
- ${Q}${GIT} -C "${GIT_SOURCE_DIR}" switch --quiet --detach ${GIT_VERSION}
+ ${Q}if ! git -C "${GIT_SOURCE_DIR}" cat-file -t ${GIT_VERSION} 2>/dev/null; then \
+ ${GIT} -C "${GIT_SOURCE_DIR}" fetch --depth 1 --no-tags --quiet ${GIT_REPO_URL} ${GIT_VERSION}:refs/tags/${GIT_VERSION}; \
+ fi
+ ${Q}${GIT} -C "${GIT_SOURCE_DIR}" -c advice.detachedHead=false switch --quiet --detach ${GIT_VERSION}
${Q}rm -rf ${GIT_INSTALL_DIR}
${Q}mkdir -p ${GIT_INSTALL_DIR}
env -u MAKEFLAGS -u GIT_VERSION ${MAKE} -C ${GIT_SOURCE_DIR} -j$(shell nproc) prefix=${GIT_PREFIX} ${GIT_BUILD_OPTIONS} install