git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Forcing GC to always fail

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Nov 27, 2018, 23:47 UTC
Message-ID
<87efb6ytfj.fsf@evledraar.gmail.com>
In-Reply-To
<CAGyf7-F6BiqSa7LOWxvHZPfO+UaohQR78rCgvN9En+1P4du2Nw@mail.gmail.com>
On Tue, Nov 27 2018, Bryan Turner wrote:
Show 29 quoted lines
> Something of an odd question, but is there something I can do in the
> configuration for a repository that forces any "git gc" run in that
> repository to always fail without doing anything? (Ideally I'd like to
> make "git reflog expire" _also_ fail.)
>
> Background: For Bitbucket Server, we have a fairly recurrent issue
> where administrators decide they know how to manage garbage collection
> for our repositories better than we do, so they jump on the server and
> start running things like this:
>
> git reflog expire --expire=now –all
> git gc --prune=now
> git repack -adf --window=200 --depth=200
>
> They then come running to us with their corrupted repository expecting
> and/or hoping that we can fix it (often without proper backups).
>
> Bitbucket Server itself never runs "git gc" (or "git reflog expire").
> We've configured how reflog expiry should be handled, but of course
> that's overridden by explicit command line options like
> "--expire=now". We _do_ run "git pack-refs", "git repack" and "git
> prune" (with various options), so those commands need to continue to
> work.
>
> Is there anything I can set, perhaps some invalid configuration
> option/value, that will make "git gc" (most important) and "git
> reflog" (ideal, but less important) fail when they're run in our
> repositories? Hopefully at that point customers will reach out to us
> for help _before_ they corrupt their repositories.

You could fix this and so many other issues by just hanging up a "Is This Good For The Company?" banner up in Atlassian offices .

But more seriously:
    
    $ stahp='Bryan.Turner.will.hunt.you.down.if.you.manually.run.gc' && git -c gc.pruneExpire=$stahp gc; git -c gc.reflogExpire=$stahp reflog expire
    error: Invalid gc.pruneexpire: 'Bryan.Turner.will.hunt.you.down.if.you.manually.run.gc'
    fatal: unable to parse 'gc.pruneexpire' from command-line config
    error: 'Bryan.Turner.will.hunt.you.down.if.you.manually.run.gc' for 'gc.reflogexpire' is not a valid timestamp
    fatal: unable to parse 'gc.reflogexpire' from command-line config
Previous: Bryan TurnerNext: Bryan Turner
Message 2 of 8 in “Forcing GC to always fail”
  1. Bryan TurnerNov 27, 2018
  2. Ævar Arnfjörð BjarmasonNov 27, 2018
  3. Bryan TurnerNov 28, 2018
  4. Ævar Arnfjörð BjarmasonNov 28, 2018
  5. Elijah NewrenNov 28, 2018
  6. Bryan TurnerNov 28, 2018
  7. Junio C HamanoNov 29, 2018
  8. Bryan TurnerNov 29, 2018

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.