From 15e318f81795799c055c28870a402ead7dcd0339 Mon Sep 17 00:00:00 2001
From: Wouter Deconinck <wdconinc@gmail.com>
Date: Tue, 31 Oct 2023 06:42:57 +0000
Subject: [PATCH] feat: merge topo sorted cherry-picks

---
 containers/jug/dev.Dockerfile | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/containers/jug/dev.Dockerfile b/containers/jug/dev.Dockerfile
index 91bcf51b5..754723476 100644
--- a/containers/jug/dev.Dockerfile
+++ b/containers/jug/dev.Dockerfile
@@ -31,6 +31,12 @@ ADD https://api.github.com/repos/${SPACK_ORGREPO}/commits/${SPACK_VERSION} /tmp/
 RUN git clone --filter=tree:0 https://github.com/${SPACK_ORGREPO}.git ${SPACK_ROOT}     \
  && git -C ${SPACK_ROOT} checkout ${SPACK_VERSION}                      \
  && if [ -n "${SPACK_CHERRYPICKS}" ] ; then                             \
+      SPACK_CHERRYPICKS=$(                                              \
+        git -C ${SPACK_ROOT} rev-list --topo-order ${SPACK_CHERRYPICKS} \
+        | grep -m $(echo ${SPACK_CHERRYPICKS} | wc -w)                  \
+               "${SPACK_CHERRYPICKS}"                                   \
+        | tac                                                           \
+      ) ;                                                               \
       git -C ${SPACK_ROOT} cherry-pick -n ${SPACK_CHERRYPICKS} ;        \
     fi                                                                  \
  && ln -s $SPACK_ROOT/share/spack/docker/entrypoint.bash                \
-- 
GitLab