agentHostGitService.ts ×10

Frontier kind: Code frontier

unlabeled · c_562ea6027fd7

3 tests · 18310 LOC · 61 files · introduces 0 tests · 60 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
10 ranges60 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1850 ranges18310 lines · 61 files · Browse complete extent
All tests (intent)
3 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 60 introduced LOC across 10 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/platform/agentHost/node/agentHostGitService.ts 60 introduced LOC · 10 ranges

Open complete file

983 const segment = segments[i++];
984 if (!segment) { continue; }
986 > if (segment.startsWith(':')) {
987 > // Raw line: ":<srcMode> <dstMode> <srcSha> <dstSha> <status>"
988 > // followed by NUL-separated path(s).
989 > const fields = segment.split(' ');
990 > const status = fields[4] ?? '';
991 > const path1 = segments[i++];
992 > if (!path1) { continue; }
993 >
994 > switch (status[0]) {
995 > case 'A':
996 changes.push({ kind: FileEditKind.Create, newPath: path1 });
997 break;
998 > case 'M': agentHostGitService.ts
999 > changes.push({ kind: FileEditKind.Edit, oldPath: path1, newPath: path1 });
1000 > break;
1001 > case 'D':
1002 changes.push({ kind: FileEditKind.Delete, oldPath: path1 });
1003 break;
1004 > case 'R': { agentHostGitService.ts
1005 const path2 = segments[i++];
1006 if (!path2) { continue; }
1008 break;
1009 }
1010 > default: agentHostGitService.ts
1011 break;
1013 > } else {
1014 > // Numstat line: "<added>\t<removed>\t<path>" or, for renames,
1015 > // "<added>\t<removed>\t" followed by NUL-separated old/new paths.
1016 > const [addedStr, removedStr, filePath] = segment.split('\t');
1017 > let key: string;
1018 > if (filePath === '' || filePath === undefined) {
1019 const oldPath = segments[i++];
1020 const newPath = segments[i++];
1021 key = newPath ?? oldPath ?? '';
1022 > } else { agentHostGitService.ts
1023 > key = filePath;
1024 > }
1025 > if (!key) { continue; }
1026 > numStats.set(key, {
1027 > added: addedStr === '-' ? 0 : Number(addedStr) || 0,
1028 > removed: removedStr === '-' ? 0 : Number(removedStr) || 0,
1029 > });
1030 > }
1031 }
1032
1033 return changes.map(change => {
1034 > const stats = numStats.get(change.newPath ?? change.oldPath ?? ''); agentHostGitService.ts
1035 >
1036 > const beforeFileUri = change.oldPath ? URI.joinPath(repositoryRoot, change.oldPath) : undefined;
1037 > const afterFileUri = change.newPath ? URI.joinPath(repositoryRoot, change.newPath) : undefined;
1038 >
1039 > const before = change.kind !== FileEditKind.Create && change.oldPath && beforeFileUri
1040 > ? {
1041 > uri: beforeFileUri.toString(),
1042 > content: { uri: buildGitBlobUri(sessionUri, beforeRef, change.oldPath, beforeFileUri.path) },
1043 > }
1044 : undefined;
1046 > const after = change.kind !== FileEditKind.Delete && change.newPath && afterFileUri
1047 > ? {
1048 > uri: afterFileUri.toString(),
1049 > content: afterRef !== undefined
1050 ? { uri: buildGitBlobUri(sessionUri, afterRef, change.newPath, afterFileUri.path) }
1051 : { uri: afterFileUri.toString() }
1053 : undefined;
1055 > const diff = {
1056 > added: stats?.added ?? 0,
1057 > removed: stats?.removed ?? 0
1058 > };
1059 >
1060 > return {
1061 > ...(before ? { before } : {}),
1062 > ...(after ? { after } : {}),
1063 > diff
1064 > };
1065 });
1066 }