Merge branch 'master' into upstream-development

* master:
  Bump peter-evans/create-pull-request from 7 to 8
  Bump actions/upload-artifact from 5 to 6
  Update Dependabot configuration for GitHub Actions
  Add success conditionals to build and package summary steps
  Add missing success conditionals to CodeQL and branches workflows
  Add success conditionals to upload summary and separate test completion step
  Improve pluralization clarity, fix test table headers, and add hash comment
  Refactor artifact summary to use loop and improve pluralization
  Add success conditionals to test summary steps
  Add GITHUB_STEP_SUMMARY to all CI/CD workflows
  Initial plan
  ⬆️ Update dependencies (clink v1.9.5)
  Clean luacheck warning.
  Fix branch name in a newly inited repo.
  Update the git prompt to support repos with git reftables.
  Bump actions/checkout from 5 to 6
  ⬆️ Update dependencies (git-for-windows v2.52.0.windows.1, clink v1.9.2, clink-completions v0.6.7)
This commit is contained in:
Dax T. Games
2026-02-21 22:00:17 -05:00
8 changed files with 364 additions and 31 deletions

View File

@@ -1,11 +1,10 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
version: 2 version: 2
updates: updates:
- package-ecosystem: "github-actions" # See documentation for possible values # Enable version updates for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/" # Location of package manifests directory: "/" # Location of package manifests
schedule: schedule:
interval: "weekly" interval: "weekly"
labels:
- "👆 Dependencies"
- "🔄️ GitHub Actions"

View File

@@ -19,10 +19,25 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job # Steps represent a sequence of tasks that will be executed as part of the job
steps: steps:
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it # Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: with:
fetch-depth: 0 # fetch all history for all branches and tags fetch-depth: 0 # fetch all history for all branches and tags
- name: Summary - Merge operation started
shell: bash
run: |
echo "## 🔀 Update Branches - Workflow Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Merge Operation" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY
echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
echo "| Source Branch | \`master\` |" >> $GITHUB_STEP_SUMMARY
echo "| Target Branch | \`development\` |" >> $GITHUB_STEP_SUMMARY
echo "| Triggered by | @${{ github.actor }} |" >> $GITHUB_STEP_SUMMARY
echo "| Commit | \`${{ github.sha }}\` |" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Runs a single command using the runners shell # Runs a single command using the runners shell
- name: Merge master into development - name: Merge master into development
run: | run: |
@@ -31,3 +46,15 @@ jobs:
git checkout development git checkout development
git merge --no-ff master git merge --no-ff master
git push origin development git push origin development
- name: Summary - Merge completed
if: success()
shell: bash
run: |
echo "### ✅ Merge Successful" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "The \`master\` branch has been successfully merged into \`development\`." >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "**Merge type:** No fast-forward merge" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "> The development branch is now synchronized with the latest changes from master." >> $GITHUB_STEP_SUMMARY

View File

