t / t3006-ls-files-long.shon commit upload-pack: support hidden refs with protocol v2 (e20b419)
   1#!/bin/sh
   2
   3test_description='overly long paths'
   4. ./test-lib.sh
   5
   6test_expect_success setup '
   7        p=filefilefilefilefilefilefilefile &&
   8        p=$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p &&
   9        p=$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p &&
  10
  11        path_a=${p}_a &&
  12        path_z=${p}_z &&
  13
  14        blob_a=$(echo frotz | git hash-object -w --stdin) &&
  15        blob_z=$(echo nitfol | git hash-object -w --stdin) &&
  16
  17        pat="100644 %s 0\t%s\n"
  18'
  19
  20test_expect_success 'overly-long path by itself is not a problem' '
  21        printf "$pat" "$blob_a" "$path_a" |
  22        git update-index --add --index-info &&
  23        echo "$path_a" >expect &&
  24        git ls-files >actual &&
  25        test_cmp expect actual
  26'
  27
  28test_expect_success 'overly-long path does not replace another by mistake' '
  29        printf "$pat" "$blob_a" "$path_a" "$blob_z" "$path_z" |
  30        git update-index --add --index-info &&
  31        (
  32                echo "$path_a" &&
  33                echo "$path_z"
  34        ) >expect &&
  35        git ls-files >actual &&
  36        test_cmp expect actual
  37'
  38
  39test_done