Skip to content

fetch, reflogs, and bare repositories

Jeff King git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2fetch: load all default config at startupbuiltin/fetch.c t/t5516-fetch-push.sh+41 -10 replies
2/2ignore stale directories when checking reflog existencerefs.c t/t1410-reflog.sh+36 -20 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] fetch, reflogs, and bare repositories

I ran into a rather confusing case of fetching into a bare repository with reflogs turned on:

    # make a repo with a two-component branch name
    git init -q &&
    git commit -q --allow-empty -m one &&
    git branch foo/bar &&
    # now fetch it all into a bare repo with reflogs
    git init -q --bare parent.git &&
    cd parent.git &&
    git config core.logallrefupdates true &&
    git fetch --prune .. +refs/*:refs/* &&
    # now replace the branch with one that has a d/f conflict
    cd .. &&
    git branch -d foo/bar &&
    git branch foo &&
    # and fetch again
    cd parent.git &&
    git fetch --prune .. +refs/*:refs/*

The final fetch fails and produces this output:

    From ..
     x [deleted]         (none)     -> foo/bar
    error: Unable to append to ./logs/refs/heads/foo: Is a directory
     ! [new branch]      foo        -> foo  (unable to update local ref)

This turns out to be caused by two subtle bugs: one that makes "git fetch" use reflogs inconsistently, and the other that causes some ref updates to fail when reflogs are turned on and off. Details are in the fixes themselves.

[1/2]: fetch: load all default config at startup [2/2]: ignore stale directories when checking reflog existence

-Peff