@@ -145,6 +145,7 @@ static int opt_parse_porcelain(const struct option *opt, const char *arg, int un
145145static int do_serialize = 0 ;
146146static char * serialize_path = NULL ;
147147
148+ static int reject_implicit = 0 ;
148149static int do_implicit_deserialize = 0 ;
149150static int do_explicit_deserialize = 0 ;
150151static char * deserialize_path = NULL ;
@@ -202,7 +203,7 @@ static int opt_parse_deserialize(const struct option *opt, const char *arg, int
202203 if (arg ) /* override config or stdin */
203204 deserialize_path = xstrdup (arg );
204205 if (deserialize_path && * deserialize_path
205- && (access (deserialize_path , R_OK ) != 0 ))
206+ && (wt_status_deserialize_access (deserialize_path , R_OK ) != 0 ))
206207 die ("cannot find serialization file '%s'" ,
207208 deserialize_path );
208209
@@ -1396,6 +1397,8 @@ static int git_status_config(const char *k, const char *v, void *cb)
13961397 if (v && * v && access (v , R_OK ) == 0 ) {
13971398 do_implicit_deserialize = 1 ;
13981399 deserialize_path = xstrdup (v );
1400+ } else {
1401+ reject_implicit = 1 ;
13991402 }
14001403 return 0 ;
14011404 }
@@ -1552,6 +1555,17 @@ int cmd_status(int argc, const char **argv, const char *prefix)
15521555 (do_implicit_deserialize || do_explicit_deserialize ));
15531556 if (try_deserialize )
15541557 goto skip_init ;
1558+ /*
1559+ * If we implicitly received a status cache pathname from the config
1560+ * and the file does not exist, we silently reject it and do the normal
1561+ * status "collect". Fake up some trace2 messages to reflect this and
1562+ * assist post-processors know this case is different.
1563+ */
1564+ if (!do_serialize && reject_implicit ) {
1565+ trace2_cmd_subverb ("implicit-deserialize" );
1566+ trace2_data_string ("status" , the_repository , "deserialize/reject" ,
1567+ "status-cache/access" );
1568+ }
15551569
15561570 enable_fscache (0 );
15571571 if (status_format != STATUS_FORMAT_PORCELAIN &&
@@ -1595,6 +1609,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
15951609 if (s .relative_paths )
15961610 s .prefix = prefix ;
15971611
1612+ trace2_cmd_subverb ("deserialize" );
15981613 result = wt_status_deserialize (& s , deserialize_path , dw );
15991614 if (result == DESERIALIZE_OK )
16001615 return 0 ;
@@ -1612,6 +1627,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
16121627 fd = -1 ;
16131628 }
16141629
1630+ trace2_cmd_subverb ("collect" );
16151631 wt_status_collect (& s );
16161632
16171633 if (0 <= fd )
@@ -1626,6 +1642,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
16261642 if (fd_serialize < 0 )
16271643 die_errno (_ ("could not serialize to '%s'" ),
16281644 serialize_path );
1645+ trace2_cmd_subverb ("serialize" );
16291646 wt_status_serialize_v1 (fd_serialize , & s );
16301647 close (fd_serialize );
16311648 }
0 commit comments