diff options
author | Luke Shumaker <lukeshu@lukeshu.com> | 2017-07-02 20:39:41 -0400 |
---|---|---|
committer | Luke Shumaker <lukeshu@lukeshu.com> | 2017-07-02 20:39:41 -0400 |
commit | de846bbd4aa9102af504d21da9d6a0409bfdcd18 (patch) | |
tree | 195c0be6f186b4c63f400c0bc280d3e8ef33eb65 | |
parent | 93b69f118eebb3e623c89c51a0639b522ac0d3e0 (diff) |
Avoid making the empty initial commit
-rwxr-xr-x | bin/gitify | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -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"/* . |