Skip to content

Commit d3f3381

Browse files
jeffhostetlerdscho
authored andcommitted
Merge branch 'jh-vfs-trace2-p1-vfs' into jh-221
Includes gvfs-specific commits from PR#115
2 parents fcdf2c2 + 091250b commit d3f3381

6 files changed

Lines changed: 133 additions & 10 deletions

File tree

builtin/commit.c

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

149+
static int reject_implicit = 0;
149150
static int do_implicit_deserialize = 0;
150151
static int do_explicit_deserialize = 0;
151152
static char *deserialize_path = NULL;
@@ -208,7 +209,7 @@ static int opt_parse_deserialize(const struct option *opt, const char *arg, int
208209
deserialize_path = xstrdup(arg);
209210
}
210211
if (deserialize_path && *deserialize_path
211-
&& (access(deserialize_path, R_OK) != 0))
212+
&& (wt_status_deserialize_access(deserialize_path, R_OK) != 0))
212213
die("cannot find serialization file '%s'",
213214
deserialize_path);
214215

@@ -1414,6 +1415,8 @@ static int git_status_config(const char *k, const char *v, void *cb)
14141415
if (v && *v && access(v, R_OK) == 0) {
14151416
do_implicit_deserialize = 1;
14161417
deserialize_path = xstrdup(v);
1418+
} else {
1419+
reject_implicit = 1;
14171420
}
14181421
return 0;
14191422
}
@@ -1570,6 +1573,17 @@ int cmd_status(int argc, const char **argv, const char *prefix)
15701573
(do_implicit_deserialize || do_explicit_deserialize));
15711574
if (try_deserialize)
15721575
goto skip_init;
1576+
/*
1577+
* If we implicitly received a status cache pathname from the config
1578+
* and the file does not exist, we silently reject it and do the normal
1579+
* status "collect". Fake up some trace2 messages to reflect this and
1580+
* assist post-processors know this case is different.
1581+
*/
1582+
if (!do_serialize && reject_implicit) {
1583+
trace2_cmd_mode("implicit-deserialize");
1584+
trace2_data_string("status", the_repository, "deserialize/reject",
1585+
"status-cache/access");
1586+
}
15731587

15741588
enable_fscache(0);
15751589
if (status_format != STATUS_FORMAT_PORCELAIN &&
@@ -1613,6 +1627,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
16131627
if (s.relative_paths)
16141628
s.prefix = prefix;
16151629

1630+
trace2_cmd_mode("deserialize");
16161631
result = wt_status_deserialize(&s, deserialize_path, dw);
16171632
if (result == DESERIALIZE_OK)
16181633
return 0;
@@ -1630,6 +1645,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
16301645
fd = -1;
16311646
}
16321647

1648+
trace2_cmd_mode("collect");
16331649
wt_status_collect(&s);
16341650

16351651
if (0 <= fd)
@@ -1644,6 +1660,7 @@ int cmd_status(int argc, const char **argv, const char *prefix)
16441660
if (fd_serialize < 0)
16451661
die_errno(_("could not serialize to '%s'"),
16461662
serialize_path);
1663+
trace2_cmd_mode("serialize");
16471664
wt_status_serialize_v1(fd_serialize, &s);
16481665
close(fd_serialize);
16491666
}

sha1-file.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -806,6 +806,8 @@ static int read_object_process(const struct object_id *oid)
806806

807807
start = getnanotime();
808808

