t / t7003-filter-branch.shon commit Add git-filter-branch (6f6826c)
   1#!/bin/sh
   2
   3test_description='git-filter-branch'
   4. ./test-lib.sh
   5
   6make_commit () {
   7        lower=$(echo $1 | tr A-Z a-z)
   8        echo $lower > $lower
   9        git add $lower
  10        git commit -m $1
  11        git tag $1
  12}
  13
  14test_expect_success 'setup' '
  15        make_commit A
  16        make_commit B
  17        git checkout -b branch B
  18        make_commit D
  19        make_commit E
  20        git checkout master
  21        make_commit C
  22        git checkout branch
  23        git merge C
  24        git tag F
  25        make_commit G
  26        make_commit H
  27'
  28
  29H=$(git-rev-parse H)
  30
  31test_expect_success 'rewrite identically' '
  32        git-filter-branch H2
  33'
  34
  35test_expect_success 'result is really identical' '
  36        test $H = $(git-rev-parse H2)
  37'
  38
  39test_expect_success 'rewrite, renaming a specific file' '
  40        git-filter-branch --tree-filter "mv d doh || :" H3
  41'
  42
  43test_expect_success 'test that the file was renamed' '
  44        test d = $(git show H3:doh)
  45'
  46
  47test_done