Skip to content
  • Robert Luberda's avatar
    git svn: handle errors and concurrent commits in dcommit · e48fb750
    Robert Luberda authored
    dcommit didn't handle errors returned by SVN and coped very
    poorly with concurrent commits that appear in SVN repository
    while dcommit was running. In both cases it left git repository
    in inconsistent state: index (which was reset with `git reset
    --mixed' after a successful commit to SVN) no longer matched the
    checkouted tree, when the following commit failed or needed to be
    rebased. See http://bugs.debian.org/676904
    
     for examples.
    
    This patch fixes the issues by:
    - introducing error handler for dcommit. The handler will try
      to rebase or reset working tree before returning error to the
      end user. dcommit_rebase function was extracted out of cmd_dcommit
      to ensure consistency between cmd_dcommit and the error handler.
    - calling `git reset --mixed' only once after all patches are
      successfully committed to SVN. This ensures index is not touched
      for most of the time of dcommit run.
    
    Signed-off-by: default avatarEric Wong <normalperson@yhbt.net>
    e48fb750