stg: make refresh warn when index is dirty

Sometimes it is useful to use git add interactively in order to selectively add
parts of an edit to the index, and then refresh a patch. However, standard stg
operation has refresh add every modified file to the patch. This is somewhat
annoying because it is easy to perform a git add -i and then forget to use the
'--index' option. This patch adds code which checks whether the index is clean
(no changes) before allowing a refresh. In addition, a new option '--force'
which overrides this check has been added in the cases where these are
necessary, such as adding new files in a patch.

Signed-off-by: Jacob Keller <>
Signed-off-by: Peter P Waskiewicz Jr <>
1 file changed