DIRNAME confusion

#2 · closed · 3 comments

View on GitHub ↗

schmijos

I'm running against this issue: ``` ... Cloning examplerepo into -20250411T1143Z.git error: unknown switch `2' ``` It seems that the issue lies here. ```bash # backup-github.sh:138 local DIRNAME … # backup-github.sh:148 if ! $GHBU_REUSE_REPOS ; then DIRNAME="${DIRNAME}-${TSTAMP}" fi ``` Setting a default `DIRNAME` doesn't fix the problem either as I encounter another error: ``` ... Cloning examplerepo into myprefix-20250411T1155Z.git fatal: destination path 'myprefix-20250411T1155Z.git' already exists and is not an empty directory. ```

Comments

jimklimov

Actually you've missed the preceding 3 lines: ``` if $GHBU_REUSE_REPOS ; then DIRNAME="${GHBU_BACKUP_DIR}/${GHBU_ORG}-${REPOURI}" fi if ! $GHBU_REUSE_REPOS ; then DIRNAME="${DIRNAME}-${TSTAMP}" fi ``` Which does indeed look like an odd combo, not sure what I was thinking then or if a half-made idea got committed and the rest of work lost while switching backing-up computers. Currently I think the first "if" just should not be there, so we're assigning DIRNAME always and only adding a TIMESTAMP if not re-using a previous checkout.

jimklimov

And for your experiment with "setting a default", if you kept `GHBU_REUSE_REPOS=false` (did not override via settings), then it rightly rejected an existing directory.

jimklimov

Posted a fix (hopefully). Also a REPONAME with `.git` extension could have been mis-processed if adding a timestamp. Thanks for the nudge!