All pastes #770983 Raw Edit

Untitled

public text v1 · immutable
·published 2007-11-12 18:59 UTC
rendered paste body
#!/bin/bash

export LAST_TREE=
export LAST_COMMIT=

TREE_ID=$1

echo $#

LOG_FILE=~/rewrite.log

touch $LOG_FILE

if (( $# == 1 ))
then
    LAST_TREE=$TREE_ID
    LAST_COMMIT=git-commit-tree "$@"
    echo "first commit: $LAST_COMMIT tree: $TREE_ID" >> $LOG_FILE
    echo $LAST_COMMIT
elif (( $# > 3 || $# == 2 || $# == 0))
then
    exit 1
else
    if [ $TREE_ID == $LAST_TREE ]
    then
	skip_commit "$@"
	echo "skipped commit... tree: $TREE_ID" >> $LOG_FILE
    else
	LAST_TREE=$TREE_ID
	PARENT=$LAST_COMMIT
	LAST_COMMIT=git-commit-tree "$TREE_ID -p $PARENT"
	echo $LAST_COMMIT
	echo "next commit: $LAST_COMMIT tree: $TREE_ID parent: $PARENT" >> $LOG_FILE
    fi
fi