Merge branch 'nd/cache-tree-ita'
authorJunio C Hamano <gitster@pobox.com>
Mon, 25 Jul 2016 21:13:44 +0000 (14:13 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 25 Jul 2016 21:13:44 +0000 (14:13 -0700)
"git add -N dir/file && git write-tree" produced an incorrect tree
when there are other paths in the same directory that sorts after
"file".

* nd/cache-tree-ita:
cache-tree: do not generate empty trees as a result of all i-t-a subentries
cache-tree.c: fix i-t-a entry skipping directory updates sometimes
test-lib.sh: introduce and use $EMPTY_BLOB
test-lib.sh: introduce and use $EMPTY_TREE

1  2 
t/t1011-read-tree-sparse-checkout.sh
t/t7063-status-untracked-cache.sh
t/t7508-status.sh
t/test-lib.sh
index e5fa235d3a988bee620479e40574ad54c403f33a,2563d18440e34661da9dcff06817855f7b631dde..c167f606ca7b8c1628ac8d00507d50f032278730
@@@ -15,11 -15,11 +15,11 @@@ test_description='sparse checkout test
  . "$TEST_DIRECTORY"/lib-read-tree.sh
  
  test_expect_success 'setup' '
-       cat >expected <<-\EOF &&
+       cat >expected <<-EOF &&
        100644 77f0ba1734ed79d12881f81b36ee134de6a3327b 0       init.t
-       100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       sub/added
-       100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       sub/addedtoo
-       100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0       subsub/added
+       100644 $EMPTY_BLOB 0    sub/added
+       100644 $EMPTY_BLOB 0    sub/addedtoo
+       100644 $EMPTY_BLOB 0    subsub/added
        EOF
        cat >expected.swt <<-\EOF &&
        H init.t
@@@ -244,10 -244,10 +244,10 @@@ test_expect_success 'print errors when 
  error: The following untracked working tree files would be overwritten by checkout:
        sub/added
        sub/addedtoo
 -Please move or remove them before you can switch branches.
 +Please move or remove them before you switch branches.
  Aborting
  EOF
 -      test_cmp expected actual
 +      test_i18ncmp expected actual
  '
  
  test_expect_success 'checkout without --ignore-skip-worktree-bits' '
index 38b3890532ddfdef1f110e37aefe404596752703,a828a5f3b4b67c3f3241a8c7522b3b9307c809fa..c23a21cb74d56426a9948c0a37db512b093eaa57
@@@ -53,7 -53,7 +53,7 @@@ A  tw
  EOF
  
  cat >../dump.expect <<EOF &&
- info/exclude e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+ info/exclude $EMPTY_BLOB
  core.excludesfile 0000000000000000000000000000000000000000
  exclude_per_dir .gitignore
  flags 00000006
@@@ -137,7 -137,7 +137,7 @@@ EO
  test_expect_success 'verify untracked cache dump' '
        test-dump-untracked-cache >../actual &&
        cat >../expect <<EOF &&
- info/exclude e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+ info/exclude $EMPTY_BLOB
  core.excludesfile 0000000000000000000000000000000000000000
  exclude_per_dir .gitignore
  flags 00000006
@@@ -184,7 -184,7 +184,7 @@@ EO
  test_expect_success 'verify untracked cache dump' '
        test-dump-untracked-cache >../actual &&
        cat >../expect <<EOF &&
- info/exclude e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
+ info/exclude $EMPTY_BLOB
  core.excludesfile 0000000000000000000000000000000000000000
  exclude_per_dir .gitignore
  flags 00000006
@@@ -643,7 -643,7 +643,7 @@@ test_expect_success 'test ident field i
        cp -R done dthree dtwo four three ../other_worktree &&
        GIT_WORK_TREE=../other_worktree git status 2>../err &&
        echo "warning: Untracked cache is disabled on this system or location." >../expect &&
 -      test_cmp ../expect ../err
 +      test_i18ncmp ../expect ../err
  '
  
  test_done
diff --combined t/t7508-status.sh
index b3bdd162aaaf0fed0be9f62feab6aeb4b7019dbe,a42aef8317203e4775ebc6356bbba16f42dc59b6..fb00e6d9b07f4cc6f478bb532749403017599400
@@@ -803,7 -803,7 +803,7 @@@ EO
  '
  
  cat >expect <<EOF
- :100644 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 0000000000000000000000000000000000000000 M    dir1/modified
+ :100644 100644 $EMPTY_BLOB 0000000000000000000000000000000000000000 M dir1/modified
  EOF
  test_expect_success 'status refreshes the index' '
        touch dir2/added &&
@@@ -1377,7 -1377,7 +1377,7 @@@ EO
        git config --add -f .gitmodules submodule.subname.ignore all &&
        git config --add -f .gitmodules submodule.subname.path sm &&
        git status > output &&
 -      test_cmp expect output &&
 +      test_i18ncmp expect output &&
        git config -f .gitmodules  --remove-section submodule.subname
  '
  
@@@ -1387,7 -1387,7 +1387,7 @@@ test_expect_success '.git/config ignore
        git config --add submodule.subname.ignore all &&
        git config --add submodule.subname.path sm &&
        git status > output &&
 -      test_cmp expect output &&
 +      test_i18ncmp expect output &&
        git config --remove-section submodule.subname &&
        git config -f .gitmodules  --remove-section submodule.subname
  '
diff --combined t/test-lib.sh
index 3f8b98b2c54e1afdb0da42fe3de9fa5ab3f59df3,9f36091bf81889fe4b6f54ad36796dde29633335..d731d66e3673f0e9d990007dd690c14d84eae783
@@@ -162,6 -162,9 +162,9 @@@ _x40="$_x05$_x05$_x05$_x05$_x05$_x05$_x
  # Zero SHA-1
  _z40=0000000000000000000000000000000000000000
  
+ EMPTY_TREE=4b825dc642cb6eb9a060e54bf8d69288fbee4904
+ EMPTY_BLOB=e69de29bb2d1d6434b8b29ae775ad8c2e48c5391
  # Line feed
  LF='
  '
  # when case-folding filenames
  u200c=$(printf '\342\200\214')
  
- export _x05 _x40 _z40 LF u200c
+ export _x05 _x40 _z40 LF u200c EMPTY_TREE EMPTY_BLOB
  
  # Each test should start with something like this, after copyright notices:
  #
@@@ -798,7 -801,7 +801,7 @@@ the
        # override all git executables in TEST_DIRECTORY/..
        GIT_VALGRIND=$TEST_DIRECTORY/valgrind
        mkdir -p "$GIT_VALGRIND"/bin
 -      for file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/test-*
 +      for file in $GIT_BUILD_DIR/git* $GIT_BUILD_DIR/t/helper/test-*
        do
                make_valgrind_symlink $file
        done
@@@ -1111,12 -1114,3 +1114,12 @@@ run_with_limited_cmdline () 
  }
  
  test_lazy_prereq CMDLINE_LIMIT 'run_with_limited_cmdline true'
 +
 +build_option () {
 +      git version --build-options |
 +      sed -ne "s/^$1: //p"
 +}
 +
 +test_lazy_prereq LONG_IS_64BIT '
 +      test 8 -le "$(build_option sizeof-long)"
 +'