blob: fba6deb290ea82ab8ed05a6567b1d037cb73b575 [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
32safe_run remove_worktree $llvm_repo_dir/../clang-tools-extra
33safe_run remove_worktree $llvm_repo_dir/../compiler-rt
34safe_run remove_worktree $llvm_repo_dir/../lld
35safe_run remove_worktree $llvm_repo_dir/../libcxx
36safe_run remove_worktree $llvm_repo_dir/../libcxxabi
37safe_run remove_worktree $llvm_repo_dir/../libunwind
38safe_run remove_worktree $llvm_repo_dir/../lldb
39safe_run remove_worktree $llvm_repo_dir/../test-suite
40
41# Clean up build directories too
42env_root_dir=`readlink -m $llvm_worktree_dir/../`
43echo "Removing everything in $env_root_dir"
44safe_run rm -rf $env_root_dir