mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-11-04 11:22:13 +08:00 
			
		
		
		
	Merge branch 'status-branchonly' into status-branchonly-dax
This commit is contained in:
		
							
								
								
									
										1
									
								
								vendor/clink.lua
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/clink.lua
									
									
									
									
										vendored
									
									
								
							@@ -434,7 +434,6 @@ local function git_prompt_filter()
 | 
				
			|||||||
              return false
 | 
					              return false
 | 
				
			||||||
          end
 | 
					          end
 | 
				
			||||||
      end
 | 
					      end
 | 
				
			||||||
 | 
					 | 
				
			||||||
    end
 | 
					    end
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    -- No git present or not in git file
 | 
					    -- No git present or not in git file
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										18
									
								
								vendor/git-prompt.sh
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										18
									
								
								vendor/git-prompt.sh
									
									
									
									
										vendored
									
									
								
							@@ -9,6 +9,21 @@ function getGitStatusSetting() {
 | 
				
			|||||||
  fi
 | 
					  fi
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function getSimpleGitBranch() {
 | 
				
			||||||
 | 
					  gitDir=$(git rev-parse --git-dir 2>/dev/null)
 | 
				
			||||||
 | 
					  if [ -z "$gitDir" ]; then
 | 
				
			||||||
 | 
							return 0
 | 
				
			||||||
 | 
						fi
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  headContent=$(< "$gitDir/HEAD")
 | 
				
			||||||
 | 
					  if [[ "$headContent" == "ref: refs/heads/"* ]]
 | 
				
			||||||
 | 
					  then
 | 
				
			||||||
 | 
					      echo " (${headContent:16})"
 | 
				
			||||||
 | 
					  else
 | 
				
			||||||
 | 
					      echo " (HEAD detached at ${headContent:0:7})"
 | 
				
			||||||
 | 
					  fi 
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if test -f /etc/profile.d/git-sdk.sh
 | 
					if test -f /etc/profile.d/git-sdk.sh
 | 
				
			||||||
then
 | 
					then
 | 
				
			||||||
  TITLEPREFIX=SDK-${MSYSTEM#MINGW}
 | 
					  TITLEPREFIX=SDK-${MSYSTEM#MINGW}
 | 
				
			||||||
@@ -45,6 +60,9 @@ else
 | 
				
			|||||||
        . "$COMPLETION_PATH/git-prompt.sh"
 | 
					        . "$COMPLETION_PATH/git-prompt.sh"
 | 
				
			||||||
        PS1="$PS1"'\[\033[36m\]'  # change color to cyan
 | 
					        PS1="$PS1"'\[\033[36m\]'  # change color to cyan
 | 
				
			||||||
        PS1="$PS1"'`__git_ps1`'   # bash function
 | 
					        PS1="$PS1"'`__git_ps1`'   # bash function
 | 
				
			||||||
 | 
					      else
 | 
				
			||||||
 | 
					        PS1="$PS1"'\[\033[30;1m\]'  # change color to gray
 | 
				
			||||||
 | 
					        PS1="$PS1"'`getSimpleGitBranch`'
 | 
				
			||||||
      fi
 | 
					      fi
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
  fi
 | 
					  fi
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										8
									
								
								vendor/psmodules/Cmder.ps1
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								vendor/psmodules/Cmder.ps1
									
									
									
									
										vendored
									
									
								
							@@ -36,6 +36,14 @@ function checkGit($Path) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
      if (getGitStatusSetting -eq $true) {
 | 
					      if (getGitStatusSetting -eq $true) {
 | 
				
			||||||
        Write-VcsStatus
 | 
					        Write-VcsStatus
 | 
				
			||||||
 | 
					      } else {
 | 
				
			||||||
 | 
					        $headContent = Get-Content (Join-Path $Path '.git/HEAD')
 | 
				
			||||||
 | 
					        if ($headContent -like "ref: refs/heads/*") {
 | 
				
			||||||
 | 
					            $branchName = $headContent.Substring(16)
 | 
				
			||||||
 | 
					        } else {
 | 
				
			||||||
 | 
					            $branchName = "HEAD detached at $($headContent.Substring(0, 7))"
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        Write-Host " [$branchName]" -NoNewline -ForegroundColor DarkGray
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      return
 | 
					      return
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user