-
- #
- # create some example data
- #
- cd /tmp
- rm -rf exampledata workspace
-
- mkdir -p /tmp/exampledata/item123
- echo "file1 contents" > /tmp/exampledata/item123/file1
- echo "file2 contents" > /tmp/exampledata/item123/file2
- echo "file3 contents" > /tmp/exampledata/item123/file3
- mkdir -p /tmp/exampledata/item123/foo/bar
- echo "spam" > /tmp/exampledata/item123/foo/bar/eggs
-
- #
- # store that dummy data into a Git repo under /tmp/workspace/.db
- #
- rm -rf /tmp/workspace && mkdir /tmp/workspace
- git --git-dir=/tmp/workspace/.db init
- git --git-dir=/tmp/workspace/.db --work-tree=/tmp/exampledata/item123 add .
- tree_sha=`git --git-dir=/tmp/workspace/.db --work-tree=/tmp/exampledata/item123 write-tree`
- commit_sha=`git --git-dir=/tmp/workspace/.db commit-tree -m "initial storing of item123" $tree_sha`
- git --git-dir=/tmp/workspace/.db update-ref refs/heads/item123 $commit_sha
-
- #
- # check out a copy of the data we just started tracking
- #
- mkdir -p /tmp/workspace/iii
- git --git-dir=/tmp/workspace/.db --work-tree=/tmp/workspace/iii checkout item123 .
-
- #
- # The contents of /tmp/workspace/iii is now exactly the same as /tmp/exampledata/item123
- # It has been put in and retreives from a Git repo under /tmp/workspace/.db
- #
-
- #
- # make a change
- #
- echo "hello" >> /tmp/workspace/iii/world
-
-
- # how do I show differences between the contents of /tmp/workspace/iii and
- # the tree pointed to by the item123 commit?
-