t / t5400-send-pack.shon commit Yank writing-back support from gitfakemmap. (f48000f)
   1#!/bin/sh
   2#
   3# Copyright (c) 2005 Junio C Hamano
   4#
   5
   6test_description='See why rewinding head breaks send-pack
   7
   8'
   9. ./test-lib.sh
  10
  11cnt='1'
  12test_expect_success setup '
  13        tree=$(git-write-tree) &&
  14        commit=$(echo "Commit #0" | git-commit-tree $tree) &&
  15        zero=$commit &&
  16        parent=$zero &&
  17        for i in $cnt
  18        do
  19            sleep 1 &&
  20            commit=$(echo "Commit #$i" | git-commit-tree $tree -p $parent) &&
  21            parent=$commit || return 1
  22        done &&
  23        git-update-ref HEAD "$commit" &&
  24        git-clone -l ./. victim &&
  25        cd victim &&
  26        git-log &&
  27        cd .. &&
  28        git-update-ref HEAD "$zero" &&
  29        parent=$zero &&
  30        for i in $cnt
  31        do
  32            sleep 1 &&
  33            commit=$(echo "Rebase #$i" | git-commit-tree $tree -p $parent) &&
  34            parent=$commit || return 1
  35        done &&
  36        git-update-ref HEAD "$commit" &&
  37        echo Rebase &&
  38        git-log'
  39
  40test_expect_success \
  41        'pushing rewound head should not barf but require --force' ' 
  42        # should not fail but refuse to update.
  43        git-send-pack ./victim/.git/ master &&
  44        if cmp victim/.git/refs/heads/master .git/refs/heads/master
  45        then
  46                # should have been left as it was!
  47                false
  48        else
  49                true
  50        fi &&
  51        # this should update
  52        git-send-pack --force ./victim/.git/ master &&
  53        cmp victim/.git/refs/heads/master .git/refs/heads/master
  54'
  55
  56test_done