#!/bin/sh # suck in a pile of files, commit based on timestamp, # set author : ${AUTHOR:="Unknown <>"} base="$1" test -d "$base/.git" || git init "$base" cd $base set -x prevts= find . -name .git -prune -o -type f -printf '%T@ %P\n' | sort -n | while read ts fn; do if [ -n "$prevts" ] && [ "$prevts" != "$ts" ]; then git commit --date="$prevts" --author="$AUTHOR" -m 'auto commit for import' printf '\n' "$ts" fi git add "$fn" printf '%s\n' "$fn" prevts="$ts" done find . -name .git -prune -o -type f -printf '%T@ %P\n' | sort -n | tail -1 | while read ts fn; do git commit --date="$ts" --author="$AUTHOR" -m 'auto commit for import' done