summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2017-03-27 10:59:27 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2017-03-27 10:59:28 -0700
commit844768a29864cac01d55463a8858457f4908d91e (patch)
tree162616606279e87603e772c02f1dbcf877bf999f /t
parentMerge branch 'sb/push-options-via-transport' (diff)
parentbuiltin/describe: introduce --broken flag (diff)
downloadtgif-844768a29864cac01d55463a8858457f4908d91e.tar.xz
Merge branch 'sb/describe-broken'
"git describe --dirty" dies when it cannot be determined if the state in the working tree matches that of HEAD (e.g. broken repository or broken submodule). The command learned a new option "git describe --broken" to give "$name-broken" (where $name is the description of HEAD) in such a case. * sb/describe-broken: builtin/describe: introduce --broken flag
Diffstat (limited to 't')
-rwxr-xr-xt/t6120-describe.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 167491fd5b..16952e44fc 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -233,4 +233,24 @@ test_expect_success 'describe --contains and --no-match' '
test_cmp expect actual
'
+test_expect_success 'setup and absorb a submodule' '
+ test_create_repo sub1 &&
+ test_commit -C sub1 initial &&
+ git submodule add ./sub1 &&
+ git submodule absorbgitdirs &&
+ git commit -a -m "add submodule" &&
+ git describe --dirty >expect &&
+ git describe --broken >out &&
+ test_cmp expect out
+'
+
+test_expect_success 'describe chokes on severly broken submodules' '
+ mv .git/modules/sub1/ .git/modules/sub_moved &&
+ test_must_fail git describe --dirty
+'
+test_expect_success 'describe ignoring a borken submodule' '
+ git describe --broken >out &&
+ grep broken out
+'
+
test_done