From de846bbd4aa9102af504d21da9d6a0409bfdcd18 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sun, 2 Jul 2017 20:39:41 -0400 Subject: Avoid making the empty initial commit --- bin/gitify | 14 +++++++++----- 1 file 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"/* . -- cgit v1.2.3-54-g00ecf