Skip to content

GitLab

  • Menu
    • Projects Groups Snippets
      Help
Projects Groups Snippets
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
  • G gitlabhq1
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 21
    • Issues 21
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 12
    • Merge requests 12
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Infrastructure Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • gpt
  • large_projects
  • gitlabhq1
  • Issues
  • #7950

Closed
Open
Created 10 years ago by Administrator@rootOwner
  • New issue

  • Report abuse

  • New issue

  • Report abuse

Edit on web interface adds carriage returns to file.

Closed

Edit on web interface adds carriage returns to file.

Created by: cirosantilli

This only happens on master, not on gitlab.com.

To reproduce:

  • create a new repo
  • create a file locally that ends in newline: echo a. Double check it has no carriage return: hd a.
  • push to the new repo
  • clone somewhere else: hd a says the file hasn't changed as expected.
  • go to the edit blob view on the web interface
  • don't modify the file content: keep it as it.
  • enter commit message
  • commit. Surprise! Should not commit because no changes.
  • clone again somewhere else. Suprise! The file has carriage returns.

Normally, this shouldn't make the commit since the file was not changed, but it does as carriage returns were added.

This is exposed at the following test: https://github.com/gitlabhq/gitlabhq/pull/7856/files#r18390519 which I added to an untested feature.

Does anyone reproduce? If yes, I consider this is a critical bug which affects repository integrity.

This may be https://github.com/gitlabhq/gitlabhq/issues/3982 v2

Linked issues
...

    Related merge requests

    • Administrator
      Administrator @root · 10 years ago
      Owner

      Created by: mr-vinn

      I think this is controlled with a git setting - see #3982. You might have to run git config --global core.autocrlf "input".

      By Administrator on 2014-10-13T20:01:33 (imported from GitLab project)

    • Administrator
      Administrator @root · 10 years ago
      Owner

      Created by: x3ro

      I just had the same problem with a rather old installation and can confirm that running

      sudo -u git -H git config --global core.autocrlf input

      on the server in question solved the problem.

      By Administrator on 2014-10-15T16:18:59 (imported from GitLab project)

    • Administrator
      Administrator @root · 10 years ago
      Owner

      Created by: cirosantilli

      Thanks for the tip @mr-vinn and @x3ro. I propose leaving this open until something is done about it.

      The ideal solution would be to modify the per-repository configs with gitlab-shell since it is not generally a good idea to automatically modify the global config on the automated installation methods.

      By Administrator on 2014-10-15T16:49:24 (imported from GitLab project)

    • Administrator
      Administrator @root · 10 years ago
      Owner

      Created by: mr-vinn

      @cirosantilli The gitlab_git gem could also handle this via Rugged::Repository#config. I think it would be sufficient to enable autocrlf in the satellite repo, but I'd have to test that to be sure. I suppose the Gitlab::Satellite::Satellite class could interact with Rugged directly, but I think it would be better to go through the gem. I'll submit a PR to gitlab_git for a shortcut method, something like #enable_autocrlf. Then it should be trivial to add that to the satellite constructor.

      By Administrator on 2014-10-17T05:36:51 (imported from GitLab project)

    • Administrator
      Administrator @root · 10 years ago
      Owner

      Created by: cirosantilli

      @mr-vinn cool, that does look like a promising place to fix things, and it would be robust.

      By Administrator on 2014-10-17T07:20:45 (imported from GitLab project)

    • Administrator
      Administrator @root · 10 years ago
      Owner

      Created by: dblessing

      Yep, just got bit by this.

      By Administrator on 2014-11-12T21:08:31 (imported from GitLab project)

    • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
    Please register or sign in to reply
    0 Assignees
    Assign to
    Milestone
    No milestone
    None
    None
    Time tracking
    Due date
    None
    None
    0
    Labels
    None
    Assign labels
    • No matching results
    • Manage project labels
    Confidentiality
    Not confidential

    You are going to turn on confidentiality. Only team members with at least Reporter access will be able to see and leave comments on the issue.

    Lock issue
    Unlocked
    participants
    Reference:

    Menu

    Projects Groups Snippets
    Help