🌐 US-Proxy
class="logged-out env-production page-responsive" style="word-wrap: break-word;" >
Skip to content

singleBranch with commitusingapi fails with 'pulling remote branch object not found' #10821

Closed

Description

@mallendem

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

With singleBranch: true and commitusingapi: true on a github scm, the target fails with:

✗ Something went wrong:
	pulling remote branch object not found

It happens on the first run (no working branch yet, no pull request) and on later runs (working branch already exists). The commit has already been created on the remote working branch by then, so an existing pull request keeps being updated while the pipeline is reported as failed.

With singleBranch unset or false the same manifest works.

What I found by reading the code and reproducing:

  • A single-branch clone is configured with only the cloned branch, for example fetch = +refs/heads/main:refs/remotes/origin/main in .git/config.
  • With commitusingapi, Github.Commit() creates the commit through the GitHub API, then calls gitgeneric.Pull(..., singleBranch=true, forceReset=true) on the working branch.
  • go-git's Worktree.PullContext fetches with the remote's configured refspec, so the working branch's new commit is never downloaded. It still resolves the commit hash from the remote's advertised refs and runs a fast-forward check, which fails with object not found because the objects are missing locally.
  • PullOptions.SingleBranch does not change that fetch in go-git v5.19.2.
  • Related: Checkout cannot see an already published working branch in single-branch mode. It creates the local branch from the base branch instead of using the existing one, which a regular clone does through the refs/*:refs/* fetch.

Expected Behavior

singleBranch should only skip fetching unrelated references. The working branch should still be fetched when needed, and the pipeline should succeed like it does without singleBranch.

Steps To Reproduce

  1. Create a GitHub repository with a version.yaml file (version: "0") and this manifest bump.yml:

    name: scratch bump
    scms:
      scratch:
        kind: github
        spec:
          user: '{{ requiredEnv "GITHUB_ACTOR" }}'
          username: '{{ requiredEnv "GITHUB_ACTOR" }}'
          owner: <owner>
          repository: <repo>
          token: '{{ requiredEnv "GITHUB_TOKEN" }}'
          commitusingapi: true
          branch: main
          force: false
          singleBranch: true
    actions:
      default:
        kind: github/pullrequest
        scmid: scratch
        spec:
          automerge: false
          title: 'scratch: bump version'
    sources:
      counter:
        kind: shell
        spec:
          command: date +%s%N
    targets:
      version:
        kind: yaml
        scmid: scratch
        sourceid: counter
        spec:
          file: version.yaml
          key: $.version
  2. Run GITHUB_TOKEN=<token> GITHUB_ACTOR=<user> updatecli apply --config bump.yml.

  3. See pulling remote branch object not found.

  4. Set singleBranch: false, remove /tmp/updatecli (it holds the previous single-branch clone), run again: it succeeds and opens a pull request.

A public repository with this setup: https://github.com/mallendem/updatecli-singlebranch-scratch

Environment

  • OS: Fedora 44 (also seen on GitHub Actions ubuntu-latest)
  • updatecli: v0.121.0 and current main (7516688)

Anything else?

First seen in elastic/elastic-agent#16833, which enabled singleBranch for nightly bump workflows (about 20 minutes of clone time without it) and has been failing since. A fix is in progress: explicitly fetch the working branch in Pull and Checkout when singleBranch is set.

Activity

  1. olblak commented on Oct 12, 2026

    @olblak
    Member

    Thanks for opening the issue and a pullrequest, I'll try to find some time in the coming days to review it

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

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions