Merge branch 'bc/hash-algo' into maint
authorJunio C Hamano <gitster@pobox.com>
Mon, 22 Jan 2018 05:12:37 +0000 (21:12 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Jan 2018 05:12:37 +0000 (21:12 -0800)
* bc/hash-algo:
t5601-clone: test case-conflicting files on case-insensitive filesystem
repository: pre-initialize hash algo pointer

1  2 
t/t5601-clone.sh
diff --combined t/t5601-clone.sh
index 0f895478f02bcf4cc4408ce065e79e0314b66793,55df602aea346c6b2b1361d6d391d372d967e022..8c437bf8721f929155fa2ddab1677c050ae5caca
@@@ -306,21 -306,23 +306,21 @@@ test_expect_success 'clone checking ou
        test_cmp fetch.expected fetch.actual
  '
  
 -setup_ssh_wrapper () {
 -      test_expect_success 'setup ssh wrapper' '
 -              rm -f "$TRASH_DIRECTORY/ssh-wrapper$X" &&
 -              cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" \
 -                      "$TRASH_DIRECTORY/ssh-wrapper$X" &&
 -              GIT_SSH="$TRASH_DIRECTORY/ssh-wrapper$X" &&
 -              export GIT_SSH &&
 -              export TRASH_DIRECTORY &&
 -              >"$TRASH_DIRECTORY"/ssh-output
 -      '
 -}
 +test_expect_success 'set up ssh wrapper' '
 +      cp "$GIT_BUILD_DIR/t/helper/test-fake-ssh$X" \
 +              "$TRASH_DIRECTORY/ssh$X" &&
 +      GIT_SSH="$TRASH_DIRECTORY/ssh$X" &&
 +      export GIT_SSH &&
 +      export TRASH_DIRECTORY &&
 +      >"$TRASH_DIRECTORY"/ssh-output
 +'
  
  copy_ssh_wrapper_as () {
        rm -f "${1%$X}$X" &&
 -      cp "$TRASH_DIRECTORY/ssh-wrapper$X" "${1%$X}$X" &&
 +      cp "$TRASH_DIRECTORY/ssh$X" "${1%$X}$X" &&
 +      test_when_finished "rm $(git rev-parse --sq-quote "${1%$X}$X")" &&
        GIT_SSH="${1%$X}$X" &&
 -      export GIT_SSH
 +      test_when_finished "GIT_SSH=\"\$TRASH_DIRECTORY/ssh\$X\""
  }
  
  expect_ssh () {
        (cd "$TRASH_DIRECTORY" && test_cmp ssh-expect ssh-output)
  }
  
 -setup_ssh_wrapper
 -
  test_expect_success 'clone myhost:src uses ssh' '
        git clone myhost:src ssh-clone &&
        expect_ssh myhost src
@@@ -360,52 -364,9 +360,52 @@@ test_expect_success 'bracketed hostname
        expect_ssh "-p 123" myhost src
  '
  
 -test_expect_success 'uplink is not treated as putty' '
 +test_expect_success 'OpenSSH variant passes -4' '
 +      git clone -4 "[myhost:123]:src" ssh-ipv4-clone &&
 +      expect_ssh "-4 -p 123" myhost src
 +'
 +
 +test_expect_success 'variant can be overridden' '
 +      copy_ssh_wrapper_as "$TRASH_DIRECTORY/putty" &&
 +      git -c ssh.variant=putty clone -4 "[myhost:123]:src" ssh-putty-clone &&
 +      expect_ssh "-4 -P 123" myhost src
 +'
 +
 +test_expect_success 'variant=auto picks based on basename' '
 +      copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
 +      git -c ssh.variant=auto clone -4 "[myhost:123]:src" ssh-auto-clone &&
 +      expect_ssh "-4 -P 123" myhost src
 +'
 +
 +test_expect_success 'simple does not support -4/-6' '
 +      copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" &&
 +      test_must_fail git clone -4 "myhost:src" ssh-4-clone-simple
 +'
 +
 +test_expect_success 'simple does not support port' '
 +      copy_ssh_wrapper_as "$TRASH_DIRECTORY/simple" &&
 +      test_must_fail git clone "[myhost:123]:src" ssh-bracket-clone-simple
 +'
 +
 +test_expect_success 'uplink is treated as simple' '
        copy_ssh_wrapper_as "$TRASH_DIRECTORY/uplink" &&
 -      git clone "[myhost:123]:src" ssh-bracket-clone-uplink &&
 +      test_must_fail git clone "[myhost:123]:src" ssh-bracket-clone-uplink &&
 +      git clone "myhost:src" ssh-clone-uplink &&
 +      expect_ssh myhost src
 +'
 +
 +test_expect_success 'OpenSSH-like uplink is treated as ssh' '
 +      write_script "$TRASH_DIRECTORY/uplink" <<-EOF &&
 +      if test "\$1" = "-G"
 +      then
 +              exit 0
 +      fi &&
 +      exec "\$TRASH_DIRECTORY/ssh$X" "\$@"
 +      EOF
 +      test_when_finished "rm -f \"\$TRASH_DIRECTORY/uplink\"" &&
 +      GIT_SSH="$TRASH_DIRECTORY/uplink" &&
 +      test_when_finished "GIT_SSH=\"\$TRASH_DIRECTORY/ssh\$X\"" &&
 +      git clone "[myhost:123]:src" ssh-bracket-clone-sshlike-uplink &&
        expect_ssh "-p 123" myhost src
  '
  
@@@ -457,14 -418,12 +457,14 @@@ test_expect_success 'ssh.variant overri
  '
  
  test_expect_success 'GIT_SSH_VARIANT overrides plink detection to plink' '
 +      copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
        GIT_SSH_VARIANT=plink \
        git clone "[myhost:123]:src" ssh-bracket-clone-variant-3 &&
        expect_ssh "-P 123" myhost src
  '
  
  test_expect_success 'GIT_SSH_VARIANT overrides plink to tortoiseplink' '
 +      copy_ssh_wrapper_as "$TRASH_DIRECTORY/plink" &&
        GIT_SSH_VARIANT=tortoiseplink \
        git clone "[myhost:123]:src" ssh-bracket-clone-variant-4 &&
        expect_ssh "-batch -P 123" myhost src
@@@ -476,6 -435,9 +476,6 @@@ test_expect_success 'clean failure on b
                git clone "[myhost:123]:src" sq-failure
  '
  
 -# Reset the GIT_SSH environment variable for clone tests.
 -setup_ssh_wrapper
 -
  counter=0
  # $1 url
  # $2 none|host
@@@ -611,4 -573,21 +611,21 @@@ test_expect_success 'GIT_TRACE_PACKFIL
        git -C replay.git index-pack -v --stdin <tmp.pack
  '
  
+ hex2oct () {
+       perl -ne 'printf "\\%03o", hex for /../g'
+ }
+ test_expect_success 'clone on case-insensitive fs' '
+       git init icasefs &&
+       (
+               cd icasefs
+               o=$(git hash-object -w --stdin </dev/null | hex2oct) &&
+               t=$(printf "100644 X\0${o}100644 x\0${o}" |
+                       git hash-object -w -t tree --stdin) &&
+               c=$(git commit-tree -m bogus $t) &&
+               git update-ref refs/heads/bogus $c &&
+               git clone -b bogus . bogus
+       )
+ '
  test_done