Skip to content
This repository was archived by the owner on Nov 9, 2017. It is now read-only.

Commit e897327

Browse files
dschokasal
authored andcommitted
git am: ignore dirty submodules
This fixes a rebase in the presence of dirty submodules. This is orthogonal to the application of patches changing submodules. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent ec765f6 commit e897327

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

git-am.sh

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,8 @@ case "$resolved" in
593593
'')
594594
files=$(git ls-files) ;;
595595
?*)
596-
files=$(git diff-index --cached --name-only HEAD --) ;;
596+
files=$(git diff-index --ignore-submodules --cached \
597+
--name-only HEAD --) ;;
597598
esac || exit
598599
if test "$files"
599600
then
@@ -767,7 +768,8 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."
767768
case "$resolved$interactive" in
768769
tt)
769770
# This is used only for interactive view option.
770-
git diff-index -p --cached HEAD -- >"$dotest/patch"
771+
git diff-index --ignore-submodules -p --cached \
772+
HEAD -- >"$dotest/patch"
771773
;;
772774
esac
773775
esac
@@ -843,7 +845,7 @@ To restore the original branch and stop patching run \"\$cmdline --abort\"."
843845
# trust what the user has in the index file and the
844846
# working tree.
845847
resolved=
846-
git diff-index --quiet --cached HEAD -- && {
848+
git diff-index --ignore-submodules --quiet --cached HEAD -- && {
847849
gettextln "No changes - did you forget to use 'git add'?
848850
If there is nothing left to stage, chances are that something else
849851
already introduced the same changes; you might want to skip this patch."
@@ -867,7 +869,8 @@ did you forget to use 'git add'?"
867869
then
868870
# Applying the patch to an earlier tree and merging the
869871
# result may have produced the same tree as ours.
870-
git diff-index --quiet --cached HEAD -- && {
872+
git diff-index --ignore-submodules --quiet --cached \
873+
HEAD -- && {
871874
say "$(gettext "No changes -- Patch already applied.")"
872875
go_next
873876
continue

0 commit comments

Comments
 (0)