t / t3902-quoted.shon commit Use $(RM) in Makefiles instead of 'rm -f' (4cb08df)
   1#!/bin/sh
   2#
   3# Copyright (c) 2006 Junio C Hamano
   4#
   5
   6test_description='quoted output'
   7
   8. ./test-lib.sh
   9
  10FN='濱野'
  11GN='純'
  12HT='    '
  13LF='
  14'
  15DQ='"'
  16
  17for_each_name () {
  18        for name in \
  19            Name "Name and a${LF}LF" "Name and an${HT}HT" "Name${DQ}" \
  20            "$FN$HT$GN" "$FN$LF$GN" "$FN $GN" "$FN$GN" "$FN$DQ$GN" \
  21            "With SP in it"
  22        do
  23                eval "$1"
  24        done
  25}
  26
  27test_expect_success setup '
  28
  29        for_each_name "echo initial >\"\$name\""
  30        git add . &&
  31        git commit -q -m Initial &&
  32
  33        for_each_name "echo second >\"\$name\"" &&
  34        git commit -a -m Second
  35
  36        for_each_name "echo modified >\"\$name\""
  37
  38'
  39
  40cat >expect.quoted <<\EOF
  41Name
  42"Name and a\nLF"
  43"Name and an\tHT"
  44"Name\""
  45With SP in it
  46"\346\277\261\351\207\216\t\347\264\224"
  47"\346\277\261\351\207\216\n\347\264\224"
  48"\346\277\261\351\207\216 \347\264\224"
  49"\346\277\261\351\207\216\"\347\264\224"
  50"\346\277\261\351\207\216\347\264\224"
  51EOF
  52
  53cat >expect.raw <<\EOF
  54Name
  55"Name and a\nLF"
  56"Name and an\tHT"
  57"Name\""
  58With SP in it
  59"濱野\t純"
  60"濱野\n純"
  61濱野 純
  62"濱野\"純"
  63濱野純
  64EOF
  65
  66test_expect_success 'check fully quoted output from ls-files' '
  67
  68        git ls-files >current && diff -u expect.quoted current
  69
  70'
  71
  72test_expect_success 'check fully quoted output from diff-files' '
  73
  74        git diff --name-only >current &&
  75        diff -u expect.quoted current
  76
  77'
  78
  79test_expect_success 'check fully quoted output from diff-index' '
  80
  81        git diff --name-only HEAD >current &&
  82        diff -u expect.quoted current
  83
  84'
  85
  86test_expect_success 'check fully quoted output from diff-tree' '
  87
  88        git diff --name-only HEAD^ HEAD >current &&
  89        diff -u expect.quoted current
  90
  91'
  92
  93test_expect_success 'setting core.quotepath' '
  94
  95        git config --bool core.quotepath false
  96
  97'
  98
  99test_expect_success 'check fully quoted output from ls-files' '
 100
 101        git ls-files >current && diff -u expect.raw current
 102
 103'
 104
 105test_expect_success 'check fully quoted output from diff-files' '
 106
 107        git diff --name-only >current &&
 108        diff -u expect.raw current
 109
 110'
 111
 112test_expect_success 'check fully quoted output from diff-index' '
 113
 114        git diff --name-only HEAD >current &&
 115        diff -u expect.raw current
 116
 117'
 118
 119test_expect_success 'check fully quoted output from diff-tree' '
 120
 121        git diff --name-only HEAD^ HEAD >current &&
 122        diff -u expect.raw current
 123
 124'
 125
 126test_done