NonLogicalDev · GitHub

To reproduce:

( set -ex
  rm -rf test
  # Create Test Repo
  mkdir -p test && cd test
  git init && git commit -m "INIT" --allow-empty
  # Init StGit
  stg init
  # Create two new patches
  stg new patch1 -m patch1
  stg new patch2 -m patch2
  # Assert patch2 as topmost patch
  test "$(stg top)" == patch2
  # Touch a few files
  touch a.txt b.txt c.txt
  # Add all files to staging area (to make sure index is not dirty)
  stg add -A
  # Attempt to send only a.txt to patch1
  stg refresh -p patch1 -- a.txt
  ## ERROR: ##
  #
  # error: a.txt: cannot add to the index - missing --add option?
  # fatal: Unable to process path a.txt
  # stg refresh: git failed with code 128
  ## EXPECTED: ##
  stg files patch1
  ## OUTPUT: ##
  # A a.txt
  stg files patch2
  ## OUTPUT: ##
  # <EMPTY>
  stg status
  ## OUTPUT: ##
  # A b.txt
  # A c.txt
)

I narrowed down the problem to the following function:
https://github.com/stacked-git/stgit/blob/master/stgit/lib/git/iw.py#L332

Read the original on github.com ↗