File tree Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Expand file tree Collapse file tree 2 files changed +40
-1
lines changed Original file line number Diff line number Diff line change @@ -331,7 +331,7 @@ while read commit parents; do
331
331
die " tree filter failed: $filter_tree "
332
332
333
333
(
334
- git diff-index -r --name-only $commit &&
334
+ git diff-index -r --name-only --ignore-submodules $commit &&
335
335
git ls-files --others
336
336
) > " $tempdir " /tree-state || exit
337
337
git update-index --add --replace --remove --stdin \
Original file line number Diff line number Diff line change @@ -306,4 +306,43 @@ test_expect_success '--remap-to-ancestor with filename filters' '
306
306
test $orig_invariant = $(git rev-parse invariant)
307
307
'
308
308
309
+ test_expect_success ' setup submodule' '
310
+ rm -fr ?* .git &&
311
+ git init &&
312
+ test_commit file &&
313
+ mkdir submod &&
314
+ submodurl="$PWD/submod" &&
315
+ ( cd submod &&
316
+ git init &&
317
+ test_commit file-in-submod ) &&
318
+ git submodule add "$submodurl" &&
319
+ git commit -m "added submodule" &&
320
+ test_commit add-file &&
321
+ ( cd submod && test_commit add-in-submodule ) &&
322
+ git add submod &&
323
+ git commit -m "changed submodule" &&
324
+ git branch original HEAD
325
+ '
326
+
327
+ orig_head=` git show-ref --hash --head HEAD`
328
+
329
+ test_expect_success ' rewrite submodule with another content' '
330
+ git filter-branch --tree-filter "test -d submod && {
331
+ rm -rf submod &&
332
+ git rm -rf --quiet submod &&
333
+ mkdir submod &&
334
+ : > submod/file
335
+ } || :" HEAD &&
336
+ test $orig_head != `git show-ref --hash --head HEAD`
337
+ '
338
+
339
+ test_expect_success ' replace submodule revision' '
340
+ git reset --hard original &&
341
+ git filter-branch -f --tree-filter \
342
+ "if git ls-files --error-unmatch -- submod > /dev/null 2>&1
343
+ then git update-index --cacheinfo 160000 0123456789012345678901234567890123456789 submod
344
+ fi" HEAD &&
345
+ test $orig_head != `git show-ref --hash --head HEAD`
346
+ '
347
+
309
348
test_done
You can’t perform that action at this time.
0 commit comments