809+
trace2_region_enter("subprocess", "read_object", the_repository);
810+
809811
if (!subprocess_map_initialized) {
810812
subprocess_map_initialized = 1;
811813
hashmap_init(&subprocess_map, (hashmap_cmp_fn)cmd2process_cmp,
@@ -822,13 +824,16 @@ static int read_object_process(const struct object_id *oid)
822824
if (subprocess_start(&subprocess_map, &entry->subprocess, cmd,
823825
start_read_object_fn)) {
824826
free(entry);
825-
return -1;
827+
err = -1;
828+
goto leave_region;
826829
}
827830
}
828831
process = &entry->subprocess.process;
829832

830-
if (!(CAP_GET & entry->supported_capabilities))
831-
return -1;
833+
if (!(CAP_GET & entry->supported_capabilities)) {
834+
err = -1;
835+
goto leave_region;
836+
}
832837

833838
sigchain_push(SIGPIPE, SIG_IGN);
834839

@@ -877,6 +882,10 @@ static int read_object_process(const struct object_id *oid)
877882

878883
trace_performance_since(start, "read_object_process");
879884

885+
leave_region:
886+
trace2_region_leave_printf("subprocess", "read_object", the_repository,
887+
"result %d", err);
888+
880889
return err;
881890
}
882891

virtualfilesystem.c

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ void apply_virtualfilesystem(struct index_state *istate)
250250
{
251251
char *buf, *entry;
252252
int i;
253+
int nr_unknown = 0;
254+
int nr_vfs_dirs = 0;
255+
int nr_vfs_rows = 0;
256+
int nr_bulk_skip = 0;
257+
int nr_explicit_skip = 0;
253258

254259
if (!git_config_get_virtualfilesystem())
255260
return;
@@ -267,35 +272,63 @@ void apply_virtualfilesystem(struct index_state *istate)
267272
if (buf[i] == '\0') {
268273
int pos, len;
269274

275+
nr_vfs_rows++;
276+
270277
len = buf + i - entry;
271278

272279
/* look for a directory wild card (ie "dir1/") */
273280
if (buf[i - 1] == '/') {
281+
nr_vfs_dirs++;
274282
if (ignore_case)
275283
adjust_dirname_case(istate, entry);
276284
pos = index_name_pos(istate, entry, len);
277285
if (pos < 0) {
278286
pos = -pos - 1;
279287
while (pos < istate->cache_nr && !fspathncmp(istate->cache[pos]->name, entry, len)) {
288+
if (istate->cache[pos]->ce_flags & CE_SKIP_WORKTREE)
289+
nr_bulk_skip++;
280290
istate->cache[pos]->ce_flags &= ~CE_SKIP_WORKTREE;
281291
pos++;
282292
}
283293
}
284294
} else {
285295
if (ignore_case) {
286296
struct cache_entry *ce = index_file_exists(istate, entry, len, ignore_case);
287-
if (ce)
297+
if (ce) {
298+
if (ce->ce_flags & CE_SKIP_WORKTREE)
299+
nr_explicit_skip++;
288300
ce->ce_flags &= ~CE_SKIP_WORKTREE;
301+
}
302+
else {
303+
nr_unknown++;
304+
}
289305
} else {
290306
int pos = index_name_pos(istate, entry, len);
291-
if (pos >= 0)
307+
if (pos >= 0) {
308+
if (istate->cache[pos]->ce_flags & CE_SKIP_WORKTREE)
309+
nr_explicit_skip++;
292310
istate->cache[pos]->ce_flags &= ~CE_SKIP_WORKTREE;
311+
}
312+
else {
313+
nr_unknown++;
314+
}
293315
}
294316
}
295317

296318
entry += len + 1;
297319
}
298320
}
321+
322+
if (nr_vfs_rows > 0) {
323+
trace2_data_intmax("vfs", the_repository, "apply/tracked", nr_bulk_skip + nr_explicit_skip);
324+
325+
trace2_data_intmax("vfs", the_repository, "apply/vfs_rows", nr_vfs_rows);
326+
trace2_data_intmax("vfs", the_repository, "apply/vfs_dirs", nr_vfs_dirs);
327+
328+
trace2_data_intmax("vfs", the_repository, "apply/nr_unknown", nr_unknown);
329+
trace2_data_intmax("vfs", the_repository, "apply/nr_bulk_skip", nr_bulk_skip);
330+
trace2_data_intmax("vfs", the_repository, "apply/nr_explicit_skip", nr_explicit_skip);
331+
}
299332
}
300333

301334
/*

0 commit comments

Comments
 (0)