Skip to content

drupal-core: setup log is flooded with git branch/tag refs from Drupal core checkout #218

Description

@rfay

When a drupal-core workspace clones Drupal core, /tmp/drupal-setup.log fills with thousands of lines like * [new branch] 8.0.x -> origin/8.0.x and * [new tag] 7.0 -> 7.0, covering 20 years of branches and tags. The useful parts of the log, such as composer output, are then hard to find. This made #217 harder to diagnose: the real error (drupal/core 12.x-dev requires php >=8.5.0 -> your php version (8.4.24) does not satisfy that requirement) is buried in the log.

Where the noise comes from

drupal-core/template.tf (Step 1, bare-cache path, around lines 560–575) runs these commands:

git -C "$DRUPAL_DIR" fetch drupalcache >> "$SETUP_LOG" 2>&1
git -C "$DRUPAL_DIR" fetch origin      >> "$SETUP_LOG" 2>&1 || true
git -C "$DRUPAL_DIR" fetch issue       >> "$SETUP_LOG" 2>&1 || true   # issue-fork mode

project/drupal currently has 44 branches and about 790 tags. The issue fork repo has the same historic branches. Each fetch prints one line per new ref, so one fresh workspace can write well over a thousand ref lines, plus progress output. Some other places do the same thing on a smaller scale: the git fetch --all --prune on restart (around line 646), and the clone/fetch calls in drupal-contrib/template.tf (around lines 426, 438, 545).

Suggestions

Start with the logging changes, and consider a narrower fetch as well:

  • Quiet the fetches. Use git fetch -q / git clone -q, or --no-progress, and log one summary line per step (the code already logs timings), for example ✓ Fetched origin (12s). On failure, keep git's stderr and write it to the log. One way is to capture output into a variable and append it only when the command fails.

  • Fetch only what's needed. A workspace needs main or the chosen DRUPAL_BRANCH, plus the issue branch in issue-fork mode. It doesn't need every historic branch and tag. Some options:

    • git fetch --no-tags origin "$DRUPAL_BRANCH" (keep tags off, or fetch only recent ones if something depends on git describe)
    • git fetch --no-tags issue "$ISSUE_BRANCH" instead of every branch from the fork, which copies all of core's branches
    • set remote.<name>.tagOpt --no-tags and a narrowed fetch refspec, so later git fetch / git pull in the workspace stay quiet too

    Check that the bare cache seed still pays off, and that people who switch branches inside the workspace can still git fetch origin <branch> when they need it.

The goal is a setup log where every line is relevant, so failures like #217 are visible without scrolling past years of refs.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions