Re: [dev] [suckless] Migration to git

From: Sam Watkins <sam_AT_nipl.net>
Date: Thu, 14 Feb 2013 13:01:03 +1100

> I've been working with git lately, trying to do some unusual things,
> and I need to say this is one of the least suckless pieces of software
> I've ever worked with. It's complex, obscure, inconsistent, quirky...

> tell what you did

Ok, here is one day in the life of messing about with git.


Let's say you wanted to get rid of all history from a repo, just keep
the current commit. Git lets us rewrite history, so this should be
easy, right? Wrong. I won't tell you how long it took to find this
weird technique:

        #!/bin/sh -e
        new_root_hash=`git rev-parse HEAD`
        echo "$new_root_hash" >.git/info/grafts
        git filter-branch -f
        rm .git/info/grafts

At least it runs quickly.


Let's say you want to garbage collect your repo after getting rid of
that unwanted history...

        git gc

whoops, it does not work.

final hacky 'solution' (after quite some research and experiment):

        #!/bin/sh -ev
        git remote rm origin || true
        git for-each-ref --format="%(refname)" refs/original/ | xargs -n1 --no-run-if-empty git update-ref -d
        (
        cd .git
        rm -rf refs/remotes/ refs/original/ *_HEAD logs/
        )
        git -c gc.reflogExpire=0 -c gc.reflogExpireUnreachable=0 -c gc.rerereresolved=0 -c gc.rerereunresolved=0 -c gc.pruneExpire=now gc "$_AT_"


But ordinary things are famously weird in git, also.
Received on Thu Feb 14 2013 - 03:01:03 CET

This archive was generated by hypermail 2.3.0 : Thu Feb 21 2013 - 19:21:08 CET