Skip to content

RepositoryFile.setContent seems to truncate the last eol  #136

@mbush78

Description

@mbush78

When I use createFile() the file that arrives in GitLab is missing any/all blank lines at the end of the file, blank lines throughout the file are not effected.

Thus the file I get when checked out in Linux reports noeol, in for example vim.

I tried adding \n to the String object as its passed to setContent() but it was stripped off as well.
If I write the same String to File on disk the blank lines are at the bottom as expected.

Here's the way I have the code...
someTextString = new String(Files.readAllBytes(Paths.get("thePathToSomeFile"))); RepositoryFileApi repositoryFileApi = new RepositoryFileApi(gitLabApi); RepositoryFile repositoryFile = new RepositoryFile(); repositoryFile.setFilePath("somePath"); repositoryFile.setContent(someTextString); repositoryFileApi.createFile(repositoryFile, 123456, "master", "Initial Commit");

I don't know if I'm doing something wrong, if this is expected, or what. I seems pretty straight forward.

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions