#!/bin/sh

GIT=$PWD/git
#GIT=git

mkbranch () {
    branch=$1
    "$GIT" branch "$branch" master
    "$GIT" checkout "$branch"
    echo "$branch" > "$branch"
    "$GIT" add "$branch"
    "$GIT" commit -m "$branch"
}

rm -rf log-format-test
mkdir log-format-test
cd log-format-test


"$GIT" init
echo 0 > foo
"$GIT" add foo
"$GIT" commit -m 0

mkbranch a
mkbranch b

"$GIT" checkout master
echo 1 > foo
"$GIT" commit -am 1

# The name of this branch affects the outcome
# e.g. calling it "x" doesn't trip the bug (!)
mkbranch c

"$GIT" branch m master
"$GIT" checkout m
"$GIT" merge -m 'merge a b' a b

valgrind "$GIT" log --oneline --graph --color=never --all
