Skip to content

Keep .git in the LS_mmseg build context - #27

Open
OleksiiPushkaryk wants to merge 1 commit into
mainfrom
fix-keep-git-repo-in-image
Open

OleksiiPushkaryk wants to merge 1 commit into
mainfrom
fix-keep-git-repo-in-image

Conversation

@OleksiiPushkaryk

Copy link
Copy Markdown

.dockerignore excluded .git, so COPY . /mmsegmentation produced an image with the code but without a git repository. The Label Studio runner switches the training branch inside the already-built container — with WORKDIR /mmsegmentation it runs git branch --set-upstream-to=origin/main main && git pull && git checkout <branch> right before python3 -m auto_training.train — so every training that requested a branch died with "fatal: not a git repository" before training even started. Trainings without a branch kept working (the prelude degrades to a bare echo), which is why this stayed unnoticed since 3645531 (2026-03-24).

Drone clones with git init + git remote add + git fetch --depth=1, which leaves a local main branch and, opportunistically, refs/remotes/origin/main. That is enough for the runner's prelude: git pull then populates the remaining branch refs through the remote's wildcard refspec.

Basic Info

Info Please fill out this column
Platform tested on LabelStudio
Ticket

Description of contribution

Reason for change:

Changes in this PR:

`.dockerignore` excluded `.git`, so `COPY . /mmsegmentation` produced an image
with the code but without a git repository. The Label Studio runner switches the
training branch inside the already-built container — with WORKDIR /mmsegmentation
it runs `git branch --set-upstream-to=origin/main main && git pull && git checkout
<branch>` right before `python3 -m auto_training.train` — so every training that
requested a branch died with "fatal: not a git repository" before training even
started. Trainings without a branch kept working (the prelude degrades to a bare
`echo`), which is why this stayed unnoticed since 3645531 (2026-03-24).

Drone clones with `git init` + `git remote add` + `git fetch --depth=1`, which
leaves a local `main` branch and, opportunistically, `refs/remotes/origin/main`.
That is enough for the runner's prelude: `git pull` then populates the remaining
branch refs through the remote's wildcard refspec.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant