cmder slow issue(在较大git仓库下相应缓慢)【转】

cmder 是一款强大的命令行工具, 可以在windows 上执行一些Linux的常用指令,如 rm, ls, grep 等等(安装full版本或独立安装git, 这些命令一般在git中). 很值得推荐. 不过如果系统中安装了git, 且当前命令行文件夹中存在的git仓库较大时候,输入回车和执行一些指令就会比较慢. 以下是一个临时的解决办法. 我测试了还是效果比较明显的. 

temperory solution:
comment these codes in local function git_prompt_filter() in clink.lua under cmder\vendor folder:

local git_dir = get_git_dir()
if git_dir then
	-- if we're inside of git repo then try to detect current branch
	local branch = get_git_branch(git_dir)
	local color
	if branch then
		-- Has branch => therefore it is a git folder, now figure out status
		local gitStatus = get_git_status()
		local gitConflict = get_git_conflict()
 
		color = colors.dirty
		if gitStatus then
			color = colors.clean
		end
 
		if gitConflict then
			color = colors.conflict
		end 
 
		clink.prompt.value = string.gsub(clink.prompt.value, "{git}", color.."("..branch..")")
		return false
	end
end
 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章