Skip to content

Commit 89c9e22

Browse files
committed
Revert "gvfs:trace2:data add status serialization/deserialization information"
This reverts commit f4e9264.
1 parent c4aadf8 commit 89c9e22

3 files changed

Lines changed: 5 additions & 82 deletions

File tree

builtin/commit.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,6 @@ static int opt_parse_porcelain(const struct option *opt, const char *arg, int un
145145
static int do_serialize = 0;
146146
static char *serialize_path = NULL;
147147

148-
static int reject_implicit = 0;
149148
static int do_implicit_deserialize = 0;
150149
static int do_explicit_deserialize = 0;
151150
static char *deserialize_path = NULL;
@@ -203,7 +202,7 @@ static int opt_parse_deserialize(const struct option *opt, const char *arg, int
203202
if (arg) /* override config or stdin */
204203
deserialize_path = xstrdup(arg);
205204
if (deserialize_path && *deserialize_path
206-
&& (wt_status_deserialize_access(deserialize_path, R_OK) != 0))
205+
&& (access(deserialize_path, R_OK) != 0))
207206
die("cannot find serialization file '%s'",
208207
deserialize_path);
209208

@@ -1397,8 +1396,6 @@ static int git_status_config(const char *k, const char *v, void *cb)
13971396
if (v && *v && access(v, R_OK) == 0) {
13981397
do_implicit_deserialize = 1;
13991398
deserialize_path = xstrdup(v);
1400-
} else {
1401-
reject_implicit = 1;
14021399
}
14031400
return 0;
14041401
}
@@ -1555,17 +1552,6 @@ int cmd_status(int argc, const char **argv, const char *prefix)
15551552
(do_implicit_deserialize || do_explicit_deserialize));
15561553
if (try_deserialize)
15571554
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-
}
15691555

15701556
enable_fscache(0);
15711557
if (status_format != STATUS_FORMAT_PORCELAIN &&
@@ -1609,7 +1595,6 @@ int cmd_status(int argc, const char **argv, const char *prefix)
16091595
if (s.relative_paths)
16101596
s.prefix = prefix;
16111597

1612-
trace2_cmd_subverb("deserialize");
16131598
result = wt_status_deserialize(&s, deserialize_path, dw);
16141599
if (result == DESERIALIZE_OK)
16151600
return 0;
@@ -1627,7 +1612,6 @@ int cmd_status(int argc, const char **argv, const char *prefix)
16271612
fd = -1;
16281613
}
16291614

1630-
trace2_cmd_subverb("collect");
16311615
wt_status_collect(&s);
16321616

16331617
if (0 <= fd)
@@ -1642,7 +1626,6 @@ int cmd_status(int argc, const char **argv, const char *prefix)
16421626
if (fd_serialize < 0)
16431627
die_errno(_("could not serialize to '%s'"),
16441628
serialize_path);
1645-
trace2_cmd_subverb("serialize");
16461629
wt_status_serialize_v1(fd_serialize, &s);
16471630
close(fd_serialize);
16481631
}

wt-status-deserialize.c

Lines changed: 4 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,6 @@
33
#include "pkt-line.h"
44
#include "trace.h"
55

6-
static void set_deserialize_reject_reason(const char *reason)
7-
{
8-
trace2_data_string("status", the_repository, "deserialize/reject",
9-
reason);
10-
}
11-
12-
int wt_status_deserialize_access(const char *path, int mode)
13-
{
14-
int a = access(path, mode);
15-
16-
if (a != 0)
17-
set_deserialize_reject_reason("status-cache/access");
18-
19-
return a;
20-
}
21-
226
static struct trace_key trace_deserialize = TRACE_KEY_INIT(DESERIALIZE);
237

