From 0a8706b3269a0fbeadd07ad87bc31a73ac54c519 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Tue, 4 Aug 2020 18:20:27 +0300 Subject: [PATCH] Feat(fix-detached-head): Get branch from superproject Get the branch from the superproject's `.gitmodules`. --- detached-head/fix-detached-head | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/detached-head/fix-detached-head b/detached-head/fix-detached-head index 7be050a..bb75941 100755 --- a/detached-head/fix-detached-head +++ b/detached-head/fix-detached-head @@ -6,6 +6,11 @@ pwd declare -a branches branches=(`git branch --points-at=HEAD | tail -n +2`) + +if [ "${#branches[*]}" -eq 0 ]; then + branches=(`git config -f $toplevel/.gitmodules --get submodule.$name.branch`) +fi + if [ "${#branches[*]}" -eq 0 ]; then branches=(`git branch --points-at=HEAD -r | sed 's!^ *origin/!!'`) fi -- 2.39.5