OSDN Git Service

Merge branch 'jk/mv-submodules-fix'
authorJunio C Hamano <gitster@pobox.com>
Tue, 25 Mar 2014 18:02:01 +0000 (11:02 -0700)
committerJunio C Hamano <gitster@pobox.com>
Tue, 25 Mar 2014 18:02:02 +0000 (11:02 -0700)
"git mv" that moves a submodule forgot to adjust the array that uses
to keep track of which submodules were to be moved to update its
configuration.

* jk/mv-submodules-fix:
  mv: prevent mismatched data when ignoring errors.
  builtin/mv: fix out of bounds write

1  2 
builtin/mv.c
t/t7001-mv.sh

diff --cc builtin/mv.c
Simple merge
diff --cc t/t7001-mv.sh
@@@ -442,25 -443,14 +443,35 @@@ test_expect_success 'mv --dry-run does 
        git diff-files --quiet -- sub .gitmodules
  '
  
 +test_expect_success 'checking out a commit before submodule moved needs manual updates' '
 +      git mv sub sub2 &&
 +      git commit -m "moved sub to sub2" &&
 +      git checkout -q HEAD^ 2>actual &&
 +      echo "warning: unable to rmdir sub2: Directory not empty" >expected &&
 +      test_i18ncmp expected actual &&
 +      git status -s sub2 >actual &&
 +      echo "?? sub2/" >expected &&
 +      test_cmp expected actual &&
 +      ! test -f sub/.git &&
 +      test -f sub2/.git &&
 +      git submodule update &&
 +      test -f sub/.git &&
 +      rm -rf sub2 &&
 +      git diff-index --exit-code HEAD &&
 +      git update-index --refresh &&
 +      git diff-files --quiet -- sub .gitmodules &&
 +      git status -s sub2 >actual &&
 +      ! test -s actual
 +'
 +
+ test_expect_success 'mv -k does not accidentally destroy submodules' '
+       git checkout submodule &&
+       mkdir dummy dest &&
+       git mv -k dummy sub dest &&
+       git status --porcelain >actual &&
+       grep "^R  sub -> dest/sub" actual &&
+       git reset --hard &&
+       git checkout .
+ '
  test_done