t / t4000-diff-format.shon commit Abstract out the "name <email> date" handling of commit-tree.c (6aa33f4)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5
   6test_description='Test built-in diff output engine.
   7
   8'
   9. ./test-lib.sh
  10
  11echo >path0 'Line 1
  12Line 2
  13line 3'
  14cat path0 >path1
  15chmod +x path1
  16
  17test_expect_success \
  18    'update-cache --add two files with and without +x.' \
  19    'git-update-cache --add path0 path1'
  20
  21mv path0 path0-
  22sed -e 's/line/Line/' <path0- >path0
  23chmod +x path0
  24rm -f path1
  25test_expect_success \
  26    'git-diff-files -p after editing work tree.' \
  27    'git-diff-files -p >current'
  28cat >expected <<\EOF
  29diff --git a/path0 b/path0
  30old mode 100644
  31new mode 100755
  32--- a/path0
  33+++ b/path0
  34@@ -1,3 +1,3 @@
  35 Line 1
  36 Line 2
  37-line 3
  38+Line 3
  39diff --git a/path1 b/path1
  40deleted file mode 100755
  41--- a/path1
  42+++ /dev/null
  43@@ -1,3 +0,0 @@
  44-Line 1
  45-Line 2
  46-line 3
  47EOF
  48
  49test_expect_success \
  50    'validate git-diff-files -p output.' \
  51    'cmp -s current expected'
  52
  53test_expect_success \
  54    'build same diff using git-diff-helper.' \
  55    'git-diff-files -z | git-diff-helper -z >current'
  56
  57
  58test_expect_success \
  59    'validate git-diff-helper output.' \
  60    'cmp -s current expected'
  61
  62test_done