t / t9146-git-svn-empty-dirs.shon commit Merge branch 'jn/editor-pager' (376f39f)
   1#!/bin/sh
   2#
   3# Copyright (c) 2009 Eric Wong
   4
   5test_description='git svn creates empty directories'
   6. ./lib-git-svn.sh
   7
   8test_expect_success 'initialize repo' '
   9        for i in a b c d d/e d/e/f "weird file name"
  10        do
  11                svn_cmd mkdir -m "mkdir $i" "$svnrepo"/"$i"
  12        done
  13'
  14
  15test_expect_success 'clone' 'git svn clone "$svnrepo" cloned'
  16
  17test_expect_success 'empty directories exist' '
  18        (
  19                cd cloned &&
  20                for i in a b c d d/e d/e/f "weird file name"
  21                do
  22                        if ! test -d "$i"
  23                        then
  24                                echo >&2 "$i does not exist"
  25                                exit 1
  26                        fi
  27                done
  28        )
  29'
  30
  31test_expect_success 'more emptiness' '
  32        svn_cmd mkdir -m "bang bang"  "$svnrepo"/"! !"
  33'
  34
  35test_expect_success 'git svn rebase creates empty directory' '
  36        ( cd cloned && git svn rebase )
  37        test -d cloned/"! !"
  38'
  39
  40test_expect_success 'git svn mkdirs recreates empty directories' '
  41        (
  42                cd cloned &&
  43                rm -r * &&
  44                git svn mkdirs &&
  45                for i in a b c d d/e d/e/f "weird file name" "! !"
  46                do
  47                        if ! test -d "$i"
  48                        then
  49                                echo >&2 "$i does not exist"
  50                                exit 1
  51                        fi
  52                done
  53        )
  54'
  55
  56test_expect_success 'git svn mkdirs -r works' '
  57        (
  58                cd cloned &&
  59                rm -r * &&
  60                git svn mkdirs -r7 &&
  61                for i in a b c d d/e d/e/f "weird file name"
  62                do
  63                        if ! test -d "$i"
  64                        then
  65                                echo >&2 "$i does not exist"
  66                                exit 1
  67                        fi
  68                done
  69
  70                if test -d "! !"
  71                then
  72                        echo >&2 "$i should not exist"
  73                        exit 1
  74                fi
  75
  76                git svn mkdirs -r8 &&
  77                if ! test -d "! !"
  78                then
  79                        echo >&2 "$i not exist"
  80                        exit 1
  81                fi
  82        )
  83'
  84
  85test_done