#!/bin/bash
set -e -x

rm -rf test-repo
git init test-repo
cd test-repo
echo foo >foo
git add foo
git commit -m 'subproject'
git branch -m sub

git checkout --orphan master
git rm -rf .
git read-tree --prefix=sub/ sub
tree_id="$(git write-tree)"
obj_path=.git/objects/${tree_id:0:2}/${tree_id:2:38}
stat --format='%n %y' "$obj_path"

sleep 2
git rm -rf .
git read-tree --prefix=sub/ sub
tree_id="$(git write-tree)"
obj_path=.git/objects/${tree_id:0:2}/${tree_id:2:38}
stat --format='%n %y' "$obj_path"
