blob: c68530acbb51d6c13d4bbf9eb8ed98d84f796ab7 [file] [log] [blame]
Diana Picus72189fd2016-05-23 19:32:46 +03001#!/usr/bin/env bash
2
3# This script removes a worktree environment for LLVM and all other projects:
4# * it removes all the worktrees and corresponding build directories
5# * it runs git worktree prune in all the repos
6# * it DOES NOT remove the corresponding branch
7
8. llvm-common
9
10if [ "$1" = "" -o "$2" = "" ]; then
11 echo "Usage: $0 <llvm-repo-dir> <llvm-worktree-dir>"
12 exit 1
13fi
14
15llvm_repo_dir=$1
16llvm_worktree_dir=$2
17
18if [ ! -d $llvm_repo_dir ]; then
19 echo "Couldn't find llvm repo in $llvm_repo_dir"
20 exit 1
21fi
22
23if [ ! -d $llvm_worktree_dir ]; then
24 echo "Couldn't find llvm worktree in $llvm_worktree_dir"
25 exit 1
26fi
27
28# Clean up the worktrees (if we remove the LLVM worktree dir, all the other
29# worktrees are removed too, so we only need to prune the repos)
30safe_run remove_worktree $llvm_repo_dir $llvm_worktree_dir
31safe_run remove_worktree $llvm_repo_dir/../clang
Diana Picus72189fd2016-05-23 19:32:46 +030032safe_run remove_worktree $llvm_repo_dir/../compiler-rt
33safe_run remove_worktree $llvm_repo_dir/../lld
34safe_run remove_worktree $llvm_repo_dir/../libcxx
35safe_run remove_worktree $llvm_repo_dir/../libcxxabi
36safe_run remove_worktree $llvm_repo_dir/../libunwind
37safe_run remove_worktree $llvm_repo_dir/../lldb
38safe_run remove_worktree $llvm_repo_dir/../test-suite
39
40# Clean up build directories too
41env_root_dir=`readlink -m $llvm_worktree_dir/../`
42echo "Removing everything in $env_root_dir"
43safe_run rm -rf $env_root_dir