mirror of
				https://github.com/cmderdev/cmder.git
				synced 2025-10-30 17:01:57 +08:00 
			
		
		
		
	fixing branch only
This commit is contained in:
		
							
								
								
									
										14
									
								
								vendor/clink.lua
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/clink.lua
									
									
									
									
										vendored
									
									
								
							| @@ -350,6 +350,7 @@ local function git_prompt_filter() | |||||||
|         clean = clean_color, |         clean = clean_color, | ||||||
|         dirty = dirty_color, |         dirty = dirty_color, | ||||||
|         conflict = conflict_color |         conflict = conflict_color | ||||||
|  |         nostatus = unknown_color | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     local git_dir = get_git_dir() |     local git_dir = get_git_dir() | ||||||
| @@ -377,6 +378,17 @@ local function git_prompt_filter() | |||||||
|               return false |               return false | ||||||
|           end |           end | ||||||
|       end |       end | ||||||
|  |     else | ||||||
|  |       if git_dir then | ||||||
|  |           local branch = get_git_branch(git_dir) | ||||||
|  |           local color | ||||||
|  |           if branch then | ||||||
|  |               color = colors.nostatus | ||||||
|  |               clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..verbatim(branch)..")") | ||||||
|  |               return false | ||||||
|  |           end | ||||||
|  |       end | ||||||
|  |  | ||||||
|     end |     end | ||||||
|  |  | ||||||
|     -- No git present or not in git file |     -- No git present or not in git file | ||||||
| @@ -394,6 +406,7 @@ local function hg_prompt_filter() | |||||||
|         local colors = { |         local colors = { | ||||||
|             clean = clean_color, |             clean = clean_color, | ||||||
|             dirty = dirty_color, |             dirty = dirty_color, | ||||||
|  |             nostatus = nostatus_color | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         local pipe = io.popen("hg branch 2>&1") |         local pipe = io.popen("hg branch 2>&1") | ||||||
| @@ -428,6 +441,7 @@ local function svn_prompt_filter() | |||||||
|     local colors = { |     local colors = { | ||||||
|         clean = clean_color, |         clean = clean_color, | ||||||
|         dirty = dirty_color, |         dirty = dirty_color, | ||||||
|  |         nostatus = nostatus_color | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     if get_svn_dir() then |     if get_svn_dir() then | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								vendor/cmder_prompt_config.lua.default
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								vendor/cmder_prompt_config.lua.default
									
									
									
									
										vendored
									
									
								
							| @@ -43,3 +43,4 @@ lamb_color = "\x1b[1;30;40m" -- Light Grey = Lambda Color | |||||||
| clean_color = "\x1b[1;37;40m" | clean_color = "\x1b[1;37;40m" | ||||||
| dirty_color = "\x1b[33;3m" | dirty_color = "\x1b[33;3m" | ||||||
| conflict_color = "\x1b[31;1m" | conflict_color = "\x1b[31;1m" | ||||||
|  | unknown_color = "\x1b[1;30;40m" -- Light Grey = No VCS Status Branch Color | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user