@@ -35,10 +35,25 @@ jobs:
discussions: write discussions: write
steps: steps:
- name: Check out repository code (Action from GitHub) - name: Check out repository code (Action from GitHub)
uses: actions/checkout@v5 uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Summary - Repository checkout
shell: pwsh
run: |
echo "## 📦 Build Cmder - Workflow Summary" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "### Repository Information" >> $env:GITHUB_STEP_SUMMARY
echo "| Property | Value |" >> $env:GITHUB_STEP_SUMMARY
echo "| --- | --- |" >> $env:GITHUB_STEP_SUMMARY
echo "| Repository | \`${{ github.repository }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "| Branch | \`${{ github.ref_name }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "| Commit | \`${{ github.sha }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "| Actor | @${{ github.actor }} |" >> $env:GITHUB_STEP_SUMMARY
echo "| Workflow | \`${{ github.workflow }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
- name: Add MSBuild to PATH - name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v2 uses: microsoft/setup-msbuild@v2
@@ -47,6 +62,15 @@ jobs:
working-directory: scripts working-directory: scripts
run: .\build.ps1 -Compile -verbose -terminal all run: .\build.ps1 -Compile -verbose -terminal all
- name: Summary - Build completed
if: success()
shell: pwsh
run: |
echo "### ✅ Build Status" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "Cmder launcher successfully compiled." >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
- name: Pack the built files - name: Pack the built files
shell: pwsh shell: pwsh
working-directory: scripts working-directory: scripts
@@ -92,31 +116,64 @@ jobs:
path: build/cmder_wt_mini.zip path: build/cmder_wt_mini.zip
name: cmder_wt_mini.zip name: cmder_wt_mini.zip
- name: Summary - Package artifacts
if: success()
shell: pwsh
run: |
echo "### 📦 Artifacts Created" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "| Artifact | Size | Hash (SHA256) |" >> $env:GITHUB_STEP_SUMMARY
echo "| --- | --- | --- |" >> $env:GITHUB_STEP_SUMMARY
$artifacts = @("cmder.zip", "cmder.7z", "cmder_mini.zip")
foreach ($artifact in $artifacts) {
$path = "build/$artifact"
if (Test-Path $path) {
$size = (Get-Item $path).Length / 1MB
# Truncate hash to first 16 chars for summary readability (full hash in hashes.txt)
$hash = (Get-FileHash $path -Algorithm SHA256).Hash.Substring(0, 16)
echo "| \`$artifact\` | $([math]::Round($size, 2)) MB | \`$hash...\` |" >> $env:GITHUB_STEP_SUMMARY
}
}
echo "" >> $env:GITHUB_STEP_SUMMARY
- name: Upload artifact (cmder.zip) - name: Upload artifact (cmder.zip)
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v6
with: with:
path: build/cmder.zip path: build/cmder.zip
name: cmder.zip name: cmder.zip
if-no-files-found: error if-no-files-found: error
- name: Upload artifact (cmder.7z) - name: Upload artifact (cmder.7z)
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v6
with: with:
path: build/cmder.7z path: build/cmder.7z
name: cmder.7z name: cmder.7z
- name: Upload artifact (cmder_mini.zip) - name: Upload artifact (cmder_mini.zip)
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v6
with: with:
path: build/cmder_mini.zip path: build/cmder_mini.zip
name: cmder_mini.zip name: cmder_mini.zip
- name: Upload artifact (hashes.txt) - name: Upload artifact (hashes.txt)
uses: actions/upload-artifact@v5 uses: actions/upload-artifact@v6
with: with:
path: build/hashes.txt path: build/hashes.txt
name: hashes.txt name: hashes.txt
- name: Summary - Artifacts uploaded
if: success()
shell: pwsh
run: |
echo "### ☁️ Upload Status" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "All artifacts successfully uploaded to GitHub Actions:" >> $env:GITHUB_STEP_SUMMARY
echo "- ✅ \`cmder.zip\`" >> $env:GITHUB_STEP_SUMMARY
echo "- ✅ \`cmder.7z\`" >> $env:GITHUB_STEP_SUMMARY
echo "- ✅ \`cmder_mini.zip\`" >> $env:GITHUB_STEP_SUMMARY
echo "- ✅ \`hashes.txt\`" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
- name: Create Release - name: Create Release
uses: softprops/action-gh-release@v2 uses: softprops/action-gh-release@v2
with: with:
@@ -131,3 +188,18 @@ jobs:
draft: true draft: true
generate_release_notes: true generate_release_notes: true
if: startsWith(github.ref, 'refs/tags/') if: startsWith(github.ref, 'refs/tags/')
- name: Summary - Release created
if: startsWith(github.ref, 'refs/tags/')
shell: pwsh
run: |
echo "### 🚀 Release Information" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "Draft release created for tag: **\`${{ github.ref_name }}\`**" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "Release includes:" >> $env:GITHUB_STEP_SUMMARY
echo "- Full version (\`cmder.zip\`, \`cmder.7z\`)" >> $env:GITHUB_STEP_SUMMARY
echo "- Mini version (\`cmder_mini.zip\`)" >> $env:GITHUB_STEP_SUMMARY
echo "- File hashes (\`hashes.txt\`)" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "> ⚠️ Release is in **draft** mode. Please review and publish manually." >> $env:GITHUB_STEP_SUMMARY

View File

@@ -45,7 +45,22 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v5 uses: actions/checkout@v6
- name: Summary - CodeQL analysis started
shell: pwsh
run: |
echo "## 🔒 CodeQL Security Analysis - Workflow Summary" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "### Analysis Configuration" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "| Property | Value |" >> $env:GITHUB_STEP_SUMMARY
echo "| --- | --- |" >> $env:GITHUB_STEP_SUMMARY
echo "| Repository | \`${{ github.repository }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "| Branch | \`${{ github.ref_name }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "| Language | \`${{ matrix.language }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "| Commit | \`${{ github.sha }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
# Initializes the CodeQL tools for scanning. # Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL - name: Initialize CodeQL
@@ -67,7 +82,28 @@ jobs:
working-directory: scripts working-directory: scripts
run: .\build.ps1 -Compile -verbose run: .\build.ps1 -Compile -verbose
- name: Summary - Build status
if: success()
shell: pwsh
run: |
echo "### ✅ Build Completed" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "Cmder launcher built successfully for CodeQL analysis." >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
- name: Perform CodeQL Analysis - name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v4 uses: github/codeql-action/analyze@v4
with: with:
category: "/language:${{matrix.language}}" category: "/language:${{matrix.language}}"
- name: Summary - Analysis completed
if: success()
shell: pwsh
run: |
echo "### 🔍 CodeQL Analysis Results" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "✅ CodeQL security analysis completed successfully." >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "**Language analyzed:** \`${{ matrix.language }}\`" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "> Check the Security tab for detailed findings and recommendations." >> $env:GITHUB_STEP_SUMMARY

View File

@@ -38,17 +38,78 @@ jobs:
continue-on-error: false continue-on-error: false
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v6
- name: Summary - Test execution started
shell: pwsh
run: |
echo "## 🧪 Run Tests - Workflow Summary" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "### Test Environment" >> $env:GITHUB_STEP_SUMMARY
echo "| Property | Value |" >> $env:GITHUB_STEP_SUMMARY
echo "| --- | --- |" >> $env:GITHUB_STEP_SUMMARY
echo "| Repository | \`${{ github.repository }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "| Branch | \`${{ github.ref_name }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "| Commit | \`${{ github.sha }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "| Runner OS | \`${{ runner.os }}\` |" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
- name: Initialize vendors - name: Initialize vendors
shell: pwsh shell: pwsh
working-directory: scripts working-directory: scripts
run: .\build.ps1 -verbose run: .\build.ps1 -verbose
- name: Summary - Vendor initialization
if: success()
shell: pwsh
run: |
echo "### ⚙️ Vendor Initialization" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "✅ Vendor dependencies initialized successfully." >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
- name: Summary - Test results table header
if: success()
shell: pwsh
run: |
echo "### 📋 Test Results" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "| Test | Status |" >> $env:GITHUB_STEP_SUMMARY
echo "| --- | --- |" >> $env:GITHUB_STEP_SUMMARY
- name: Testing Clink Shell - name: Testing Clink Shell
run: | run: |
cmd /c vendor\init.bat /v /d /t cmd /c vendor\init.bat /v /d /t
- name: Summary - Clink Shell test
if: success()
shell: pwsh
run: |
echo "| Clink Shell | ✅ Passed |" >> $env:GITHUB_STEP_SUMMARY
- name: Testing PowerShell - name: Testing PowerShell
run: | run: |
PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -Command "$env:CMDER_DEBUG='1'; . 'vendor\profile.ps1'" PowerShell.exe -ExecutionPolicy Bypass -NoLogo -NoProfile -Command "$env:CMDER_DEBUG='1'; . 'vendor\profile.ps1'"
- name: Summary - PowerShell test
if: success()
shell: pwsh
run: |
echo "| PowerShell | ✅ Passed |" >> $env:GITHUB_STEP_SUMMARY
- name: Testing Bash - name: Testing Bash
run: | run: |
bash vendor/cmder.sh bash vendor/cmder.sh
- name: Summary - Bash test
if: success()
shell: pwsh
run: |
echo "| Bash | ✅ Passed |" >> $env:GITHUB_STEP_SUMMARY
- name: Summary - All tests completed
if: success()
shell: pwsh
run: |
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "### ✅ All Tests Completed" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "All shell environments tested successfully!" >> $env:GITHUB_STEP_SUMMARY

View File

@@ -24,10 +24,18 @@ jobs:
pull-requests: write pull-requests: write
steps: steps:
- uses: actions/checkout@v5 - uses: actions/checkout@v6
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Summary - Workflow started
shell: pwsh
run: |
echo "## 📦 Update Vendor - Workflow Summary" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "Checking for vendor dependency updates..." >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
- id: make-changes - id: make-changes
name: Checking for updates name: Checking for updates
env: env:
@@ -51,7 +59,25 @@ jobs:
Set-GHVariable -Name LIST_UPDATED -Value $listUpdated.Trim(', ') Set-GHVariable -Name LIST_UPDATED -Value $listUpdated.Trim(', ')
echo "UPDATE_MESSAGE<<<EOF`n$updateMessage`n<EOF" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8 echo "UPDATE_MESSAGE<<<EOF`n$updateMessage`n<EOF" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
- uses: peter-evans/create-pull-request@v7 - name: Summary - Update check results
shell: pwsh
run: |
$count = $env:COUNT_UPDATED
if ($count -eq 0) {
echo "### ✅ No Updates Available" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "All vendor dependencies are up to date." >> $env:GITHUB_STEP_SUMMARY
} else {
$word = if ($count -eq 1) { 'dependency' } else { 'dependencies' }
echo "### 🔄 Updates Found" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "**$count** vendor $word updated:" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "$env:UPDATE_MESSAGE" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
}
- uses: peter-evans/create-pull-request@v8
if: env.COUNT_UPDATED > 0 if: env.COUNT_UPDATED > 0
with: with:
title: 'Updates to `${{ env.COUNT_UPDATED }}` vendored dependencies' title: 'Updates to `${{ env.COUNT_UPDATED }}` vendored dependencies'
@@ -63,3 +89,17 @@ jobs:
commit-message: '⬆️ Update dependencies (${{ env.LIST_UPDATED }})' commit-message: '⬆️ Update dependencies (${{ env.LIST_UPDATED }})'
branch: update-vendor branch: update-vendor
base: master base: master
- name: Summary - Pull request created
if: env.COUNT_UPDATED > 0
shell: pwsh
run: |
echo "### 🎉 Pull Request Created" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "A pull request has been created to update the vendor dependencies." >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "**Branch:** \`update-vendor\`" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "**Updated dependencies:** $env:LIST_UPDATED" >> $env:GITHUB_STEP_SUMMARY
echo "" >> $env:GITHUB_STEP_SUMMARY
echo "> Please review and merge the pull request to apply the updates." >> $env:GITHUB_STEP_SUMMARY

116
vendor/clink.lua vendored
View File

@@ -324,7 +324,7 @@ end
-- Find out current branch -- Find out current branch
-- @return {nil|git branch name} -- @return {nil|git branch name}
--- ---
local function get_git_branch(git_dir) local function get_git_branch(git_dir, fast)
git_dir = git_dir or get_git_dir() git_dir = git_dir or get_git_dir()
-- If git directory not found then we're probably outside of repo -- If git directory not found then we're probably outside of repo
@@ -341,8 +341,90 @@ local function get_git_branch(git_dir)
-- if HEAD matches branch expression, then we're on named branch -- if HEAD matches branch expression, then we're on named branch
-- otherwise it is a detached commit -- otherwise it is a detached commit
local branch_name = HEAD:match('ref: refs/heads/(.+)') local branch_name = HEAD:match('ref: refs/heads/(.+)')
if os.getenv("CLINK_DEBUG_GIT_REFTABLE") then
branch_name = '.invalid'
end
return branch_name or 'HEAD detached at '..HEAD:sub(1, 7) -- If the branch name is ".invalid" and the fast method wasn't requested,
-- then invoke git.exe to get accurate current branch info (slow method).
if branch_name == ".invalid" and not fast then
local file
branch_name = nil
-- Handle the most common case first.
if not branch_name then
file = io_popenyield("git --no-optional-locks branch 2>nul")
if file then
for line in file:lines() do
local b = line:match("^%*%s+(.*)")
if b then
b = b:match("^%((HEAD detached at .*)%)") or b
branch_name = b
break
end
end
file:close()
end
end
-- Handle the cases where "git branch" output is empty, but "git
-- branch --show-current" shows the branch name (e.g. a new repo).
if not branch_name then
file = io_popenyield("git --no-optional-locks branch --show-current 2>nul")
if file then
for line in file:lines() do -- luacheck: ignore 512
branch_name = line
break
end
file:close()
end
end
else
branch_name = branch_name or 'HEAD detached at '..HEAD:sub(1, 7)
end
return branch_name
end
local function get_git_remote(git_dir, branch)
if not git_dir then return nil end
if not branch then return nil end
local file = io.open(git_dir.."/config", 'r')
if not file then return nil end
local git_config = {}
local function get_git_config_value(section, param)
return git_config[section] and git_config[section][param] or nil
end
local section
for line in file:lines() do
if (line:sub(1,1) == "[" and line:sub(-1) == "]") then
if (line:sub(2,5) == "lfs ") then
section = nil -- skip LFS entries as there can be many and we never use them
else
section = line:sub(2,-2)
git_config[section] = git_config[section] or {}
end
elseif section then
local param, value = line:match('^%s-([%w|_]+)%s-=%s+(.+)$')
if (param and value ~= nil) then
git_config[section][param] = value
end
end
end
file:close()
local remote_to_push = get_git_config_value('branch "'..branch..'"', 'remote') or ''
local remote_ref = get_git_config_value('remote "'..remote_to_push..'"', 'push') or
get_git_config_value('push', 'default')
local text = remote_to_push
if remote_ref then text = text..'/'..remote_ref end
return text ~= '' and text or nil
end end
--- ---
@@ -394,7 +476,7 @@ end
-- Get the status and conflict status of working dir -- Get the status and conflict status of working dir
-- @return {bool <status>, bool <is_conflict>} -- @return {bool <status>, bool <is_conflict>}
--- ---
local function get_git_status() local function get_git_status(git_dir)
local file = io_popenyield("git --no-optional-locks status --porcelain 2>nul") local file = io_popenyield("git --no-optional-locks status --porcelain 2>nul")
if not file then if not file then
return {} return {}
@@ -416,7 +498,10 @@ local function get_git_status()
end end
file:close() file:close()
return { status = is_status, conflict = conflict_found } local branch = get_git_branch(git_dir, false--[[fast]])
local remote = get_git_remote(git_dir, branch)
return { status = is_status, branch = branch, remote = remote, conflict = conflict_found }
end end
--- ---
@@ -515,11 +600,11 @@ end
-- Use a prompt coroutine to get git status in the background. -- Use a prompt coroutine to get git status in the background.
-- Cache the info so we can reuse it next time to reduce flicker. -- Cache the info so we can reuse it next time to reduce flicker.
--- ---
local function get_git_info_table() local function get_git_info_table(git_dir)
local info = clink_promptcoroutine(function () local info = clink_promptcoroutine(function ()
-- Use git status if allowed. -- Use git status if allowed.
local cmderGitStatusOptIn = get_git_status_setting() local cmderGitStatusOptIn = get_git_status_setting()
return cmderGitStatusOptIn and get_git_status() or {} return cmderGitStatusOptIn and get_git_status(git_dir) or {}
end) end)
if not info then if not info then
info = cached_info.git_info or {} info = cached_info.git_info or {}
@@ -539,10 +624,11 @@ local function git_prompt_filter()
local git_dir = get_git_dir() local git_dir = get_git_dir()
local color local color
if git_dir then if git_dir then
local branch = get_git_branch(git_dir) local branch = get_git_branch(git_dir, true--[[fast]])
if branch then if branch then
-- If in a different repo or branch than last time, discard cached info. -- If in a different repo or branch than last time, discard cached info.
if cached_info.git_dir ~= git_dir or cached_info.git_branch ~= branch then if cached_info.git_dir ~= git_dir or
(branch ~= ".invalid" and cached_info.git_branch ~= branch) then
cached_info.git_info = nil cached_info.git_info = nil
cached_info.git_dir = git_dir cached_info.git_dir = git_dir
cached_info.git_branch = branch cached_info.git_branch = branch
@@ -550,10 +636,22 @@ local function git_prompt_filter()
-- If we're inside of git repo then try to detect current branch -- If we're inside of git repo then try to detect current branch
-- Has branch => therefore it is a git folder, now figure out status -- Has branch => therefore it is a git folder, now figure out status
local gitInfo = get_git_info_table() local gitInfo = get_git_info_table(git_dir)
local gitStatus = gitInfo.status local gitStatus = gitInfo.status
local gitConflict = gitInfo.conflict local gitConflict = gitInfo.conflict
-- Compensate for git reftables.
branch = gitInfo.branch or branch
if branch == ".invalid" then
branch = "Loading..."
elseif gitInfo.remote then
branch = branch.." -> "..gitInfo.remote
end
-- Prevent an older clink-completions git_prompt.lua scripts from
-- modifying the prompt.
branch = "\x1b[10m"..branch
if gitStatus == nil then if gitStatus == nil then
color = get_unknown_color() color = get_unknown_color()
elseif gitStatus then elseif gitStatus then

12
vendor/sources.json vendored
View File

@@ -1,13 +1,13 @@
[ [
{ {
"name": "git-for-windows", "name": "git-for-windows",
"version": "2.51.2.windows.1", "version": "2.52.0.windows.1",
"url": "https://github.com/git-for-windows/git/releases/download/v2.51.2.windows.1/PortableGit-2.51.2-64-bit.7z.exe" "url": "https://github.com/git-for-windows/git/releases/download/v2.52.0.windows.1/PortableGit-2.52.0-64-bit.7z.exe"
}, },
{ {
"name": "clink", "name": "clink",
"version": "1.8.8", "version": "1.9.5",
"url": "https://github.com/chrisant996/clink/releases/download/v1.8.8/clink.1.8.8.a63364.zip" "url": "https://github.com/chrisant996/clink/releases/download/v1.9.5/clink.1.9.5.ee6b4f.zip"
}, },
{ {
"name": "conemu-maximus5", "name": "conemu-maximus5",
@@ -21,7 +21,7 @@
}, },
{ {
"name": "clink-completions", "name": "clink-completions",
"version": "0.6.6", "version": "0.6.7",
"url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.6.6.zip" "url": "https://github.com/vladimir-kotikov/clink-completions/archive/v0.6.7.zip"
} }
] ]