@@ -88,8 +88,9 @@ private static void RunPreCommands(string[] args)
8888 ProcessHelper . Run ( "gvfs" , "prefetch --commits" , redirectOutput : false ) ;
8989 break ;
9090 case "status" :
91- /* If status is being run to serialize for caching, skip the health display */
92- if ( ! args . Any ( arg => arg . StartsWith ( "--serialize" , StringComparison . OrdinalIgnoreCase ) ) )
91+ /* If status is being run to serialize for caching, or if --porcelain is specified, skip the health display */
92+ if ( ! ArgsBlockHydrationStatus ( args )
93+ && ConfigurationAllowsHydrationStatus ( ) )
9394 {
9495 /* Display a message about the hydration status of the repo */
9596 ProcessHelper . Run ( "gvfs" , "health --status" , redirectOutput : false ) ;
@@ -98,6 +99,30 @@ private static void RunPreCommands(string[] args)
9899 }
99100 }
100101
102+ private static bool ArgsBlockHydrationStatus ( string [ ] args )
103+ {
104+ return args . Any ( arg =>
105+ arg . StartsWith ( "--serialize" , StringComparison . OrdinalIgnoreCase )
106+ || arg . StartsWith ( "--porcelain" , StringComparison . OrdinalIgnoreCase ) ) ;
107+ }
108+
109+ private static bool ConfigurationAllowsHydrationStatus ( )
110+ {
111+ try
112+ {
113+ ProcessResult result = ProcessHelper . Run ( "git" , $ "config --get { GVFSConstants . GitConfig . ShowHydrationStatus } ") ;
114+ bool hydrationStatusEnabled ;
115+ if ( bool . TryParse ( result . Output . Trim ( ) , out hydrationStatusEnabled ) )
116+ {
117+ return hydrationStatusEnabled ;
118+ }
119+ }
120+ catch ( Exception )
121+ {
122+ }
123+ return GVFSConstants . GitConfig . ShowHydrationStatusDefault ;
124+ }
125+
101126 private static void ExitWithError ( params string [ ] messages )
102127 {
103128 foreach ( string message in messages )
0 commit comments