RepositoryService: implement GetFileAttributes
Initially created by the upstream merge process.
A first implementation returning an empty list would be enough to prevent any breakage due to UNIMPLEMENTED
error status.
This seems to be already exposed on repository objects in the Rails app as of v16.5.0, but not used at higher level as of v16.6.0.
Upstream merge commit heptapod@5ef45e4165f5 changes Gitaly server version from 6ad2a2fa454f597b6b7470f27667df1cc5a7d54e to e4ef83d2ee01bc5b072cf4ee4591b75a1c38943d, with changes in protocol or one of the source subtrees currently under watch.
To further inspect, go to an up to date Gitaly source clone and run
diff 6ad2a2fa454f597b6b7470f27667df1cc5a7d54e..e4ef83d2ee01bc5b072cf4ee4591b75a1c38943d -- proto/*.proto internal/backup
. Here is a preview, truncated at 500 lines:
diff --git a/proto/log.proto b/proto/log.proto
index f348b3f3a..278713735 100644
--- a/proto/log.proto
+++ b/proto/log.proto
@@ -39,20 +39,23 @@ message LogEntry {
message RepositoryDeletion {
}
+ // relative_path is the relative path of the repository the changes in the
+ // log entry are targeting.
+ string relative_path = 1;
// reference_updates contains the reference updates this log
// entry records. The logged reference updates have already passed
// through verification and are applied without any further checks.
- repeated ReferenceUpdate reference_updates = 1;
+ repeated ReferenceUpdate reference_updates = 2;
// default_branch_update contains the information pertaining to updating
// the default branch of the repo.
- DefaultBranchUpdate default_branch_update = 2;
+ DefaultBranchUpdate default_branch_update = 3;
// custom_hooks_update contains the custom hooks to set in the repository.
- CustomHooksUpdate custom_hooks_update = 3;
+ CustomHooksUpdate custom_hooks_update = 4;
// pack_prefix contains the prefix (`pack-<digest>`) of the pack and its index.
// If pack_prefix is empty, the log entry has no associated pack.
- string pack_prefix = 4;
+ string pack_prefix = 5;
// repository_deletion, when set, indicates this log entry deletes the repository.
- RepositoryDeletion repository_deletion = 5;
+ RepositoryDeletion repository_deletion = 6;
}
// LogIndex serializes a log index. It's used for storing a repository's
diff --git a/proto/repository.proto b/proto/repository.proto
index 4af42c1ea..7e7ae718c 100644
--- a/proto/repository.proto
+++ b/proto/repository.proto
@@ -400,6 +400,13 @@ service RepositoryService {
op: MUTATOR
};
}
+
+ // GetFileAttributes queries given file attributes as specified in .gitattributes file
+ rpc GetFileAttributes(GetFileAttributesRequest) returns (GetFileAttributesResponse) {
+ option (op_type) = {
+ op: ACCESSOR
+ };
+ }
}
// RepositoryExistsRequest ...
@@ -1299,3 +1306,32 @@ message RestoreRepositoryResponse {
message SkippedError {
}
}
+
+// GetFileAttributesRequest is a request for the GetFileAttributes RPC.
+message GetFileAttributesRequest {
+ // repository is the repository the file attributes shall be computed in.
+ Repository repository = 1 [(target_repository)=true];
+ // revision is the revision where the file attributes shall be computed in.
+ bytes revision = 2;
+ // attributes are the attributes that will be queried for.
+ repeated string attributes = 3;
+ // paths are the file paths that will be queried for.
+ repeated string paths = 4;
+}
+
+// GetFileAttributesResponse is a response for the GetFileAttributes RPC.
+message GetFileAttributesResponse {
+ // AttributeInfo is a specified git attribute for a given path.
+ message AttributeInfo {
+ // path is the file path for the current attribute value.
+ string path = 1;
+ // attribute is the name of the attribute.
+ string attribute = 2;
+ // value is the current value of the attribute.
+ // "set" is used when the attribute is true, and "unset" when it's false.
+ // See gitattributes(5) and git-check-attr(1) for more info.
+ string value = 3;
+ }
+ // attribute_infos is the list of attributes that matches the given GetFileAttributesRequest
+ repeated AttributeInfo attribute_infos = 1;
+}
A merge request may have already been submitted, check that on [merge commit commit](heptapod@5ef45e4165f5, as usually changes in Gitaly are not breaking, compliance becoming mandatory in the following development cycles.