am: refresh the index at start and --resolved

If a file is unchanged but stat-dirty, we may erroneously fail to apply patches, thinking that they conflict with a dirty working tree. This patch adds a call to "update-index --refresh". It comes as late as possible, so that we don't bother with it for thinks like "git rebase --abort", or when mbox-splitting fails. However, it does come before we actually start applying patches, meaning we will only call it once when we start applying patches (or any time we return to "am" after having resolved conflicts), and not once per patch. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Aug 15, 2011 at 17:13 UTC 2a6f08ac1f6949ed0072aed3240bc04d80051851
1 file changed +2
git-am.sh
+2
@@ -507,6 +507,8 @@ else
507 fi
508 fi
509
510 +git update-index -q --refresh
511 +
512 case "$resolved" in
513 '')
514 case "$HAS_HEAD" in