From 73f22c2a32dcc329a5e0356b2334c5bcd6caf272 Mon Sep 17 00:00:00 2001 From: Sorin Ionescu Date: Wed, 11 Apr 2012 21:21:11 -0400 Subject: [PATCH] Revert "[Fix #64] Remove the clean git-info style" This reverts commit a06f13f036580fbad31f89e0fd345db87a460e61. Conflicts: modules/git/functions/git-info plugins/git/style.zsh --- modules/git/functions/git-info | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/modules/git/functions/git-info b/modules/git/functions/git-info index c344189b..26b38fde 100644 --- a/modules/git/functions/git-info +++ b/modules/git/functions/git-info @@ -22,6 +22,9 @@ # # %b - Branch name. # zstyle ':omz:module:git' branch 'branch:%b' # +# # %C - Indicator to notify of a clean working directory. +# zstyle ':omz:module:git' clean 'clean' +# # # %c - SHA-1 hash. # zstyle ':omz:module:git' commit 'commit:%c' # @@ -29,7 +32,7 @@ # zstyle ':omz:module:git' deleted 'deleted:%d' # # # %D - Indicator to notify of dirty files. -# zstyle ':omz:module:git' dirty '%(D.clean.dirty:%D)' +# zstyle ':omz:module:git' dirty 'dirty:%D' # # # %m - Indicator to notify of modified files. # zstyle ':omz:module:git' modified 'modified:%m' @@ -57,7 +60,7 @@ # # # Prompts. # zstyle ':omz:module:git' info \ -# 'prompt' ' git:(%b%D)' \ +# 'prompt' ' git:(%b%C%D)' \ # 'rprompt' '' # @@ -186,6 +189,8 @@ function git-info { local branch_format local branch_formatted local branch_info + local clean + local clean_formatted local commit local commit_format local commit_formatted @@ -375,9 +380,13 @@ function git-info { zformat -f untracked_formatted "$untracked_format" "u:$untracked" fi - # Format dirty. - zstyle -s ':omz:module:git' dirty 'dirty_format' - zformat -f dirty_formatted "$dirty_format" "D:$dirty" + # Format dirty and clean. + if (( $dirty > 0 )); then + zstyle -s ':omz:module:git' dirty 'dirty_format' + zformat -f dirty_formatted "$dirty_format" "D:$dirty" + else + zstyle -s ':omz:module:git' clean 'clean_formatted' + fi # Format info. zstyle -a ':omz:module:git' info 'info_formats' @@ -391,6 +400,7 @@ function git-info { "U:$unmerged_formatted" \ "a:$added_formatted" \ "b:$branch_formatted" \ + "C:$clean_formatted" \ "c:$commit_formatted" \ "d:$deleted_formatted" \ "m:$modified_formatted" \