buildroot.busybox.net archive mirror
 help / color / mirror / Atom feed
* [Buildroot] [git commit branch/2023.02.x] utils/docker-run: fix running when CWD is not MAIN_DIR
@ 2023-08-30 22:30 Peter Korsgaard
  0 siblings, 0 replies; only message in thread
From: Peter Korsgaard @ 2023-08-30 22:30 UTC (permalink / raw)
  To: buildroot

commit: https://git.buildroot.net/buildroot/commit/?id=d97346f1ceb2f86d0b26fb72cf18647a074bb639
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/2023.02.x

Commit 90790790925c (utils/docker-run: fix support for git-worktrees)
got last-minute changes when it was applied, and the case when the
current working directory is not the top of the current working copy
got broken.

Fix that by duplicating (and thus reinstating) the 'cd MAIN_DIR' to
match what is done when retrieving the git-common-dir.

Fixes: 90790790925c

Reported-by: Brandon Maier <Brandon.Maier@collins.com>
Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
(cherry picked from commit 5b559109eeeec19e6e33c82712690aec89dcb562)
Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 utils/docker-run | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/utils/docker-run b/utils/docker-run
index b201d28289..ab95e61e84 100755
--- a/utils/docker-run
+++ b/utils/docker-run
@@ -27,9 +27,10 @@ declare -a docker_opts=(
 # .git directory.
 if [ "${GIT_DIR}" ]; then
     # GIT_DIR in the main working copy (when git supports worktrees) will
-    # be just '.git', but 'docker run' needs an absolute path. If it's an
-    # absolute path already (in a wordir), then that's a noop.
-    GIT_DIR="$(readlink -e "${GIT_DIR}")"
+    # be just '.git', but 'docker run' needs an absolute path. If it is
+    # not absolute, GIT_DIR is relative to MAIN_DIR. If it's an absolute
+    # path already (in a wordir), then that's a noop.
+    GIT_DIR="$(cd "${MAIN_DIR}"; readlink -e "${GIT_DIR}")"
     docker_opts+=( --mount "type=bind,src=${GIT_DIR},dst=${GIT_DIR}" )
 fi
 
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-08-30 22:34 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-08-30 22:30 [Buildroot] [git commit branch/2023.02.x] utils/docker-run: fix running when CWD is not MAIN_DIR Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).