Skip to content

Commit 2d189d2

Browse files
committed
feat: add Built-in parameters: CURRENT_BRANCH, Fixes sourcegit-scm#1633
1 parent d577e33 commit 2d189d2

File tree

4 files changed

+9
-0
lines changed

4 files changed

+9
-0
lines changed

src/Resources/Locales/en_US.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
${REPO} Repository's path
181181
${DIRNAME} - repository's directory name;
182182
${REMOTE} Selected remote or selected branch's remote
183+
${CURRENT_BRANCH} - current branch;
183184
${BRANCH} Selected branch, without ${REMOTE} part for remote branches
184185
${BRANCH_FRIENDLY_NAME} Friendly name of selected branch, contains ${REMOTE} part for remote branches
185186
${SHA} Selected commit's hash

src/Resources/Locales/zh_CN.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183

184184
${REPO} 仓库路径
185185
${DIRNAME} 仓库文件夹名
186+
${CURRENT_BRANCH} 当前的分支
186187
${REMOTE} 选中的远程仓库或选中分支所属的远程仓库
187188
${BRANCH} 选中的分支,对于远程分支不包含远程名
188189
${BRANCH_FRIENDLY_NAME} 选中的分支,对于远程分支包含远程名

src/Resources/Locales/zh_TW.axaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@
183183

184184
${REPO} 存放庫路徑
185185
${DIRNAME} 存放庫資料夾名
186+
${CURRENT_BRANCH} 當前分支
186187
${REMOTE} 所選的遠端存放庫或所選分支的遠端
187188
${BRANCH} 所選的分支。對於遠端分支,不包含遠端名稱
188189
${BRANCH_FRIENDLY_NAME} 所選的分支。對於遠端分支,不包含遠端名稱

src/ViewModels/ExecuteCustomAction.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ private string PrepareStringByTarget(string org)
180180
{
181181
org = org.Replace("${REPO}", GetWorkdir());
182182
org = org.Replace("${DIRNAME}", GetWorkdirname());
183+
org = org.Replace("${CURRENT_BRANCH}", GetCurrentBranch());
183184

184185
return Target switch
185186
{
@@ -201,6 +202,11 @@ private string GetWorkdirname()
201202
return _repo.FullPath.Replace("\\", "/").Split('/')[^1];
202203
}
203204

205+
private string GetCurrentBranch()
206+
{
207+
return _repo.CurrentBranch?.FriendlyName ?? string.Empty;
208+
}
209+
204210
private void Run(string args)
205211
{
206212
var start = new ProcessStartInfo();

0 commit comments

Comments
 (0)