248
enum deserialize_parse_strategy {
@@ -65,15 +49,13 @@ static int my_validate_index(const struct cache_time *mtime_reported)
6549
struct cache_time mtime_observed_on_disk;
6650

6751
if (lstat(path, &st)) {
68-
set_deserialize_reject_reason("index/not-found");
6952
trace_printf_key(&trace_deserialize, "could not stat index");
7053
return DESERIALIZE_ERR;
7154
}
7255
mtime_observed_on_disk.sec = st.st_mtime;
7356
mtime_observed_on_disk.nsec = ST_MTIME_NSEC(st);
7457
if ((mtime_observed_on_disk.sec != mtime_reported->sec) ||
7558
(mtime_observed_on_disk.nsec != mtime_reported->nsec)) {
76-
set_deserialize_reject_reason("index/mtime-changed");
7759
trace_printf_key(&trace_deserialize,
7860
"index mtime changed [des %d %d][obs %d %d]",
7961
mtime_reported->sec, mtime_reported->nsec,
@@ -99,12 +81,10 @@ static int my_validate_excludes(const char *path, const char *key, const char *l
9981

10082
r = (strcmp(line, sb.buf) ? DESERIALIZE_ERR : DESERIALIZE_OK);
10183

102-
if (r == DESERIALIZE_ERR) {
103-
set_deserialize_reject_reason("excludes/changed");
84+
if (r == DESERIALIZE_ERR)
10485
trace_printf_key(&trace_deserialize,
10586
"%s changed [cached '%s'][observed '%s']",
10687
key, line, sb.buf);
107-
}
10888

10989
strbuf_release(&sb);
11090
return r;
@@ -160,7 +140,6 @@ static int wt_deserialize_v1_header(struct wt_status *s, int fd)
160140
&index_mtime.sec,
161141
&index_mtime.nsec);
162142
if (nr_fields != 2) {
163-
set_deserialize_reject_reason("v1-header/invalid-index-mtime");
164143
trace_printf_key(&trace_deserialize, "invalid index_mtime (%d) '%s'",
165144
nr_fields, line);
166145
return DESERIALIZE_ERR;
@@ -244,7 +223,6 @@ static int wt_deserialize_v1_header(struct wt_status *s, int fd)
244223
/* status_format */
245224
if (skip_prefix(line, "sha1_commit ", &arg)) {
246225
if (get_sha1_hex(arg, s->sha1_commit)) {
247-
set_deserialize_reject_reason("v1-header/invalid-commit-sha");
248226
trace_printf_key(&trace_deserialize, "invalid sha1_commit");
249227
return DESERIALIZE_ERR;
250228
}
@@ -260,23 +238,19 @@ static int wt_deserialize_v1_header(struct wt_status *s, int fd)
260238
}
261239
/* prefix */
262240

263-
set_deserialize_reject_reason("v1-header/unexpected-line");
264241
trace_printf_key(&trace_deserialize, "unexpected line '%s'", line);
265242
return DESERIALIZE_ERR;
266243
}
267244

268245
if (!have_required_index_mtime) {
269-
set_deserialize_reject_reason("v1-header/missing-index-mtime");
270246
trace_printf_key(&trace_deserialize, "missing '%s'", "index_mtime");
271247
return DESERIALIZE_ERR;
272248
}
273249
if (!have_required_core_excludes) {
274-
set_deserialize_reject_reason("v1-header/missing-core-excludes");
275250
trace_printf_key(&trace_deserialize, "missing '%s'", "core_excludes");
276251
return DESERIALIZE_ERR;
277252
}
278253
if (!have_required_repo_excludes) {
279-
set_deserialize_reject_reason("v1-header/missing-repo-excludes");
280254
trace_printf_key(&trace_deserialize, "missing '%s'", "repo_excludes");
281255
return DESERIALIZE_ERR;
282256
}
@@ -362,7 +336,6 @@ static int wt_deserialize_v1_changed_items(const struct wt_status *cmd_s,
362336
* So we reject the status cache and let the fallback
363337
* code run.
364338
*/
365-
set_deserialize_reject_reason("v1-data/unmerged");
366339
trace_printf_key(
367340
&trace_deserialize,
368341
"reject: V2 format and umerged file: %s",
@@ -498,15 +471,13 @@ static int wt_deserialize_v1(const struct wt_status *cmd_s, struct wt_status *s,
498471
* the serialized data
499472
*/
500473
if (validate_untracked_files_arg(cmd_s->show_untracked_files, s->show_untracked_files, &untracked_strategy)) {
501-
set_deserialize_reject_reason("args/untracked-files");
502474
trace_printf_key(&trace_deserialize, "reject: show_untracked_file: command: %d, serialized : %d",
503475
cmd_s->show_untracked_files,
504476
s->show_untracked_files);
505477
return DESERIALIZE_ERR;
506478
}
507479

508480
if (validate_ignored_files_arg(cmd_s->show_ignored_mode, s->show_ignored_mode, &ignored_strategy)) {
509-
set_deserialize_reject_reason("args/ignored-mode");
510481
trace_printf_key(&trace_deserialize, "reject: show_ignored_mode: command: %d, serialized: %d",
511482
cmd_s->show_ignored_mode,
512483
s->show_ignored_mode);
@@ -540,7 +511,6 @@ static int wt_deserialize_v1(const struct wt_status *cmd_s, struct wt_status *s,
540511
return DESERIALIZE_ERR;
541512
continue;
542513
}
543-
set_deserialize_reject_reason("v1-data/unexpected-line");
544514
trace_printf_key(&trace_deserialize, "unexpected line '%s'", line);
545515
return DESERIALIZE_ERR;
546516
}
@@ -562,7 +532,6 @@ static int wt_deserialize_parse(const struct wt_status *cmd_s, struct wt_status
562532
if (version == 1)
563533
return wt_deserialize_v1(cmd_s, s, fd);
564534
}
565-
set_deserialize_reject_reason("status-cache/unsupported-version");
566535
trace_printf_key(&trace_deserialize, "missing/unsupported version");
567536
return DESERIALIZE_ERR;
568537
}
@@ -583,7 +552,6 @@ static int wt_deserialize_fd(const struct wt_status *cmd_s, struct wt_status *de
583552
* Check the path spec on the current command
584553
*/
585554
if (cmd_s->pathspec.nr > 1) {
586-
set_deserialize_reject_reason("args/multiple-pathspecs");
587555
trace_printf_key(&trace_deserialize, "reject: multiple pathspecs");
588556
return DESERIALIZE_ERR;
589557
}
@@ -594,7 +562,6 @@ static int wt_deserialize_fd(const struct wt_status *cmd_s, struct wt_status *de
594562
*/
595563
if (cmd_s->pathspec.nr == 1 &&
596564
my_strcmp_null(cmd_s->pathspec.items[0].match, "")) {
597-
set_deserialize_reject_reason("args/root-pathspec");
598565
trace_printf_key(&trace_deserialize, "reject: pathspec");
599566
return DESERIALIZE_ERR;
600567
}
@@ -611,24 +578,20 @@ static int wt_deserialize_fd(const struct wt_status *cmd_s, struct wt_status *de
611578
* or "--ignored" settings).
612579
*/
613580
if (cmd_s->is_initial != des_s->is_initial) {
614-
set_deserialize_reject_reason("args/is-initial-changed");
615581
trace_printf_key(&trace_deserialize, "reject: is_initial");
616582
return DESERIALIZE_ERR;
617583
}
618584
if (my_strcmp_null(cmd_s->branch, des_s->branch)) {
619-
set_deserialize_reject_reason("args/branch-changed");
620585
trace_printf_key(&trace_deserialize, "reject: branch");
621586
return DESERIALIZE_ERR;
622587
}
623588
if (my_strcmp_null(cmd_s->reference, des_s->reference)) {
624-
set_deserialize_reject_reason("args/reference-changed");
625589
trace_printf_key(&trace_deserialize, "reject: reference");
626590
return DESERIALIZE_ERR;
627591
}
628592
/* verbose */
629593
/* amend */
630594
if (cmd_s->whence != des_s->whence) {
631-
set_deserialize_reject_reason("args/whence-changed");
632595
trace_printf_key(&trace_deserialize, "reject: whence");
633596
return DESERIALIZE_ERR;
634597
}
@@ -662,23 +625,19 @@ static int wt_deserialize_fd(const struct wt_status *cmd_s, struct wt_status *de
662625
/* hints */
663626
/* ahead_behind_flags */
664627
if (cmd_s->detect_rename != des_s->detect_rename) {
665-
set_deserialize_reject_reason("args/detect-rename-changed");
666628
trace_printf_key(&trace_deserialize, "reject: detect_rename");
667629
return DESERIALIZE_ERR;
668630
}
669631
if (cmd_s->rename_score != des_s->rename_score) {
670-
set_deserialize_reject_reason("args/rename-score-changed");
671632
trace_printf_key(&trace_deserialize, "reject: rename_score");
672633
return DESERIALIZE_ERR;
673634
}
674635
if (cmd_s->rename_limit != des_s->rename_limit) {
675-
set_deserialize_reject_reason("args/rename-limit-changed");
676636
trace_printf_key(&trace_deserialize, "reject: rename_limit");
677637
return DESERIALIZE_ERR;
678638
}
679639
/* status_format */
680640
if (hashcmp(cmd_s->sha1_commit, des_s->sha1_commit)) {
681-
set_deserialize_reject_reason("args/commit-changed");
682641
trace_printf_key(&trace_deserialize, "reject: sha1_commit");
683642
return DESERIALIZE_ERR;
684643
}
@@ -766,18 +725,15 @@ static int try_deserialize_read_from_file(const struct wt_status *cmd_s,
766725
enum wt_status_deserialize_wait dw,
767726
struct wt_status *des_s)
768727
{
769-
int k = 0;
770-
int limit;
728+
int k, limit;
771729
int result = DESERIALIZE_ERR;
772730

773731
/*
774732
* For "fail" or "no", try exactly once to read the status cache.
775733
* Return an error if the file is stale.
776734
*/
777-
if (dw == DESERIALIZE_WAIT__FAIL || dw == DESERIALIZE_WAIT__NO) {
778-
result = try_deserialize_read_from_file_1(cmd_s, path, des_s);
779-
goto done;
780-
}
735+
if (dw == DESERIALIZE_WAIT__FAIL || dw == DESERIALIZE_WAIT__NO)
736+
return try_deserialize_read_from_file_1(cmd_s, path, des_s);
781737

782738
/*
783739
* Wait for the status cache file to refresh. Wait duration can
@@ -802,12 +758,6 @@ static int try_deserialize_read_from_file(const struct wt_status *cmd_s,
802758
sleep_millisec(100);
803759
}
804760

805-
done:
806-
trace2_data_string("status", the_repository, "deserialize/path", path);
807-
trace2_data_intmax("status", the_repository, "deserialize/polled", k);
808-
trace2_data_string("status", the_repository, "deserialize/result",
809-
((result == DESERIALIZE_OK) ? "ok" : "reject"));
810-
811761
trace_printf_key(&trace_deserialize,
812762
"wait polled=%d result=%d '%s'",
813763
k, result, path);
@@ -833,8 +783,6 @@ int wt_status_deserialize(const struct wt_status *cmd_s,
833783
struct wt_status des_s;
834784
int result;
835785

836-
trace2_region_enter("status", "deserialize", the_repository);
837-
838786
if (path && *path && strcmp(path, "0")) {
839787
result = try_deserialize_read_from_file(cmd_s, path, dw, &des_s);
840788
} else {
@@ -845,14 +793,8 @@ int wt_status_deserialize(const struct wt_status *cmd_s,
845793
* term, since we cannot read stdin multiple times.
846794
*/
847795
result = wt_deserialize_fd(cmd_s, &des_s, 0);
848-
849-
trace2_data_string("status", the_repository, "deserialize/path", "STDIN");
850-
trace2_data_string("status", the_repository, "deserialize/result",
851-
((result == DESERIALIZE_OK) ? "ok" : "reject"));
852796
}
853797

854-
trace2_region_leave("status", "deserialize", the_repository);
855-
856798
if (result == DESERIALIZE_OK) {
857799
wt_status_get_state(&des_s.state, des_s.branch &&
858800
!strcmp(des_s.branch, "HEAD"));

wt-status.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,6 @@ int wt_status_deserialize(const struct wt_status *cmd_s,
210210
const char *path,
211211
enum wt_status_deserialize_wait dw);
212212

213-
int wt_status_deserialize_access(const char *path, int mode);
214-
215213
/*
216214
* A helper routine for serialize and deserialize to compute
217215
* metadata for the user-global and repo-local excludes files.

0 commit comments

Comments
 (0)