aboutsummaryrefslogtreecommitdiff
path: root/helpers/llvm-env
diff options
context:
space:
mode:
Diffstat (limited to 'helpers/llvm-env')
-rwxr-xr-xhelpers/llvm-env38
1 files changed, 36 insertions, 2 deletions
diff --git a/helpers/llvm-env b/helpers/llvm-env
index d90c767..c45fb2e 100755
--- a/helpers/llvm-env
+++ b/helpers/llvm-env
@@ -20,14 +20,48 @@ if [ -z "$PS1" ]; then
exit 1
fi
+list_worktrees() {
+ current_worktree=$1
+
+ # FIXME:
+ # Ideally we would just use git for this (I think git 2.7-ish should suffice),
+ # but I'm currently stuck with git 2.5 on my Ubuntu and it seems to me the
+ # rest of the team is on older gits too. Until we all move to a smarter git,
+ # we're going to use the simplest possible implementation that can give us
+ # what we want (the proper way to do this ofc would be to inspect
+ # $GITDIR/worktrees/). This implementation has the disadvantage that it may
+ # give false positives or false negatives if you do naughty things with your
+ # $LLVM_ROOT.
+ pushdq $LLVM_ROOT
+
+ for dir in *; do
+ if [ -d "$dir" -a "$dir" != "repos" -a -d "$dir/llvm" ]; then
+ pushdq $dir/llvm
+ branch=`get_branch`
+ popdq
+
+ if [ "$current_worktree" = $LLVM_ROOT/$dir/llvm ]; then
+ echo "[ Worktree: $dir ($branch) ]"
+ else
+ echo "Wortkree: $dir ($branch)"
+ fi
+ fi
+ done
+
+ popdq
+}
+
if [ "$1" = "" ]; then
if [ -z "$LLVM_SRC" ]; then
- echo "You haven't set up a worktree"
+ list_worktrees
+ echo "You haven't set up an env (LLVM_SRC is empty)"
eval $clean_exit
fi
worktree=`basename $(readlink -m $LLVM_SRC/../)`
- echo $worktree
+
+ list_worktrees $LLVM_SRC
+
eval $clean_exit
elif [ "$1" = "-h" ]; then
echo "Usage: $0 <branch> [-cleanup] [-d]"