X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?a=blobdiff_plain;f=tg.sh;h=9082d88910569af146dde388332bedd0b555ffc1;hb=7fc96160f2d30e75194eb3d8958a4f910a101735;hp=caf7d2836cc1db2e0269415aa224b3377c01d38c;hpb=719000ce93601cb2608b761df4cf172fad4c68c7;p=topgit.git diff --git a/tg.sh b/tg.sh index caf7d28..9082d88 100644 --- a/tg.sh +++ b/tg.sh @@ -290,9 +290,17 @@ branch_empty() [ "$(pretty_tree "$1" -b)" = "$(pretty_tree "$1" ${2-})" ] } -# list_deps +# list_deps [-i | -w] +# -i/-w apply only to HEAD list_deps() { + local head + local head_from + local from + head_from=${1-} + head="$(git symbolic-ref -q HEAD)" || + head="..detached.." + git for-each-ref refs/top-bases | while read rev type ref; do name="${ref#refs/top-bases/}" @@ -300,7 +308,10 @@ list_deps() continue; fi - git cat-file blob "$name:.topdeps" | while read dep; do + from=$head_from + [ "refs/heads/$name" = "$head" ] || + from= + cat_file "$name:.topdeps" $from | while read dep; do dep_is_tgish=true ref_exists "refs/top-bases/$dep" || dep_is_tgish=false