Skip to content

Slow performance during tag updates with git-branchless #1543

@Kimeiga

Description

@Kimeiga

Description of the bug

When running git fetch in a repository with git-branchless enabled, the operation takes an excessively long time when processing a large number of tag updates. The issue appears to be related to how git-branchless processes tag updates sequentially, with each tag being processed individually rather than in batches.

For each tag update, the following output is displayed:

branchless: processing 1 update: ref refs/tags/[tag-name]
 * [new tag]                 [tag-name]                                      -> [tag-name]

This pattern repeats for every single tag being fetched (potentially hundreds of tags), leading to significant performance degradation.

Steps to reproduce:

  1. Set up a repository with git-branchless (git branchless init)
  2. Configure a remote with many tags (100+)
  3. Run git fetch
  4. Observe the slow processing of each tag individually with timestamps showing several minutes elapsing

Expected behavior

Git fetch with git-branchless should process tag updates more efficiently, either by:

  1. Batching tag updates together for processing instead of handling each one individually
  2. Optimizing the processing of individual tags to be faster
  3. Providing a configuration option to ignore or batch-process tag updates

The operation should complete in a time comparable to standard git fetch without git-branchless enabled (seconds rather than minutes).

Actual behavior

A simple git fetch operation that should complete in seconds takes several minutes (observed time: approximately 5 minutes based on terminal timestamps). Each tag update is processed individually with verbose output for every single tag.

In a repository with hundreds of tags (particularly in a monorepo with versioned component packages), this creates significant performance overhead. The terminal shows timestamps indicating that the fetch operation is taking much longer than expected (⇣ 4m 59s in the command prompt).

After fetch completes, git status shows the branch is behind by hundreds of commits, suggesting this is a common scenario in repositories with active development and many tags.

Version of rustc

rustc 1.78.0 (9b00956e5 2024-04-29)

Automated bug report

Software version

git-branchless 0.10.0

Operating system

macOS 15.4.1 (Darwin 24.4.0)

Command-line

/Users/hakan.alpay/.cargo/bin/git-branchless bug-report 

Environment variables

SHELL=/bin/zsh
EDITOR=nvim

Git version

> git version 
git version 2.48.1

Hooks

Hooks directory: /Users/hakan.alpay/Projects/web-next-2/.git/hooks

Show 7 hooks
Hook post-applypatch
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-applypatch "$@"

## END BRANCHLESS CONFIG
Hook post-checkout
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-checkout "$@"

## END BRANCHLESS CONFIG
Hook post-commit
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-commit "$@"

## END BRANCHLESS CONFIG
Hook post-merge
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-merge "$@"

## END BRANCHLESS CONFIG
Hook post-rewrite
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook post-rewrite "$@"

## END BRANCHLESS CONFIG
Hook pre-auto-gc
#!/bin/sh
## START BRANCHLESS CONFIG

git branchless hook pre-auto-gc "$@"

## END BRANCHLESS CONFIG
Hook reference-transaction
#!/bin/sh
## START BRANCHLESS CONFIG

# Avoid canceling the reference transaction in the case that `branchless` fails
# for whatever reason.
git branchless hook reference-transaction "$@" || (
echo 'branchless: Failed to process reference transaction!'
echo 'branchless: Some events (e.g. branch updates) may have been lost.'
echo 'branchless: This is a bug. Please report it.'
)

## END BRANCHLESS CONFIG

Events

Show 5 events
Event ID: 78949, transaction ID: 61846 (message: post-merge)
  1. CommitEvent { timestamp: 1745875674.0, event_tx_id: Id(61846), commit_oid: NonZeroOid(b132e74c63dfeb7c6e539d06e46e46ac142ffb66) }
:
@ b132e74 16m (> master) xxxxxx xxx xxxxxxxx xx xxxxx xxxxxxxx
Event ID: 78948, transaction ID: 61845 (message: reference-transaction)
  1. RefUpdateEvent { timestamp: 1745875729.064352, event_tx_id: Id(61845), ref_name: ReferenceName("refs/heads/master"), old_oid: 244b3efdfc16de29c6a0ab58f81c0a658d188d32, new_oid: b132e74c63dfeb7c6e539d06e46e46ac142ffb66, message: None }
:
@ b132e74 16m (> master) xxxxxx xxx xxxxxxxx xx xxxxx xxxxxxxx
Event ID: 78947, transaction ID: 61843 (message: reference-transaction)
  1. RefUpdateEvent { timestamp: 1745875724.979132, event_tx_id: Id(61843), ref_name: ReferenceName("redacted-ref-0"), old_oid: 0000000000000000000000000000000000000000, new_oid: 7bbf9849c56dcd8eacacf55228319ec7ab79018e, message: None }
:
@ b132e74 16m (> master) xxxxxx xxx xxxxxxxx xx xxxxx xxxxxxxx
Event ID: 78946, transaction ID: 61842 (message: reference-transaction)
  1. RefUpdateEvent { timestamp: 1745875724.824497, event_tx_id: Id(61842), ref_name: ReferenceName("redacted-ref-1"), old_oid: 0000000000000000000000000000000000000000, new_oid: 54d74b6bfba0c094fa52704f2d4abad66bd7e8a4, message: None }
:
@ b132e74 16m (> master) xxxxxx xxx xxxxxxxx xx xxxxx xxxxxxxx
Event ID: 78945, transaction ID: 61841 (message: reference-transaction)
  1. RefUpdateEvent { timestamp: 1745875724.661364, event_tx_id: Id(61841), ref_name: ReferenceName("redacted-ref-2"), old_oid: 0000000000000000000000000000000000000000, new_oid: 7bbf9849c56dcd8eacacf55228319ec7ab79018e, message: None }
:
@ b132e74 16m (> master) xxxxxx xxx xxxxxxxx xx xxxxx xxxxxxxx

Version of git-branchless

git-branchless-opts 0.10.0

Version of git

git version 2.48.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions