From 29b493454a49bd6d0d53098ba7ba84dc97c77545 Mon Sep 17 00:00:00 2001 From: aszc-dev Date: Mon, 25 May 2026 15:49:07 +0200 Subject: [PATCH] fix(phase4): init ComfyUI in place so a pre-seeded COMFY_DIR works git clone refuses a non-empty target, so a COMFY_DIR pre-seeded with the cached checkpoint (or converted .mlmodelc) would break setup. Replace clone with git init + remote add + fetch + 'checkout -f', which populates the ComfyUI tree without touching untracked files. Setup order is now free. --- .github/workflows/tier2.yml | 17 ++++++++++++----- docs/ci-m2.md | 6 ++++++ 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/tier2.yml b/.github/workflows/tier2.yml index 9b60c01..0950dc7 100644 --- a/.github/workflows/tier2.yml +++ b/.github/workflows/tier2.yml @@ -47,16 +47,23 @@ jobs: run: | set -euo pipefail if [ -z "${COMFY_DIR:-}" ]; then echo "COMFY_DIR unset (see docs/ci-m2.md)"; exit 1; fi + # Init-in-place rather than `git clone`: COMFY_DIR may already hold the + # cached checkpoint (models/checkpoints) or converted .mlmodelc, and + # `git clone` refuses a non-empty target. init + fetch + `checkout -f` + # populates the ComfyUI tree while leaving untracked files (the + # checkpoint, the cached models) untouched — so setup order is free. if [ ! -d "$COMFY_DIR/.git" ]; then - echo "cloning ComfyUI into $COMFY_DIR" - git clone https://github.com/comfyanonymous/ComfyUI.git "$COMFY_DIR" + echo "initialising ComfyUI repo in $COMFY_DIR" + mkdir -p "$COMFY_DIR" + git -C "$COMFY_DIR" init -q fi + git -C "$COMFY_DIR" remote get-url origin >/dev/null 2>&1 \ + || git -C "$COMFY_DIR" remote add origin https://github.com/comfyanonymous/ComfyUI.git git -C "$COMFY_DIR" fetch --quiet origin if [ "$COMFY_MODE" = "latest" ]; then - git -C "$COMFY_DIR" checkout --quiet -B master origin/master - git -C "$COMFY_DIR" reset --hard --quiet origin/master + git -C "$COMFY_DIR" checkout -f -B master origin/master else - git -C "$COMFY_DIR" checkout --quiet --force "$COMFY_REF" + git -C "$COMFY_DIR" checkout -f "$COMFY_REF" fi COMFY_SHA="$(git -C "$COMFY_DIR" rev-parse HEAD)" echo "COMFY_SHA=$COMFY_SHA" >> "$GITHUB_ENV" diff --git a/docs/ci-m2.md b/docs/ci-m2.md index a5aaa81..dee42cc 100644 --- a/docs/ci-m2.md +++ b/docs/ci-m2.md @@ -58,6 +58,12 @@ half of the matrix has to live on real hardware. `Convert UNet variants if missing` step and cached across runs. Override the filename with `CKPT_NAME` in the runner `.env` if needed. + Order is free: do this before or after the first run. The setup step + initialises the ComfyUI repo **in place** (`git init`, not `git clone`, + which would refuse a non-empty directory) and uses `checkout -f`, which + never removes untracked files — so a checkpoint you dropped in first is + preserved. + ## Triggers The Tier 2 workflow (`.github/workflows/tier2.yml`) runs: