FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
llama.cpp/scripts/wc2wt.sh at master · rioscode/llama.cpp · GitHub
rioscode
/
llama.cpp
Public
forked from
ggml-org/llama.cpp
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
llama.cpp
/
scripts
/
wc2wt.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
58 lines (45 loc) · 1.4 KB
Breadcrumbs
llama.cpp
/
scripts
/
wc2wt.sh
Copy path
File metadata and controls
executable file
·
58 lines (45 loc) · 1.4 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!
/usr/bin/env bash
#
initialize a new worktree from a branch name:
#
#
- creates a new branch from current HEAD
#
- creates a new worktree in a parent folder, suffixed with the branch name
#
#
sample usage:
#
./scripts/wc2wt.sh gg/new-feature-foo-bar
#
./scripts/wc2wt.sh gg/new-feature-foo-bar opencode
#
./scripts/wc2wt.sh gg/new-feature-foo-bar "cmake -B build && cmake --build build"
#
./scripts/wc2wt.sh gg/new-feature-foo-bar "bash -l"
function
usage()
{
echo
"
usage:
$0
<branch_name> [cmd]
"
exit
1
}
#
check we are in the right directory
if
[[
!
-f
"
scripts/wc2wt.sh
"
]]
;
then
echo
"
error: this script must be run from the root of the repository
"
exit
1
fi
if
[[
$#
-lt
1
||
$#
-gt
2 ]]
;
then
usage
fi
BRANCH=
$1
if
[[
-z
"
$BRANCH
"
]]
;
then
echo
"
error: branch name must not be empty
"
exit
1
fi
dir=
$(
basename
$(
pwd
)
)
#
sanitize branch name for directory name (replace / with -)
dir_suffix=
$(
echo
"
$BRANCH
"
|
tr
'
/
'
'
-
'
)
git worktree add
"
../
$dir
-
$dir_suffix
"
"
$BRANCH
"
||
git worktree add -b
"
$BRANCH
"
"
../
$dir
-
$dir_suffix
"
HEAD
og_path=
$(
pwd
)
wt_path=
$(
cd
"
../
$dir
-
$dir_suffix
"
&&
pwd
)
echo
"
git worktree created in
$wt_path
"
cd
"
$wt_path
"
#
pi agent setup in the worktree
if
[[
-f
"
$og_path
/.pi/SYSTEM.md
"
&&
!
-f
"
.pi/SYSTEM.md
"
]]
;
then
mkdir -p .pi
ln -sfn
"
$og_path
/.pi/SYSTEM.md
"
.pi/SYSTEM.md
fi
if
[[
$#
-eq
2 ]]
;
then
echo
"
executing:
$2
"
eval
"
$2
"
fi
Back
|
FazBrowse Home
|
New Git URL