t / t9157-git-svn-fetch-merge.shon commit builtin/commit: fix memory leak in `prepare_index()` (dd1055e)
   1#!/bin/sh
   2#
   3# Copyright (c) 2010 Steven Walter
   4#
   5
   6test_description='git svn merge detection'
   7. ./lib-git-svn.sh
   8
   9svn_ver="$(svn --version --quiet)"
  10case $svn_ver in
  110.* | 1.[0-4].*)
  12        skip_all="skipping git-svn test - SVN too old ($svn_ver)"
  13        test_done
  14        ;;
  15esac
  16
  17test_expect_success 'initialize source svn repo' '
  18        svn_cmd mkdir -m x "$svnrepo"/trunk &&
  19        svn_cmd mkdir -m x "$svnrepo"/branches &&
  20        svn_cmd co "$svnrepo"/trunk "$SVN_TREE" &&
  21        (
  22                cd "$SVN_TREE" &&
  23                touch foo &&
  24                svn add foo &&
  25                svn commit -m "initial commit" &&
  26                svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch1 &&
  27                touch bar &&
  28                svn add bar &&
  29                svn commit -m x &&
  30                svn cp -m branch "$svnrepo"/trunk "$svnrepo"/branches/branch2 &&
  31                svn switch "$svnrepo"/branches/branch1 &&
  32                touch baz &&
  33                svn add baz &&
  34                svn commit -m x &&
  35                svn switch "$svnrepo"/trunk &&
  36                svn merge "$svnrepo"/branches/branch1 &&
  37                svn commit -m "merge" &&
  38                svn switch "$svnrepo"/branches/branch1 &&
  39                svn commit -m x &&
  40                svn switch "$svnrepo"/branches/branch2 &&
  41                svn merge "$svnrepo"/branches/branch1 &&
  42                svn commit -m "merge branch1" &&
  43                svn switch "$svnrepo"/trunk &&
  44                svn merge "$svnrepo"/branches/branch2 &&
  45                svn resolved baz &&
  46                svn commit -m "merge branch2"
  47        ) &&
  48        rm -rf "$SVN_TREE"
  49'
  50
  51test_expect_success 'clone svn repo' '
  52        git svn init -s "$svnrepo" &&
  53        git svn fetch
  54'
  55
  56test_expect_success 'verify merge commit' 'git rev-parse HEAD^2'
  57
  58test_done