summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2017-07-02 20:39:41 -0400
committerLuke Shumaker <lukeshu@lukeshu.com>2017-07-02 20:39:41 -0400
commitde846bbd4aa9102af504d21da9d6a0409bfdcd18 (patch)
tree195c0be6f186b4c63f400c0bc280d3e8ef33eb65
parent93b69f118eebb3e623c89c51a0639b522ac0d3e0 (diff)
Avoid making the empty initial commit
-rwxr-xr-xbin/gitify14
1 files changed, 9 insertions, 5 deletions
diff --git a/bin/gitify b/bin/gitify
index d8ce9b0..2c73bcd 100755
--- a/bin/gitify
+++ b/bin/gitify
@@ -32,8 +32,7 @@ main() {
cd "$1"
git init
echo 'ref: refs/heads/PROGRAMS/CVTUTF' > .git/HEAD
- lastbranch=PROGRAMS/CVTUTF
- git commit --allow-empty -m 'initial commit'
+ lastbranch=''
for snapshot in "$top"/dat/pools/snaps/*; do
snapname="${snapshot##*/}"
@@ -43,9 +42,14 @@ main() {
branch=$dirpart
newbranch=true
- git checkout "$lastbranch"
- git checkout -b "$branch" || newbranch=false
- git checkout "$branch"
+ if [[ -n "$lastbranch" ]]; then
+ git checkout "$lastbranch"
+ if [[ "$branch" == *.OLD ]]; then
+ git checkout HEAD^
+ fi
+ git checkout -b "$branch" || newbranch=false
+ git checkout "$branch"
+ fi
rm -f -- * .metadata.txt
cp -- "$snapshot"/* .