public RepositoryFile getFileInfo ( Object projectIdOrPath , String filePath , String ref ) throws GitLabApiException { Form form = new Form ( ) ; addFormParam ( form , "ref" , ref , true ) ; Response response = head ( Response . Status . OK , form . asMap ( ) , "projects" , getProjectIdOrPath ( projectIdOrPath ) , "repository" , "files" , urlEncode ( filePath ) ) ; RepositoryFile file = new RepositoryFile ( ) ; file . setBlobId ( response . getHeaderString ( "X-Gitlab-Blob-Id" ) ) ; file . setCommitId ( response . getHeaderString ( "X-Gitlab-Commit-Id" ) ) ; file . setEncoding ( response . getHeaderString ( "X-Gitlab-Encoding" ) ) ; file . setFileName ( response . getHeaderString ( "X-Gitlab-File-Name" ) ) ; file . setFilePath ( response . getHeaderString ( "X-Gitlab-File-Path" ) ) ; file . setLastCommitId ( response . getHeaderString ( "X-Gitlab-Last-Commit-Id" ) ) ; file . setRef ( response . getHeaderString ( "X-Gitlab-Ref" ) ) ; String sizeStr = response . getHeaderString ( "X-Gitlab-Size" ) ; file . setSize ( sizeStr != null ? Integer . valueOf ( sizeStr ) : - 1 ) ; return ( file ) ; }
Get information on a file in the repository . Allows you to receive information about file in repository like name size . Only works with GitLab 11 . 1 . 0 + returns an empty object for earlier versions of GitLab .