t / t3035-merge-sparse.shon commit Merge branch 'nd/no-the-index' (dc0f6f9)
   1#!/bin/sh
   2
   3test_description='merge with sparse files'
   4
   5. ./test-lib.sh
   6
   7# test_file $filename $content
   8test_file () {
   9        echo "$2" > "$1" &&
  10        git add "$1"
  11}
  12
  13# test_commit_this $message_and_tag
  14test_commit_this () {
  15        git commit -m "$1" &&
  16        git tag "$1"
  17}
  18
  19test_expect_success 'setup' '
  20        : >empty &&
  21        test_file checked-out init &&
  22        test_file modify_delete modify_delete_init &&
  23        test_commit_this init &&
  24        test_file modify_delete modify_delete_theirs &&
  25        test_commit_this theirs &&
  26        git reset --hard init &&
  27        git rm modify_delete &&
  28        test_commit_this ours &&
  29        git config core.sparseCheckout true &&
  30        echo "/checked-out" >.git/info/sparse-checkout &&
  31        git reset --hard &&
  32        ! git merge theirs
  33'
  34
  35test_expect_success 'reset --hard works after the conflict' '
  36        git reset --hard
  37'
  38
  39test_expect_success 'is reset properly' '
  40        git status --porcelain -- modify_delete >out &&
  41        test_cmp empty out &&
  42        test_path_is_missing modify_delete
  43'
  44
  45test_expect_success 'setup: conflict back' '
  46        ! git merge theirs
  47'
  48
  49test_expect_success 'Merge abort works after the conflict' '
  50        git merge --abort
  51'
  52
  53test_expect_success 'is aborted properly' '
  54        git status --porcelain -- modify_delete >out &&
  55        test_cmp empty out &&
  56        test_path_is_missing modify_delete
  57'
  58
  59test_done