| Class | Gitlab::Git::Blob |
| In: |
lib/gitlab_git/blob.rb
|
| Parent: | Object |
| MAX_DATA_DISPLAY_SIZE | = | 10485760 | This number is the maximum amount of data that we want to display to the user. We load as much as we can for encoding detection (Linguist) and LFS pointer parsing. All other cases where we need full blob data should use load_all_data!. |
| binary | [RW] | |
| commit_id | [RW] | |
| data | [RW] | |
| id | [RW] | |
| loaded_size | [RW] | |
| mode | [RW] | |
| name | [RW] | |
| path | [RW] | |
| size | [RW] |
Commit file in repository and return commit sha
options should contain next structure:
file: {
content: 'Lorem ipsum...',
path: 'documents/story.txt',
update: true
},
author: {
email: 'user@example.com',
name: 'Test User',
time: Time.now
},
committer: {
email: 'user@example.com',
name: 'Test User',
time: Time.now
},
commit: {
message: 'Wow such commit',
branch: 'master',
update_ref: false
}
Recursive search of blob id by path
Ex.
blog/ # oid: 1a
app/ # oid: 2a
models/ # oid: 3a
file.rb # oid: 4a
Blob.find_entry_by_path(repo, ‘1a’, ‘app/file.rb’) # => ‘4a‘
Remove file from repository and return commit sha
options should contain next structure:
file: {
path: 'documents/story.txt'
},
author: {
email: 'user@example.com',
name: 'Test User',
time: Time.now
},
committer: {
email: 'user@example.com',
name: 'Test User',
time: Time.now
},
commit: {
message: 'Remove FILENAME',
branch: 'master'
}
Rename file from repository and return commit sha
options should contain next structure:
file: {
previous_path: 'documents/old_story.txt'
path: 'documents/story.txt'
content: 'Lorem ipsum...',
update: true
},
author: {
email: 'user@example.com',
name: 'Test User',
time: Time.now
},
committer: {
email: 'user@example.com',
name: 'Test User',
time: Time.now
},
commit: {
message: 'Rename FILENAME',
branch: 'master'
}
Valid LFS object pointer is a text file consisting of version oid size see github.com/github/git-lfs/blob/v1.1.0/docs/spec.md#the-pointer
Load all blob data (not just the first MAX_DATA_DISPLAY_SIZE bytes) into memory as a Ruby string.