t / t7414-submodule-mistakes.shon commit t4208: abstract away SHA-1-specific constants (0b2c4af)
   1#!/bin/sh
   2
   3test_description='handling of common mistakes people may make with submodules'
   4. ./test-lib.sh
   5
   6test_expect_success 'create embedded repository' '
   7        git init embed &&
   8        test_commit -C embed one
   9'
  10
  11test_expect_success 'git-add on embedded repository warns' '
  12        test_when_finished "git rm --cached -f embed" &&
  13        git add embed 2>stderr &&
  14        test_i18ngrep warning stderr
  15'
  16
  17test_expect_success '--no-warn-embedded-repo suppresses warning' '
  18        test_when_finished "git rm --cached -f embed" &&
  19        git add --no-warn-embedded-repo embed 2>stderr &&
  20        test_i18ngrep ! warning stderr
  21'
  22
  23test_expect_success 'no warning when updating entry' '
  24        test_when_finished "git rm --cached -f embed" &&
  25        git add embed &&
  26        git -C embed commit --allow-empty -m two &&
  27        git add embed 2>stderr &&
  28        test_i18ngrep ! warning stderr
  29'
  30
  31test_expect_success 'submodule add does not warn' '
  32        test_when_finished "git rm -rf submodule .gitmodules" &&
  33        git submodule add ./embed submodule 2>stderr &&
  34        test_i18ngrep ! warning stderr
  35'
  36
  37test_done