Skip to content

Instantly share code, notes, and snippets.

View mhagger's full-sized avatar

Michael Haggerty mhagger

View GitHub Profile
#! /bin/sh
USAGE="git test-range [--test=NAME] OPTS RANGE [-- [COMMAND]]..."
LONG_USAGE="Run COMMAND for each commit in the specified RANGE in reverse order,
stopping if the command fails. The return code is that of the last
command executed (i.e., 0 only if the command succeeded for every
commit in the range).
Options:
#! /bin/sh
# Display remote branches whose tips were authored by you, in order
# from oldest to youngest. List branches in the specified remote, or
# the default remote if no argument is provided.
usage() {
echo "usage: $0 [--format=FORMAT] [REMOTE]"
}
@mhagger
mhagger / gunk-up-test-repo
Created January 14, 2016 12:52
Aid to reproducing libgit2 issue
#! /bin/sh
set -e
usage() {
echo "usage: $0 (--one-level | --two-level | with-ref) <git-dir> <count>"
}
make_one_level() {
base="$1"
@mhagger
mhagger / seconds.csv
Last active December 8, 2015 18:11 — forked from jonmagic/seconds.csv
This is binary data captured from a car stereo and it's companion cd changer. The stereo updates it's screen with the cd track minutes and "seconds". Each row below corresponds to the "seconds". Column 1 is the seconds, 2 is binary, 3 is 2 inverted. The goal is figuring out how to generate the seconds from 0's & 1's without the table below.
seconds message inverted-message
4 110 001
5 00101 11010
6 10100 01011
7 01100 10011
8 11101 00010
9 00011 11100
10 10010 01101
11 0000101 1111010
12 1000100 0111011
O = 2
CFLAGS = -g -O$(O) -Wall -Wdeclaration-after-statement -Wno-format-zero-length -Wno-format-security -Werror -Wold-style-definition -Wold-style-declaration -Wno-pointer-to-int-cast -Wpointer-arith -Woverflow -Wunused -Wstrict-prototypes -Wformat-security -Wvla $(EXTRA_CFLAGS) $(LOCAL_CFLAGS)
NO_SVN_TESTS = 1
COMPUTE_HEADER_DEPENDENCIES = yes
# /var/tmp is a ramdisk on my computer:
TMP := /var/tmp
ROOT := $(TMP)/git-tests-$(shell git rev-parse --show-toplevel | sha1sum | head -c10)
GIT_TEST_OPTS = -q --root=$(ROOT) --tee
GIT_PROVE_OPTS = --timer --jobs 16 --state=fresh,hot,slow,save
@mhagger
mhagger / README.md
Created June 15, 2014 18:51
Tools for repository repair

Ideas for git-fix project

We would like to have a way to fix up repositories' history; e.g., to remove corruption that may have happened some time in the past.

The standard tool for mass-rewriting of Git history is git filter-branch. But it is awkward to use and has a number of limitations:

  • It is a shell script, and correspondingly slow
  • It cannot deal with some kinds of corruption, because it tries to check out all historical revisions into the index and/or working tree
  • It can make "grafts" and "replace references" permanent, but only at the commit level. It cannot make "replace references" for trees or blobs permanent.