Merge branch 'feat/file-omission' into main (!5)
2 files · +177 -70
M gen/ermite/git.pb.go +152 -67 generated file: collapsed
M proto/ermite/git.proto +25 -3
| @@ -53,6 +53,24 @@ enum FileStatus { | |||
| 53 | 53 | FILE_STATUS_TYPE_CHANGED = 6; | |
| 54 | 54 | } | |
| 55 | 55 | ||
| 56 | + | // FileOmission tells why a changed file has no hunks although it changed. | |
| 57 | + | enum FileOmission { | |
| 58 | + | // The file is not omitted: its hunks are present, or it has none to show | |
| 59 | + | // (binary, pure rename, mode change), or it is outside the requested window. | |
| 60 | + | FILE_OMISSION_UNSPECIFIED = 0; | |
| 61 | + | // The file is generated or vendored, by its path: its hunks were not read. | |
| 62 | + | // It can be read on its own. | |
| 63 | + | FILE_OMISSION_GENERATED = 1; | |
| 64 | + | // The file changes more lines than the per-file limit. It can be read on its own. | |
| 65 | + | FILE_OMISSION_LARGE = 2; | |
| 66 | + | // The file did not fit in what remained of the total limits of the diff. | |
| 67 | + | // It can be read on its own. | |
| 68 | + | FILE_OMISSION_BUDGET = 3; | |
| 69 | + | // The file's text exceeds the memory limit of a diff: it cannot be shown, | |
| 70 | + | // even on its own. Clone the repository to read it. | |
| 71 | + | FILE_OMISSION_UNAVAILABLE = 4; | |
| 72 | + | } | |
| 73 | + | ||
| 56 | 74 | // LineKind tells how a line of a hunk relates to the two sides of a diff. | |
| 57 | 75 | enum LineKind { | |
| 58 | 76 | // Not set. Never returned. | |
| @@ -335,8 +353,8 @@ message Diff { | |||
| 335 | 353 | // Files are the changed files, ordered by path. Files past the file limit are | |
| 336 | 354 | // omitted. | |
| 337 | 355 | repeated FileDiff files = 1; | |
| 338 | - | // Truncated is true when the diff is incomplete: files were omitted, or at | |
| 339 | - | // least one listed file has truncated set. DiffStats still count everything. | |
| 356 | + | // Truncated is true when the diff is incomplete: files were omitted past the | |
| 357 | + | // file limit, or at least one listed file has omitted set. DiffStats still count everything. | |
| 340 | 358 | bool truncated = 2; | |
| 341 | 359 | } | |
| 342 | 360 | ||
| @@ -367,11 +385,15 @@ message FileDiff { | |||
| 367 | 385 | // copied file, and 0 otherwise. | |
| 368 | 386 | int32 similarity = 11; | |
| 369 | 387 | // Truncated is true when the file exceeded a diff limit: hunks is then empty | |
| 370 | - | // although the file changed. Additions and deletions remain accurate. | |
| 388 | + | // although the file changed. Additions and deletions remain accurate. It is | |
| 389 | + | // kept for compatibility and equals omitted != FILE_OMISSION_UNSPECIFIED. | |
| 371 | 390 | bool truncated = 12; | |
| 372 | 391 | // Hunks are the changed regions, in file order. Empty for a binary file, a | |
| 373 | 392 | // truncated file, a pure rename and a mode-only change. | |
| 374 | 393 | repeated Hunk hunks = 13; | |
| 394 | + | // Omitted tells why hunks is empty although the file changed. truncated is | |
| 395 | + | // true exactly when omitted is not FILE_OMISSION_UNSPECIFIED. | |
| 396 | + | FileOmission omitted = 14; | |
| 375 | 397 | } | |
| 376 | 398 | ||
| 377 | 399 | // Hunk is a contiguous changed region with its context. | |
| @@ -53,6 +53,24 @@ enum FileStatus { | |||||
| 53 | FILE_STATUS_TYPE_CHANGED = 6; | 53 | FILE_STATUS_TYPE_CHANGED = 6; | ||
| 54 | } | 54 | } | ||
| 55 | 55 | ||||
| 56 | + | // FileOmission tells why a changed file has no hunks although it changed. | |||
| 57 | + | enum FileOmission { | |||
| 58 | + | // The file is not omitted: its hunks are present, or it has none to show | |||
| 59 | + | // (binary, pure rename, mode change), or it is outside the requested window. | |||
| 60 | + | FILE_OMISSION_UNSPECIFIED = 0; | |||
| 61 | + | // The file is generated or vendored, by its path: its hunks were not read. | |||
| 62 | + | // It can be read on its own. | |||
| 63 | + | FILE_OMISSION_GENERATED = 1; | |||
| 64 | + | // The file changes more lines than the per-file limit. It can be read on its own. | |||
| 65 | + | FILE_OMISSION_LARGE = 2; | |||
| 66 | + | // The file did not fit in what remained of the total limits of the diff. | |||
| 67 | + | // It can be read on its own. | |||
| 68 | + | FILE_OMISSION_BUDGET = 3; | |||
| 69 | + | // The file's text exceeds the memory limit of a diff: it cannot be shown, | |||
| 70 | + | // even on its own. Clone the repository to read it. | |||
| 71 | + | FILE_OMISSION_UNAVAILABLE = 4; | |||
| 72 | + | } | |||
| 73 | + | ||||
| 56 | // LineKind tells how a line of a hunk relates to the two sides of a diff. | 74 | // LineKind tells how a line of a hunk relates to the two sides of a diff. | ||
| 57 | enum LineKind { | 75 | enum LineKind { | ||
| 58 | // Not set. Never returned. | 76 | // Not set. Never returned. | ||
| @@ -335,8 +353,8 @@ message Diff { | |||||
| 335 | // Files are the changed files, ordered by path. Files past the file limit are | 353 | // Files are the changed files, ordered by path. Files past the file limit are | ||
| 336 | // omitted. | 354 | // omitted. | ||
| 337 | repeated FileDiff files = 1; | 355 | repeated FileDiff files = 1; | ||
| 338 | - | // Truncated is true when the diff is incomplete: files were omitted, or at | 356 | + | // Truncated is true when the diff is incomplete: files were omitted past the |
| 339 | - | // least one listed file has truncated set. DiffStats still count everything. | 357 | + | // file limit, or at least one listed file has omitted set. DiffStats still count everything. |
| 340 | bool truncated = 2; | 358 | bool truncated = 2; | ||
| 341 | } | 359 | } | ||
| 342 | 360 | ||||
| @@ -367,11 +385,15 @@ message FileDiff { | |||||
| 367 | // copied file, and 0 otherwise. | 385 | // copied file, and 0 otherwise. | ||
| 368 | int32 similarity = 11; | 386 | int32 similarity = 11; | ||
| 369 | // Truncated is true when the file exceeded a diff limit: hunks is then empty | 387 | // Truncated is true when the file exceeded a diff limit: hunks is then empty | ||
| 370 | - | // although the file changed. Additions and deletions remain accurate. | 388 | + | // although the file changed. Additions and deletions remain accurate. It is |
| 389 | + | // kept for compatibility and equals omitted != FILE_OMISSION_UNSPECIFIED. | |||
| 371 | bool truncated = 12; | 390 | bool truncated = 12; | ||
| 372 | // Hunks are the changed regions, in file order. Empty for a binary file, a | 391 | // Hunks are the changed regions, in file order. Empty for a binary file, a | ||
| 373 | // truncated file, a pure rename and a mode-only change. | 392 | // truncated file, a pure rename and a mode-only change. | ||
| 374 | repeated Hunk hunks = 13; | 393 | repeated Hunk hunks = 13; | ||
| 394 | + | // Omitted tells why hunks is empty although the file changed. truncated is | |||
| 395 | + | // true exactly when omitted is not FILE_OMISSION_UNSPECIFIED. | |||
| 396 | + | FileOmission omitted = 14; | |||
| 375 | } | 397 | } | ||
| 376 | 398 | ||||
| 377 | // Hunk is a contiguous changed region with its context. | 399 | // Hunk is a contiguous changed region with its context. | ||