File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ services:
66 volumes :
77 - ..:/workspaces/oracle-enhanced:cached
88 - ./tzdata:/opt/tzdata:ro
9+ - ${GIT_COMMON_DIR}:${GIT_COMMON_DIR}:cached
910 command : sleep infinity
1011 network_mode : service:oracle
1112
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ set -euo pipefail
44
55IMAGE=gvenzl/oracle-free:latest
66SCRIPT_DIR=$( cd " $( dirname " $0 " ) " && pwd)
7+ WORKSPACE_DIR=$( cd " $SCRIPT_DIR /.." && pwd)
78OUT_DIR=" $SCRIPT_DIR /tzdata"
89
910docker pull " $IMAGE "
@@ -17,3 +18,16 @@ docker run --rm --entrypoint sh \
1718 -c ' cp "$ORACLE_HOME"/oracore/zoneinfo/timezlrg_*.dat /out/ && chmod a+r /out/*.dat'
1819
1920ls -1 " $OUT_DIR "
21+
22+ # When opened from a git worktree, .git is a file whose `gitdir:` line points
23+ # at the main repo's .git/worktrees/<branch>. That host path is not visible
24+ # inside the dev container by default, so git commands inside the container
25+ # fail with "fatal: not a git repository". Resolve the common git dir on the
26+ # host and write it to .devcontainer/.env; docker-compose.yml bind-mounts it
27+ # at the same path inside the container so the gitdir reference resolves.
28+ GIT_COMMON_DIR=$( git -C " $WORKSPACE_DIR " rev-parse --git-common-dir)
29+ case " $GIT_COMMON_DIR " in
30+ /* ) ;;
31+ * ) GIT_COMMON_DIR=$( cd " $WORKSPACE_DIR /$GIT_COMMON_DIR " && pwd) ;;
32+ esac
33+ printf ' GIT_COMMON_DIR=%s\n' " $GIT_COMMON_DIR " > " $SCRIPT_DIR /.env"
Original file line number Diff line number Diff line change @@ -15,3 +15,4 @@ ojdbc*.jar
1515.byebug_history
1616debug.log
1717.devcontainer /tzdata /
18+ .devcontainer /.env
You can’t perform that action at this time.
0 commit comments