Skip to content

Commit fa3281e

Browse files
committed
Copy over .git folder to make both pre-commit and git describe work
git describe needed to build the VitePress documentation. Ideally we would only include a shallow copy in the Debian package and the gisnav container but currently we copy over the entire .git folder
1 parent 12fa60d commit fa3281e

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

debian/gisnav/Makefile

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,15 @@ $(BUILD_DIR)/etc/systemd:
7878
@mkdir -p $@
7979
@cp -r etc/systemd/ $@
8080

81+
# We need to copy .git to make git describe work for the docs (docs are built
82+
# with git version string). pre-commit might also need the .git folder.
83+
# TODO: only copy over a shallow copy of git repo - we do not need entire history
84+
# nor all branches
8185
$(BUILD_DIR)/etc/gisnav: $(BUILD_DIR)/etc/gisnav/ros $(BUILD_DIR)/etc/gisnav/docker $(BUILD_DIR)/etc/gisnav/docs
8286
@dest=debian/gisnav/$@ && \
8387
mkdir -p $@ && \
8488
touch $(BUILD_DIR)/COLCON_IGNORE && \
85-
cd ${REPO_ROOT_PATH}; rsync -av --exclude-from='.gitignore' Makefile .pre-commit-config.yaml LICENSE.md README.md pyproject.toml $$dest
89+
cd ${REPO_ROOT_PATH}; rsync -av --exclude-from='.gitignore' Makefile .pre-commit-config.yaml LICENSE.md README.md pyproject.toml .git $$dest
8690

8791
$(BUILD_DIR)/etc/gisnav/ros:
8892
@dest=debian/gisnav/$@ && \
@@ -97,8 +101,8 @@ $(BUILD_DIR)/etc/gisnav/docker:
97101
cd ${REPO_ROOT_PATH}; rsync -av --exclude-from='.gitignore' docker/ $$dest
98102
@echo -e "\033[1;33;40mWarning! Check the file list above that no unintended files were copied over to the distributable.\033[0m"
99103

100-
# TODO package.json needed for gisnav image build to go through - try to
101-
# refactor it out (need better defined gisnav image)
102104
$(BUILD_DIR)/etc/gisnav/docs:
103-
@mkdir -p $@/vitepress
104-
@echo "{}" > $@/vitepress/package.json
105+
@dest=debian/gisnav/$@ && \
106+
mkdir -p $@ && \
107+
touch $(BUILD_DIR)/COLCON_IGNORE && \
108+
cd ${REPO_ROOT_PATH}; rsync -av --exclude-from='.gitignore' docs/ $$dest

docker/mavros/Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,9 @@ RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | b
129129

130130
COPY Makefile .pre-commit-config.yaml LICENSE.md README.md pyproject.toml /opt/colcon_ws/src/gisnav/
131131

132-
# .git needed to make pre-commit work -> initialize a blank repo
133-
RUN git init
132+
# .git needed to make pre-commit and git describe work
133+
# TODO: solve this in a better way - we have an unnecessarily large git
134+
# history in the container
135+
COPY .git /opt/colcon_ws/src/gisnav/.git
134136

135137
ENTRYPOINT ["/entrypoint.sh"]

0 commit comments

Comments
 (0)