diff --git a/.github/screenshot.png b/.github/screenshot.png new file mode 100644 index 0000000..72c4658 Binary files /dev/null and b/.github/screenshot.png differ diff --git a/.github/workflows/Build_VIPM_Library.yml b/.github/workflows/CI.yml similarity index 52% rename from .github/workflows/Build_VIPM_Library.yml rename to .github/workflows/CI.yml index 60db204..6712891 100644 --- a/.github/workflows/Build_VIPM_Library.yml +++ b/.github/workflows/CI.yml @@ -1,10 +1,8 @@ -# This is a basic workflow to help you get started with Actions - -name: Build_VIPM_Library +name: CI # Controls when the workflow will run on: - # Triggers the workflow on push or pull request events but only for the main branch + # Triggers the workflow on pull request merged to main pull_request: branches: - main @@ -17,31 +15,61 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: -# A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - # This workflow contains a single job called "build" - Build_VIPM_Library: - # The type of runner that the job will run on + # Step 1: Check for broken VIs + Check_Broken_VIs: runs-on: [self-hosted, lv2017] - - # Steps represent a sequence of tasks that will be executed as part of the job steps: + - uses: actions/checkout@v4 + + - name: vipm-InstallPackage + uses: NEVSTOP-LAB/vipm-InstallPackage@main + with: + LabVIEW_Version: 2017 + Package: "Git API" + + - id: Check_Broken_VIs + continue-on-error: true + uses: LV-APT/lvCICD@main + with: + LabVIEW_Version: 2017 + Operation: VIAn_CheckBrokenVIs + Parameter1: ${{ github.workspace }} + Parameter2: NOPASSWORD + Parameter3: YES + + - name: Upload VI Analyzer Result + if: always() + uses: actions/upload-artifact@v4 + with: + name: VIAn_CheckBrokenVIs_Result + path: ${{ steps.Check_Broken_VIs.outputs.Result }} + if-no-files-found: warn + retention-days: 7 + - name: Fail if broken VIs found + if: steps.Check_Broken_VIs.outcome == 'failure' + run: | + Write-Error "Broken VIs detected! Download the 'VIAn_CheckBrokenVIs_Result' artifact for details." + exit 1 + shell: powershell + + # Step 2: Build VIPM library (only if broken VI check passes) + Build_VIPM_Library: + needs: Check_Broken_VIs + runs-on: [self-hosted, lv2017] + steps: # Get env variables - # https://github.com/marketplace/actions/github-environment-variables-action - uses: FranzDiebold/github-env-vars-action@v2 - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: vipm-InstallPackage uses: NEVSTOP-LAB/vipm-InstallPackage@main with: LabVIEW_Version: 2017 - # Package could be PackageName/PacakgeWithVersion/vipFilePath Package: "Git API" - # Runs a set of commands using the runners shell - name: BuildDailyVIP id: build-vip uses: LV-APT/lvCICD@main @@ -52,23 +80,20 @@ jobs: Parameter2: NO - id: vip-name - run: - $vipName=Split-Path -Path ${{ steps.build-vip.outputs.Result }} -Leaf; - Write-Host "::set-output name=vipName::"$vipName"" + run: | + $vipName=Split-Path -Path ${{ steps.build-vip.outputs.Result }} -Leaf + "vipName=$vipName" >> $env:GITHUB_OUTPUT shell: powershell - name: Upload a Build Artifact - uses: actions/upload-artifact@v3.0.0 + uses: actions/upload-artifact@v4 with: - # Artifact name name: ${{ steps.vip-name.outputs.vipName }} path: ${{ steps.build-vip.outputs.Result }} - # The desired behavior if no files are found using the provided path. if-no-files-found: warn retention-days: 90 # Backup generated files by ftp - # https://github.com/marketplace/actions/simple-ftp-upload - name: backup Build Artifact by ftp uses: dennisameling/ftp-upload-action@v1.0.9 with: @@ -78,4 +103,4 @@ jobs: password: ${{ secrets.VIPM_FTP_PASSWORD }} secure: false server_dir: /${{ env.CI_REPOSITORY_OWNER_SLUG }}/${{ env.CI_REPOSITORY_NAME }}/${{ env.CI_ACTION_REF_NAME }}/ - local_dir: ./vip/ \ No newline at end of file + local_dir: ./vip/ diff --git a/.github/workflows/Check_Broken_VIs.yml b/.github/workflows/Check_Broken_VIs.yml deleted file mode 100644 index 92ef5bc..0000000 --- a/.github/workflows/Check_Broken_VIs.yml +++ /dev/null @@ -1,38 +0,0 @@ -# This is a basic workflow to help you get started with Actions - -name: Check_Broken_VIs - -# Controls when the workflow will run -on: - # Triggers the workflow on push or pull request events but only for the main branch - push: - -# A workflow run is made up of one or more jobs that can run sequentially or in parallel -jobs: - # This workflow contains a single job called "build" - Check_Broken_VIs: - # The type of runner that the job will run on - runs-on: [self-hosted, lv2017] - - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - uses: actions/checkout@v3 - - - - name: vipm-InstallPackage - uses: NEVSTOP-LAB/vipm-InstallPackage@main - with: - LabVIEW_Version: 2017 - # Package could be PackageName/PacakgeWithVersion/vipFilePath - Package: "Git API" - - # Runs a set of commands using the runners shell - - id: Check_Broken_VIs - uses: LV-APT/lvCICD@main - with: - LabVIEW_Version: 2017 - Operation: VIAn_CheckBrokenVIs - Parameter1: ${{ github.workspace }} - Parameter2: NOPASSWORD - Parameter3: YES diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..842f11a --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,48 @@ +# AGENTS.md — SimpleGit-Provider + +## CMD 脚本编写提醒 + +### 1. `cmd /c` 引号剥离陷阱 + +`cmd /c "script.cmd" "arg"` — 当 `/c` 后面的字符串以 `"` 开头时,cmd 会剥离**整个字符串的首尾 `"`**,导致内部引号错乱。`/S` 标志无法避免此行为。 + +**正确调用方式(二选一):** + +```cmd +:: 方案 A — 使用 call(最健壮,脚本路径可含空格) +cmd /c call "script.cmd" "arg with spaces" + +:: 方案 B — 脚本路径不加外层引号(仅当路径无空格) +cmd /c script.cmd "arg with spaces" +``` + +原理:`call` 首字符是 `c`,不触发首尾引号剥离。 + +### 2. 异步启动 VS Code + +`start "" "path\to\Code.exe" %*` 是最简可靠的异步启动方式。`%*` 在 `start` 命令行上**原生保留原始引号边界**,含空格的路径如 `"D:\1 2 3"` 会被正确传递。 + +### 3. 避免的写法 + +| 问题写法 | 原因 | +|----------|------| +| `setlocal EnableDelayedExpansion` + `start` | 在 LabVIEW 调起的 cmd 下可能触发"内存资源不足" | +| `for /f` + `reg query` + 管道(`^\|`) | 受限环境下转义不稳定 | +| `set VAR=%*` 后传入 PowerShell | `set` 对含内嵌双引号的值处理不可靠 | +| `%*` 直接拼入 `powershell -Command "..."` | cmd 层引用与 PS 层引用冲突 | +| `shift` + `goto` 循环收集参数 | 某些调用方下可能死循环 | + +### 4. VS Code 检测顺序 + +1. `if exist` 检查标准安装路径(零外部命令,优先): + - `%LOCALAPPDATA%\Programs\Microsoft VS Code\Code.exe`(用户安装,64-bit) + - `%ProgramW6432%\Microsoft VS Code\Code.exe`(系统安装,64-bit,WOW64 安全) + - `%ProgramFiles%\Microsoft VS Code\Code.exe` + - `%ProgramFiles(x86)%\Microsoft VS Code\Code.exe` +2. `where code` 仅作后备(外部命令,PATH 极大时可能耗时) + +### 5. 脚本设计原则 + +- **极简优先**:零 `setlocal`、零循环、零外部命令 +- **找到即退出**:每个分支 `start` + `exit`,不攒变量 +- **不依赖注册表**:`if exist` 覆盖所有标准安装路径即可 diff --git a/GProviders/SimpleGit-config.ini b/GProviders/SimpleGit-config.ini new file mode 100644 index 0000000..e69de29 diff --git a/README.md b/README.md index c689fe3..ee9be69 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ # SimpleGit-Provider -Simple git provider for LVAPT daily workflow. Windows of Tortoisegit will be used if it's installed. +1. Simple git provider for LVAPT daily workflow. Windows of Tortoisegit will be used if it's installed. +2. Provide an entry for "Open in VSCode" in the context menu of the project explorer. - + ## Dependence - Git API -- OpenG Libraries - [Tortoisegit](https://tortoisegit.org/) - [Automating TortoiseGit](https://tortoisegit.org/docs/tortoisegit/tgit-automation.html#tgit-automation-basics) diff --git a/SimpleGit-Provider.lvproj b/SimpleGit-Provider.lvproj index 64609d9..869b0c8 100644 --- a/SimpleGit-Provider.lvproj +++ b/SimpleGit-Provider.lvproj @@ -1,6 +1,7 @@  - false + 17.0 + true 201310 @@ -21,6 +22,9 @@ true true false + + true + @@ -30,6 +34,7 @@ + @@ -55,15 +60,6 @@ - - - - - - - - - @@ -119,7 +115,6 @@ - diff --git a/SimpleGit-Provider.vipb b/SimpleGit-Provider.vipb index 04388c0..fadad8e 100644 --- a/SimpleGit-Provider.vipb +++ b/SimpleGit-Provider.vipb @@ -1,7 +1,7 @@ - + SimpleGit_Provider - 2024.4.0.7 + 2026.6.0.7 false . vip @@ -18,9 +18,6 @@ hse_lib_git_api >=2.1.0.98 - oglib_appcontrol >=4.0.0.5 - oglib_comparison >=4.0.0.3 - oglib_string >=4.0.0.6 @@ -194,6 +191,7 @@ false false false + false true diff --git a/SimpleGit/Git/Command/SimpleGit-Commit.vi b/SimpleGit/Git/Command/SimpleGit-Commit.vi index fa65ed7..0f96b03 100644 Binary files a/SimpleGit/Git/Command/SimpleGit-Commit.vi and b/SimpleGit/Git/Command/SimpleGit-Commit.vi differ diff --git a/SimpleGit/Git/Command/SimpleGit-LeaveDailyBranch.vi b/SimpleGit/Git/Command/SimpleGit-LeaveDailyBranch.vi index 5c59559..985a0e4 100644 Binary files a/SimpleGit/Git/Command/SimpleGit-LeaveDailyBranch.vi and b/SimpleGit/Git/Command/SimpleGit-LeaveDailyBranch.vi differ diff --git a/SimpleGit/Git/Command/SimpleGit-Pull.vi b/SimpleGit/Git/Command/SimpleGit-Pull.vi index a71a3d2..a204a2e 100644 Binary files a/SimpleGit/Git/Command/SimpleGit-Pull.vi and b/SimpleGit/Git/Command/SimpleGit-Pull.vi differ diff --git a/SimpleGit/Git/Command/SimpleGit-Push.vi b/SimpleGit/Git/Command/SimpleGit-Push.vi index 4e2906d..02611c5 100644 Binary files a/SimpleGit/Git/Command/SimpleGit-Push.vi and b/SimpleGit/Git/Command/SimpleGit-Push.vi differ diff --git a/SimpleGit/Git/Command/SimpleGit-Settings.vi b/SimpleGit/Git/Command/SimpleGit-Settings.vi index f2515b4..8a1bc7c 100644 Binary files a/SimpleGit/Git/Command/SimpleGit-Settings.vi and b/SimpleGit/Git/Command/SimpleGit-Settings.vi differ diff --git a/SimpleGit/Git/Command/SimpleGit-Status.vi b/SimpleGit/Git/Command/SimpleGit-Status.vi index 36bd0cf..94b398b 100644 Binary files a/SimpleGit/Git/Command/SimpleGit-Status.vi and b/SimpleGit/Git/Command/SimpleGit-Status.vi differ diff --git a/SimpleGit/Git/Command/SimpleGit-SwitchToDailyBranch.vi b/SimpleGit/Git/Command/SimpleGit-SwitchToDailyBranch.vi index cac75a7..128c88b 100644 Binary files a/SimpleGit/Git/Command/SimpleGit-SwitchToDailyBranch.vi and b/SimpleGit/Git/Command/SimpleGit-SwitchToDailyBranch.vi differ diff --git a/SimpleGit/Git/SimpleGit_Item_OnCommand.vi b/SimpleGit/Git/SimpleGit_Item_OnCommand.vi index f152534..78755f5 100644 Binary files a/SimpleGit/Git/SimpleGit_Item_OnCommand.vi and b/SimpleGit/Git/SimpleGit_Item_OnCommand.vi differ diff --git a/SimpleGit/Git/SimpleGit_Item_OnPopupMenu.vi b/SimpleGit/Git/SimpleGit_Item_OnPopupMenu.vi index aced5a0..4678a5d 100644 Binary files a/SimpleGit/Git/SimpleGit_Item_OnPopupMenu.vi and b/SimpleGit/Git/SimpleGit_Item_OnPopupMenu.vi differ diff --git a/SimpleGit/Git/SimpleGit_Item_OnUpdateCommand.vi b/SimpleGit/Git/SimpleGit_Item_OnUpdateCommand.vi index 04fee6a..5ebaa5a 100644 Binary files a/SimpleGit/Git/SimpleGit_Item_OnUpdateCommand.vi and b/SimpleGit/Git/SimpleGit_Item_OnUpdateCommand.vi differ diff --git a/SimpleGit/Git/SimpleGit_Menu_Hierachy.vi b/SimpleGit/Git/SimpleGit_Menu_Hierachy.vi index 2ec7736..7404fdb 100644 Binary files a/SimpleGit/Git/SimpleGit_Menu_Hierachy.vi and b/SimpleGit/Git/SimpleGit_Menu_Hierachy.vi differ diff --git a/SimpleGit/Git/SimpleGit_OnCommand(SingleObject).vi b/SimpleGit/Git/SimpleGit_OnCommand(SingleObject).vi index ecbffbf..db9f6e9 100644 Binary files a/SimpleGit/Git/SimpleGit_OnCommand(SingleObject).vi and b/SimpleGit/Git/SimpleGit_OnCommand(SingleObject).vi differ diff --git a/SimpleGit/Git/_Support/Close Caller FP if In LabVIEW folder.vi b/SimpleGit/Git/_Support/Close Caller FP if In LabVIEW folder.vi index 3e00f85..9a25774 100644 Binary files a/SimpleGit/Git/_Support/Close Caller FP if In LabVIEW folder.vi and b/SimpleGit/Git/_Support/Close Caller FP if In LabVIEW folder.vi differ diff --git a/SimpleGit/Git/_Support/DailyPatchBranchName.vi b/SimpleGit/Git/_Support/DailyPatchBranchName.vi index d72394a..2595112 100644 Binary files a/SimpleGit/Git/_Support/DailyPatchBranchName.vi and b/SimpleGit/Git/_Support/DailyPatchBranchName.vi differ diff --git a/SimpleGit/Git/_Support/GIT-Current Local Branches.vi b/SimpleGit/Git/_Support/GIT-Current Local Branches.vi index 70a8eaa..38921e8 100644 Binary files a/SimpleGit/Git/_Support/GIT-Current Local Branches.vi and b/SimpleGit/Git/_Support/GIT-Current Local Branches.vi differ diff --git a/SimpleGit/Git/_Support/Git Check whether Branch exists.vi b/SimpleGit/Git/_Support/Git Check whether Branch exists.vi index 71546f3..e6699f3 100644 Binary files a/SimpleGit/Git/_Support/Git Check whether Branch exists.vi and b/SimpleGit/Git/_Support/Git Check whether Branch exists.vi differ diff --git a/SimpleGit/Git/_Support/SimpleGit Setting Dialog.vi b/SimpleGit/Git/_Support/SimpleGit Setting Dialog.vi index b5baa24..7dc8cc7 100644 Binary files a/SimpleGit/Git/_Support/SimpleGit Setting Dialog.vi and b/SimpleGit/Git/_Support/SimpleGit Setting Dialog.vi differ diff --git a/SimpleGit/Git/_Support/config/simplegit.DailyBranchPrefix.vi b/SimpleGit/Git/_Support/config/simplegit.DailyBranchPrefix.vi index 7cc7b8e..de2d269 100644 Binary files a/SimpleGit/Git/_Support/config/simplegit.DailyBranchPrefix.vi and b/SimpleGit/Git/_Support/config/simplegit.DailyBranchPrefix.vi differ diff --git a/SimpleGit/Git/_Support/config/simplegit.TortoiseGitProc.vi b/SimpleGit/Git/_Support/config/simplegit.TortoiseGitProc.vi index b88ffb6..eb81a7a 100644 Binary files a/SimpleGit/Git/_Support/config/simplegit.TortoiseGitProc.vi and b/SimpleGit/Git/_Support/config/simplegit.TortoiseGitProc.vi differ diff --git a/SimpleGit/Git/_Support/lvgit commit.vi b/SimpleGit/Git/_Support/lvgit commit.vi index 31264b9..ec4d67d 100644 Binary files a/SimpleGit/Git/_Support/lvgit commit.vi and b/SimpleGit/Git/_Support/lvgit commit.vi differ diff --git a/SimpleGit/Git/_Support/lvgit pull.vi b/SimpleGit/Git/_Support/lvgit pull.vi index 774c9ed..57f0e10 100644 Binary files a/SimpleGit/Git/_Support/lvgit pull.vi and b/SimpleGit/Git/_Support/lvgit pull.vi differ diff --git a/SimpleGit/Git/_Support/lvgit push.vi b/SimpleGit/Git/_Support/lvgit push.vi index 3900ca6..8250b75 100644 Binary files a/SimpleGit/Git/_Support/lvgit push.vi and b/SimpleGit/Git/_Support/lvgit push.vi differ diff --git a/SimpleGit/Git/_Support/lvgit status.vi b/SimpleGit/Git/_Support/lvgit status.vi index 4f564d0..6997462 100644 Binary files a/SimpleGit/Git/_Support/lvgit status.vi and b/SimpleGit/Git/_Support/lvgit status.vi differ diff --git a/SimpleGit/Git/_Support/menu-Operations.llb b/SimpleGit/Git/_Support/menu-Operations.llb deleted file mode 100644 index 603cfe2..0000000 Binary files a/SimpleGit/Git/_Support/menu-Operations.llb and /dev/null differ diff --git a/SimpleGit/Git/_Support/menu-Operations/menu-AddMenuGroups.vi b/SimpleGit/Git/_Support/menu-Operations/menu-AddMenuGroups.vi new file mode 100644 index 0000000..3750794 Binary files /dev/null and b/SimpleGit/Git/_Support/menu-Operations/menu-AddMenuGroups.vi differ diff --git a/SimpleGit/Git/_Support/menu-Operations/menu-ChangeLocation.vi b/SimpleGit/Git/_Support/menu-Operations/menu-ChangeLocation.vi new file mode 100644 index 0000000..76a9f7d Binary files /dev/null and b/SimpleGit/Git/_Support/menu-Operations/menu-ChangeLocation.vi differ diff --git a/SimpleGit/Git/_Support/menu-Operations/menu-InterleaveSeperators.vi b/SimpleGit/Git/_Support/menu-Operations/menu-InterleaveSeperators.vi new file mode 100644 index 0000000..f27b560 Binary files /dev/null and b/SimpleGit/Git/_Support/menu-Operations/menu-InterleaveSeperators.vi differ diff --git a/SimpleGit/Git/_Support/menu-Operations/menu-ReplaceDotToSlash.vi b/SimpleGit/Git/_Support/menu-Operations/menu-ReplaceDotToSlash.vi new file mode 100644 index 0000000..2c33aa8 Binary files /dev/null and b/SimpleGit/Git/_Support/menu-Operations/menu-ReplaceDotToSlash.vi differ diff --git a/SimpleGit/Git/_Support/menu-Operations/menu-ReplaceSeperatorWith---.vi b/SimpleGit/Git/_Support/menu-Operations/menu-ReplaceSeperatorWith---.vi new file mode 100644 index 0000000..56cb24c Binary files /dev/null and b/SimpleGit/Git/_Support/menu-Operations/menu-ReplaceSeperatorWith---.vi differ diff --git a/SimpleGit/Git/_Support/menu-Operations/menu-SetWeights.vi b/SimpleGit/Git/_Support/menu-Operations/menu-SetWeights.vi new file mode 100644 index 0000000..34fe1d4 Binary files /dev/null and b/SimpleGit/Git/_Support/menu-Operations/menu-SetWeights.vi differ diff --git a/SimpleGit/Git/_Support/menu-Operations/menu-operation.lvlib b/SimpleGit/Git/_Support/menu-Operations/menu-operation.lvlib new file mode 100644 index 0000000..63a868b --- /dev/null +++ b/SimpleGit/Git/_Support/menu-Operations/menu-operation.lvlib @@ -0,0 +1,12 @@ + + + &Q#!!!!!!!)!"1!&!!!-!%!!!@````]!!!!"!!%!!!(]!!!*Q(C=\>8"=>MQ%!8143;(8.6"2CVM#WJ",7Q,SN&(N<!NK!7VM#WI"<8A0$%94UZ2$P%E"Y.?G@I%A7=11U>M\7P%FXB^VL\`NHV=@X<^39O0^N(_<8NZOEH@@=^_CM?,3)VK63LD->8LS%=_]J'0@/1N<XH,7^\SFJ?]Z#5P?=F,HP+5JTTF+5`Z>MB$(P+1)YX*RU2DU$(![)Q3YW.YBG>YBM@8'*\B':\B'2Z>9HC':XC':XD=&M-T0--T0-.DK%USWS(H'2\$2`-U4`-U4`/9-JKH!>JE<?!W#%;UC_WE?:KH?:R']T20]T20]\A=T>-]T>-]T?/7<66[UTQ//9^BIHC+JXC+JXA-(=640-640-6DOCC?YCG)-G%:(#(+4;6$_6)]R?.8&%`R&%`R&)^,WR/K<75?GM=BZUG?Z%G?Z%E?1U4S*%`S*%`S'$;3*XG3*XG3RV320-G40!G3*D6^J-(3D;F4#J,(T\:<=HN+P5FS/S,7ZIWV+7.NNFC<+.<GC0819TX-7!]JVO,(7N29CR6L%7,^=<(1M4#R*IFV][.DX(X?V&6>V&G>V&%>V&\N(L@_Z9\X_TVONVN=L^?Y8#ZR0J`D>$L&]8C-Q_%1_`U_>LP>WWPAG_0NB@$TP@4C`%`KH@[8`A@PRPA=PYZLD8Y!#/7SO!!!!!! + 1.0.0.0 + true + + + + + + + diff --git a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit Exists.vi b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit Exists.vi index 4fc4bb6..615b686 100644 Binary files a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit Exists.vi and b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit Exists.vi differ diff --git a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit commit.vi b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit commit.vi index 7d1a712..70e5430 100644 Binary files a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit commit.vi and b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit commit.vi differ diff --git a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit pull.vi b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit pull.vi index 701e859..852015a 100644 Binary files a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit pull.vi and b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit pull.vi differ diff --git a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit push.vi b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit push.vi index 4f72405..8ed59b4 100644 Binary files a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit push.vi and b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit push.vi differ diff --git a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit status.vi b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit status.vi index 3b3c75b..43d574d 100644 Binary files a/SimpleGit/Git/_Support/tortoisegit/Tortoisegit status.vi and b/SimpleGit/Git/_Support/tortoisegit/Tortoisegit status.vi differ diff --git a/SimpleGit/Git/_Support/tortoisegit/Tortoisegitproc default path.vi b/SimpleGit/Git/_Support/tortoisegit/Tortoisegitproc default path.vi index bfd4de8..26734a0 100644 Binary files a/SimpleGit/Git/_Support/tortoisegit/Tortoisegitproc default path.vi and b/SimpleGit/Git/_Support/tortoisegit/Tortoisegitproc default path.vi differ diff --git a/SimpleGit/Git/_scripts/Check_if_totoisegit_installed.cmd b/SimpleGit/Git/_scripts/Check_if_totoisegit_installed.cmd new file mode 100644 index 0000000..32409f4 --- /dev/null +++ b/SimpleGit/Git/_scripts/Check_if_totoisegit_installed.cmd @@ -0,0 +1,117 @@ +@echo off + +rem ============================================================================ +rem Check_if_totoisegit_installed.cmd +rem --------------------------------------------------------------------------- +rem Detect whether Git and/or TortoiseGit are installed on this machine. +rem +rem Usage: +rem Check_if_totoisegit_installed.cmd Check BOTH (Git + TortoiseGit) +rem Check_if_totoisegit_installed.cmd git Check Git only +rem Check_if_totoisegit_installed.cmd tortoisegit Check TortoiseGit only +rem +rem Output (stdout): TRUE -> installed +rem FALSE -> not installed +rem Exit code: 0 = TRUE (installed) 1 = FALSE (not installed) +rem ============================================================================ + +set "target=%~1" +if "%target%"=="" set "target=all" + +set "GIT=FALSE" +set "TGIT=FALSE" + +call :CheckGit +call :CheckTortoiseGit + +set "RESULT=FALSE" +if /i "%target%"=="git" set "RESULT=%GIT%" +if /i "%target%"=="tortoisegit" set "RESULT=%TGIT%" +if /i "%target%"=="tgit" set "RESULT=%TGIT%" +if /i "%target%"=="all" ( + if "%GIT%"=="TRUE" if "%TGIT%"=="TRUE" set "RESULT=TRUE" +) + +echo %RESULT% + +if "%RESULT%"=="TRUE" (exit /b 0) else (exit /b 1) + + +rem --------------------------------------------------------------------------- +rem :CheckGit -> sets GIT=TRUE when Git is found +rem --------------------------------------------------------------------------- +:CheckGit +rem 1) git.exe available on PATH +where git >nul 2>&1 +if not errorlevel 1 ( + set "GIT=TRUE" + goto :eof +) +rem 2) Git for Windows registry keys (64-bit view) +reg query "HKLM\SOFTWARE\GitForWindows" /v InstallPath >nul 2>&1 +if not errorlevel 1 ( + set "GIT=TRUE" + goto :eof +) +rem 2b) Git for Windows registry keys (32-bit view on 64-bit OS) +reg query "HKLM\SOFTWARE\WOW6432Node\GitForWindows" /v InstallPath >nul 2>&1 +if not errorlevel 1 ( + set "GIT=TRUE" + goto :eof +) +rem 3) Default install locations +if exist "%ProgramFiles%\Git\cmd\git.exe" ( + set "GIT=TRUE" + goto :eof +) +if exist "%ProgramW6432%\Git\cmd\git.exe" ( + set "GIT=TRUE" + goto :eof +) +if exist "%ProgramFiles(x86)%\Git\cmd\git.exe" ( + set "GIT=TRUE" + goto :eof +) +goto :eof + + +rem --------------------------------------------------------------------------- +rem :CheckTortoiseGit -> sets TGIT=TRUE when TortoiseGit is found +rem --------------------------------------------------------------------------- +:CheckTortoiseGit +rem 1) TortoiseGitProc.exe available on PATH +where TortoiseGitProc >nul 2>&1 +if not errorlevel 1 ( + set "TGIT=TRUE" + goto :eof +) +rem 2) TortoiseGit registry keys (ProcPath -> TortoiseGitProc.exe) +reg query "HKLM\SOFTWARE\TortoiseGit" /v ProcPath >nul 2>&1 +if not errorlevel 1 ( + set "TGIT=TRUE" + goto :eof +) +reg query "HKLM\SOFTWARE\WOW6432Node\TortoiseGit" /v ProcPath >nul 2>&1 +if not errorlevel 1 ( + set "TGIT=TRUE" + goto :eof +) +reg query "HKCU\SOFTWARE\TortoiseGit" /v ProcPath >nul 2>&1 +if not errorlevel 1 ( + set "TGIT=TRUE" + goto :eof +) +rem 3) Default install locations +if exist "%ProgramFiles%\TortoiseGit\bin\TortoiseGitProc.exe" ( + set "TGIT=TRUE" + goto :eof +) +if exist "%ProgramW6432%\TortoiseGit\bin\TortoiseGitProc.exe" ( + set "TGIT=TRUE" + goto :eof +) +if exist "%ProgramFiles(x86)%\TortoiseGit\bin\TortoiseGitProc.exe" ( + set "TGIT=TRUE" + goto :eof +) +goto :eof diff --git a/SimpleGit/Git/_scripts/Check_if_vscode_installed.cmd b/SimpleGit/Git/_scripts/Check_if_vscode_installed.cmd new file mode 100644 index 0000000..293f7ea --- /dev/null +++ b/SimpleGit/Git/_scripts/Check_if_vscode_installed.cmd @@ -0,0 +1,45 @@ +@echo off +REM ============================================================ +REM Check_if_vscode_installed.cmd +REM Detects whether Visual Studio Code is installed locally. +REM Works on 32-bit and 64-bit Windows, and whether launched +REM from a 32-bit or 64-bit host (e.g. LabVIEW). +REM +REM Performance: uses a path cache (%TEMP%\sg-vscode.cache) +REM to avoid repeated disk scans. Zero external commands. +REM +REM Output : prints TRUE if VS Code is found +REM prints FALSE if VS Code is not found +REM Exit : 0 = installed (TRUE), 1 = not installed (FALSE) +REM ============================================================ + +REM --- Fast path: cached VS Code location (avoids repeated disk scans) --- +if exist "%TEMP%\sg-vscode.cache" ( + set /p VSCODE=<"%TEMP%\sg-vscode.cache" + if exist "%VSCODE%" ( + echo TRUE + exit /b 0 + ) +) + +REM --- Try standard install locations (pure 'if exist', no external commands) --- +REM 1) User install (most common, 64-bit) +if exist "%LOCALAPPDATA%\Programs\Microsoft VS Code\Code.exe" ( + echo TRUE + exit /b 0 +) +REM 2) System-wide install (64-bit, WOW64-safe via %ProgramW6432%) +if exist "%ProgramW6432%\Microsoft VS Code\Code.exe" ( + echo TRUE + exit /b 0 +) +REM 3) System-wide install (64-bit, %ProgramFiles% differs from %ProgramW6432% only under 32-bit caller) +if not "%ProgramFiles%"=="%ProgramW6432%" ( + if exist "%ProgramFiles%\Microsoft VS Code\Code.exe" ( + echo TRUE + exit /b 0 + ) +) + +echo FALSE +exit /b 1 diff --git a/SimpleGit/Git/_scripts/Open_dir_in_VSCode.cmd b/SimpleGit/Git/_scripts/Open_dir_in_VSCode.cmd new file mode 100644 index 0000000..2045640 --- /dev/null +++ b/SimpleGit/Git/_scripts/Open_dir_in_VSCode.cmd @@ -0,0 +1,52 @@ +@echo off + +REM ============================================================ +REM Open_dir_in_VSCode.cmd +REM Opens paths in VS Code (async, non-blocking). +REM Zero external commands — works even in constrained +REM environments (e.g. LabVIEW System Exec). +REM +REM Performance: uses a path cache (%TEMP%\sg-vscode.cache) +REM to avoid repeated disk scans on frequent invocations. +REM Cache miss fallback: 3 direct 'if exist' checks. +REM +REM Usage: +REM Open_dir_in_VSCode.cmd [path1] [path2] ... +REM Quote paths with spaces: "D:\1 2 3" +REM ============================================================ + +REM --- Fast path: cached VS Code location (avoids repeated disk scans) --- +if exist "%TEMP%\sg-vscode.cache" ( + set /p VSCODE=<"%TEMP%\sg-vscode.cache" + if exist "%VSCODE%" ( + start "" "%VSCODE%" %* + exit /b 0 + ) + REM Cache stale — delete and fall through to full scan + del "%TEMP%\sg-vscode.cache" >nul 2>&1 +) + +REM --- Try standard install locations (pure 'if exist', no external commands) --- +REM 1) User install (most common, 64-bit) +if exist "%LOCALAPPDATA%\Programs\Microsoft VS Code\Code.exe" ( + >"%TEMP%\sg-vscode.cache" echo %LOCALAPPDATA%\Programs\Microsoft VS Code\Code.exe + start "" "%LOCALAPPDATA%\Programs\Microsoft VS Code\Code.exe" %* + exit /b 0 +) +REM 2) System-wide install (64-bit, WOW64-safe via %ProgramW6432%) +if exist "%ProgramW6432%\Microsoft VS Code\Code.exe" ( + >"%TEMP%\sg-vscode.cache" echo %ProgramW6432%\Microsoft VS Code\Code.exe + start "" "%ProgramW6432%\Microsoft VS Code\Code.exe" %* + exit /b 0 +) +REM 3) System-wide install (64-bit, %ProgramFiles% differs from %ProgramW6432% only under 32-bit caller) +if not "%ProgramFiles%"=="%ProgramW6432%" ( + if exist "%ProgramFiles%\Microsoft VS Code\Code.exe" ( + >"%TEMP%\sg-vscode.cache" echo %ProgramFiles%\Microsoft VS Code\Code.exe + start "" "%ProgramFiles%\Microsoft VS Code\Code.exe" %* + exit /b 0 + ) +) + +echo ERROR: Visual Studio Code could not be found. +exit /b 1 diff --git a/SimpleGit/Git/_scripts/Run cmd File.vi b/SimpleGit/Git/_scripts/Run cmd File.vi new file mode 100644 index 0000000..83dfc3a Binary files /dev/null and b/SimpleGit/Git/_scripts/Run cmd File.vi differ diff --git a/SimpleGit/SimpleGit_Global_Interface.vi b/SimpleGit/SimpleGit_Global_Interface.vi index a963737..509d9af 100644 Binary files a/SimpleGit/SimpleGit_Global_Interface.vi and b/SimpleGit/SimpleGit_Global_Interface.vi differ diff --git a/SimpleGit/SimpleGit_Item_Interface.vi b/SimpleGit/SimpleGit_Item_Interface.vi index 2597d69..130a1c7 100644 Binary files a/SimpleGit/SimpleGit_Item_Interface.vi and b/SimpleGit/SimpleGit_Item_Interface.vi differ diff --git a/mklink.cmd b/mklink.cmd index a4f6ba8..405eb03 100644 --- a/mklink.cmd +++ b/mklink.cmd @@ -1,8 +1,8 @@ -mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\SimpleGit" "%~dp0SimpleGit" -REM mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\SecondaryProviderExample2" "%~dp0SecondaryProviderExample2" -REM mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\PrimaryProviderExample2" "%~dp0PrimaryProviderExample2" -REM mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\DummyPrimaryProvider" "%~dp0DummyPrimaryProvider" +mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\SimpleGit" "%~dp0SimpleGit" +REM mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\SecondaryProviderExample2" "%~dp0SecondaryProviderExample2" +REM mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\PrimaryProviderExample2" "%~dp0PrimaryProviderExample2" +REM mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\DummyPrimaryProvider" "%~dp0DummyPrimaryProvider" -mklink "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\GProviders\SimpleGit.ini" "%~dp0GProviders\SimpleGit.ini" +mklink "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\GProviders\SimpleGit.ini" "%~dp0GProviders\SimpleGit.ini" pause \ No newline at end of file diff --git a/un-mklink.cmd b/un-mklink.cmd index 4c6d6cf..3515735 100644 --- a/un-mklink.cmd +++ b/un-mklink.cmd @@ -1,14 +1,14 @@ -rmdir "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\LVAPT" -REM mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\SecondaryProviderExample2" "%~dp0SecondaryProviderExample2" -REM mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\PrimaryProviderExample2" "%~dp0PrimaryProviderExample2" -REM mklink /J "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\DummyPrimaryProvider" "%~dp0DummyPrimaryProvider" +rmdir "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\SimpleGit" +del "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\GProviders\SimpleGit.ini" -del "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\GProviders\LVAPT_System.ini" -del "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\GProviders\LVAPT_Document.ini" -del "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\GProviders\LVAPT_VirtualFolder.ini" -del "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\GProviders\LVAPT_Project.ini" -del "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\GProviders\LVAPT_Class.ini" -del "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\GProviders\LVAPT_Git.ini" +REM === 以下为历史记录(原 LVAPT 相关撤销操作,已不再使用) === +REM rmdir "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\LVAPT" +REM del "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\GProviders\LVAPT_System.ini" +REM del "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\GProviders\LVAPT_Document.ini" +REM del "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\GProviders\LVAPT_VirtualFolder.ini" +REM del "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\GProviders\LVAPT_Project.ini" +REM del "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\GProviders\LVAPT_Class.ini" +REM del "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\GProviders\LVAPT_Git.ini" +REM rmdir "C:\Program Files (x86)\National Instruments\LabVIEW 2017\resource\Framework\Providers\Icons\fatcow-hosting" -rmdir "C:\Program Files (x86)\National Instruments\LabVIEW 2019\resource\Framework\Providers\Icons\fatcow-hosting" pause \ No newline at end of file