#!/bin/sh
# Initialises a new local Git repo for test purpose if one does not exist already
if ! git rev-parse --is-inside-work-tree >/dev/null 2>&1; then
    {
        git init
        git config user.name "$(printf %s 'Test Git,\nfor test purpose')"
        git config user.email "TestGit\o/@example.org"

        printf 'test-git\n========\n' > README.md
        git add README.md
        git commit -m 'added readme (o\w/o)' -m 'in markdown, no \r\n, only \n' -m 'a very "simple" readme'
        testChars="$(printf 'tab [%b] form feed [%b] line feed [%b] carriage return [%b]' '\x09' '\x0C' '\x0A' '\x0D')"
        git notes add -m 'Some notes' -m 'out of ascii: été au cœur' -m "$testChars"
        git log
    } >/dev/null 2>&1
fi
