t / t4003-diff-rename-1.shon commit l10n: zh_CN: Revision for git v2.21.0 l10n (8e4e055)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5
   6test_description='More rename detection
   7
   8'
   9. ./test-lib.sh
  10. "$TEST_DIRECTORY"/diff-lib.sh ;# test-lib chdir's into trash
  11
  12test_expect_success \
  13    'prepare reference tree' \
  14    'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
  15     echo frotz >rezrov &&
  16    git update-index --add COPYING rezrov &&
  17    tree=$(git write-tree) &&
  18    echo $tree'
  19
  20test_expect_success \
  21    'prepare work tree' \
  22    'sed -e 's/HOWEVER/However/' <COPYING >COPYING.1 &&
  23    sed -e 's/GPL/G.P.L/g' <COPYING >COPYING.2 &&
  24    rm -f COPYING &&
  25    git update-index --add --remove COPYING COPYING.?'
  26
  27# tree has COPYING and rezrov.  work tree has COPYING.1 and COPYING.2,
  28# both are slightly edited, and unchanged rezrov.  So we say you
  29# copy-and-edit one, and rename-and-edit the other.  We do not say
  30# anything about rezrov.
  31
  32GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current
  33cat >expected <<\EOF
  34diff --git a/COPYING b/COPYING.1
  35copy from COPYING
  36copy to COPYING.1
  37--- a/COPYING
  38+++ b/COPYING.1
  39@@ -6 +6 @@
  40- HOWEVER, in order to allow a migration to GPLv3 if that seems like
  41+ However, in order to allow a migration to GPLv3 if that seems like
  42diff --git a/COPYING b/COPYING.2
  43rename from COPYING
  44rename to COPYING.2
  45--- a/COPYING
  46+++ b/COPYING.2
  47@@ -2 +2 @@
  48- Note that the only valid version of the GPL as far as this project
  49+ Note that the only valid version of the G.P.L as far as this project
  50@@ -6 +6 @@
  51- HOWEVER, in order to allow a migration to GPLv3 if that seems like
  52+ HOWEVER, in order to allow a migration to G.P.Lv3 if that seems like
  53@@ -12 +12 @@
  54-       This file is licensed under the GPL v2, or a later version
  55+       This file is licensed under the G.P.L v2, or a later version
  56EOF
  57
  58test_expect_success \
  59    'validate output from rename/copy detection (#1)' \
  60    'compare_diff_patch current expected'
  61
  62test_expect_success \
  63    'prepare work tree again' \
  64    'mv COPYING.2 COPYING &&
  65     git update-index --add --remove COPYING COPYING.1 COPYING.2'
  66
  67# tree has COPYING and rezrov.  work tree has COPYING and COPYING.1,
  68# both are slightly edited, and unchanged rezrov.  So we say you
  69# edited one, and copy-and-edit the other.  We do not say
  70# anything about rezrov.
  71
  72GIT_DIFF_OPTS=--unified=0 git diff-index -C -p $tree >current
  73cat >expected <<\EOF
  74diff --git a/COPYING b/COPYING
  75--- a/COPYING
  76+++ b/COPYING
  77@@ -2 +2 @@
  78- Note that the only valid version of the GPL as far as this project
  79+ Note that the only valid version of the G.P.L as far as this project
  80@@ -6 +6 @@
  81- HOWEVER, in order to allow a migration to GPLv3 if that seems like
  82+ HOWEVER, in order to allow a migration to G.P.Lv3 if that seems like
  83@@ -12 +12 @@
  84-       This file is licensed under the GPL v2, or a later version
  85+       This file is licensed under the G.P.L v2, or a later version
  86diff --git a/COPYING b/COPYING.1
  87copy from COPYING
  88copy to COPYING.1
  89--- a/COPYING
  90+++ b/COPYING.1
  91@@ -6 +6 @@
  92- HOWEVER, in order to allow a migration to GPLv3 if that seems like
  93+ However, in order to allow a migration to GPLv3 if that seems like
  94EOF
  95
  96test_expect_success \
  97    'validate output from rename/copy detection (#2)' \
  98    'compare_diff_patch current expected'
  99
 100test_expect_success \
 101    'prepare work tree once again' \
 102    'cat "$TEST_DIRECTORY"/diff-lib/COPYING >COPYING &&
 103     git update-index --add --remove COPYING COPYING.1'
 104
 105# tree has COPYING and rezrov.  work tree has COPYING and COPYING.1,
 106# but COPYING is not edited.  We say you copy-and-edit COPYING.1; this
 107# is only possible because -C mode now reports the unmodified file to
 108# the diff-core.  Unchanged rezrov, although being fed to
 109# git diff-index as well, should not be mentioned.
 110
 111GIT_DIFF_OPTS=--unified=0 \
 112    git diff-index -C --find-copies-harder -p $tree >current
 113cat >expected <<\EOF
 114diff --git a/COPYING b/COPYING.1
 115copy from COPYING
 116copy to COPYING.1
 117--- a/COPYING
 118+++ b/COPYING.1
 119@@ -6 +6 @@
 120- HOWEVER, in order to allow a migration to GPLv3 if that seems like
 121+ However, in order to allow a migration to GPLv3 if that seems like
 122EOF
 123
 124test_expect_success \
 125    'validate output from rename/copy detection (#3)' \
 126    'compare_diff_patch current expected'
 127
 128test_done