#!/bin/sh global test_description := ''overly long paths'' source ./test-lib.sh test_expect_success setup ' p=filefilefilefilefilefilefilefile && p=$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p && p=$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p && path_a=${p}_a && path_z=${p}_z && blob_a=$(echo frotz | git hash-object -w --stdin) && blob_z=$(echo nitfol | git hash-object -w --stdin) && pat="100644 %s 0\t%s\n" ' test_expect_success 'overly-long path by itself is not a problem' ' printf "$pat" "$blob_a" "$path_a" | git update-index --add --index-info && echo "$path_a" >expect && git ls-files >actual && test_cmp expect actual ' test_expect_success 'overly-long path does not replace another by mistake' ' printf "$pat" "$blob_a" "$path_a" "$blob_z" "$path_z" | git update-index --add --index-info && ( echo "$path_a" echo "$path_z" ) >expect && git ls-files >actual && test_cmp expect actual ' test_done (CommandList children: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:test_description) op: Equal rhs: {(SQ <"overly long paths">)} spids: [4] ) ] spids: [4] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(setup)} { (SQ <"\n"> <"\tp=filefilefilefilefilefilefilefile &&\n"> <"\tp=$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p &&\n"> <"\tp=$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p$p &&\n"> <"\n"> <"\tpath_a=${p}_a &&\n"> <"\tpath_z=${p}_z &&\n"> <"\n"> <"\tblob_a=$(echo frotz | git hash-object -w --stdin) &&\n"> <"\tblob_z=$(echo nitfol | git hash-object -w --stdin) &&\n"> <"\n"> <"\tpat=\"100644 %s 0\\t%s\\n\"\n"> ) } ) (C {(test_expect_success)} {(SQ <"overly-long path by itself is not a problem">)} { (SQ <"\n"> <"\tprintf \"$pat\" \"$blob_a\" \"$path_a\" |\n"> <"\tgit update-index --add --index-info &&\n"> <"\techo \"$path_a\" >expect &&\n"> <"\tgit ls-files >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_expect_success)} {(SQ <"overly-long path does not replace another by mistake">)} { (SQ <"\n"> <"\tprintf \"$pat\" \"$blob_a\" \"$path_a\" \"$blob_z\" \"$path_z\" |\n"> <"\tgit update-index --add --index-info &&\n"> <"\t(\n"> <"\t\techo \"$path_a\"\n"> <"\t\techo \"$path_z\"\n"> <"\t) >expect &&\n"> <"\tgit ls-files >actual &&\n"> <"\ttest_cmp expect actual\n"> ) } ) (C {(test_done)}) ] )