test.shon commit Even more aggressive commit trimming. (d691265)
   1#!/bin/bash -x
   2. shellopts.sh
   3set -e
   4
   5rm -rf mainline subproj
   6mkdir mainline subproj
   7
   8cd subproj
   9git init
  10
  11touch sub1
  12git add sub1
  13git commit -m 'sub-1'
  14git branch sub1
  15git branch -m master subproj
  16
  17touch sub2
  18git add sub2
  19git commit -m 'sub-2'
  20git branch sub2
  21
  22touch sub3
  23git add sub3
  24git commit -m 'sub-3'
  25git branch sub3
  26
  27cd ../mainline
  28git init
  29touch main1
  30git add main1
  31git commit -m 'main-1'
  32git branch -m master mainline
  33
  34git fetch ../subproj sub1
  35git branch sub1 FETCH_HEAD
  36git read-tree --prefix=subdir FETCH_HEAD
  37git checkout subdir
  38git commit -m 'initial-subdir-merge'
  39
  40git merge -m 'merge -s -ours' -s ours FETCH_HEAD
  41
  42touch subdir/main-sub3
  43git add subdir/main-sub3
  44git commit -m 'main-sub3'
  45
  46touch main-2
  47git add main-2
  48git commit -m 'main-2 boring'
  49
  50touch subdir/main-sub4
  51git add subdir/main-sub4
  52git commit -m 'main-sub4'
  53
  54git fetch ../subproj sub2
  55git branch sub2 FETCH_HEAD
  56git merge -s subtree FETCH_HEAD
  57git branch pre-split
  58
  59split1=$(git subtree split --onto FETCH_HEAD subdir --rejoin)
  60echo "split1={$split1}"
  61git branch split1 "$split1"
  62
  63touch subdir/main-sub5
  64git add subdir/main-sub5
  65git commit -m 'main-sub5'
  66
  67cd ../subproj
  68git fetch ../mainline split1
  69git branch split1 FETCH_HEAD
  70git merge FETCH_HEAD
  71
  72touch sub6
  73git add sub6
  74git commit -m 'sub6'
  75
  76cd ../mainline
  77split2=$(git subtree split subdir --rejoin)
  78git branch split2 "$split2"
  79
  80touch subdir/main-sub7
  81git add subdir/main-sub7
  82git commit -m 'main-sub7'
  83
  84split3=$(git subtree split subdir --rejoin)
  85git branch split3 "$split3"
  86
  87cd ../subproj
  88git fetch ../mainline split3
  89git branch split3 FETCH_HEAD
  90git merge FETCH_HEAD
  91git branch subproj-merge-split3
  92
  93cd ../mainline
  94git fetch ../subproj subproj-merge-split3
  95git branch subproj-merge-split3 FETCH_HEAD
  96git merge -s subtree subproj-merge-split3