openrails / openrails-code-bot

A command-line tool for automatically updating Open Rail's various code systems.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does not correctly reset git repo in some cases

twpol opened this issue · comments

When the git directory is empty (as seems to happen from time to time) the code tries to reset and fails:

  > git --no-pager clean --force -d -x
  < Refusing to remove current working directory
  ! fatal: ambiguous argument 'master': unknown revision or path not in the working tree.
  ! Use '--' to separate paths from revisions, like this:
  ! 'git <command> [<revision>...] -- [<file>...]'
  ! fatal: ambiguous argument 'unstable': unknown revision or path not in the working tree.
  ! Use '--' to separate paths from revisions, like this:
  ! 'git <command> [<revision>...] -- [<file>...]'
  ! fatal: ambiguous argument 'unstable^{tree}': unknown revision or path not in the working tree.
  ! Use '--' to separate paths from revisions, like this:
  ! 'git <command> [<revision>...] -- [<file>...]'

It should be possible to validate the git directory (and simply delete it if it fails) at the start.