UploadFile
Allows uploading files to a repository for storage, collaboration, or integration into the project.
Sample
The 'Path' parameter is required, and must be relative to the repository root without a preceding '/'.
EXECUTE [Repository_MyRepository].[UploadFile] Path='testFileUploadFromProcedure.txt', LocalPath='C:/Users/CData/Desktop/project/file.txt', CommitMessage='test'
Alternatively, set the connection property Schema to the desired repository.
EXECUTE [UploadFile] Path='testFileUploadFromProcedure.txt', LocalPath='C:/Users/CData/Desktop/project/file.txt', CommitMessage='test'
EXECUTE [UploadFile] Repository='HelloGit', Path='src/Main.java', FileData='aGVsbG8gd29ybGQh', CommitMessage='test', Branch='master', CommitterName='CData', CommitterEmail='[email protected]', AuthorName='CDataSupport', AuthorEmail='[email protected]'
Set SHA to replace an existing file.
EXECUTE [UploadFile] Repository='HelloGit', Path='src/Main.java', FileData='aGVsbG8gd29ybGQh', CommitMessage='test', SHA='bc7774a7b18deb1d7bd0212d34246a9b1260ae17'
Input
Name | Type | Description |
Path | String | The relative file path within the repository where the file is uploaded. |
Branch | String | The branch to which the file is uploaded. This defaults to 'main' if no branch is specified.
The default value is main. |
CommitMessage | String | The message describing the changes made during the file upload. |
SHA | String | The hash of the file, used to verify and update existing files in the repository. |
CommitterName | String | The name of the person committing the file. This defaults to the authenticated user if one is not provided. |
CommitterEmail | String | The email address of the person committing the file. This defaults to the authenticated user's email address if no email address is provided. |
AuthorName | String | The name of the original author of the file being committed. This defaults to the committer's name or the authenticated user if the name is omitted. |
AuthorEmail | String | The email address of the original author of the file being committed. This defaults to the committer's email or the authenticated user's email if the email address is omitted. |
LocalPath | String | The absolute file path on the local system from which the file data is read. |
FileData | String | The Base64-encoded string representation of the file's content. This is used only if LocalPath and InputStream are not provided. |
Result Set Columns
Name | Type | Description |
Success | Boolean | A Boolean value indicating whether the file upload operation was successful. |
Details | String | Additional details about the execution of the file upload operation, such as errors or status messages. |
CommitSHA | String | The hash of the commit that includes the uploaded file. |
FileSHA | String | The hash of the uploaded file node within the repository. |