Skip to content

provide simple option to set unix style on windows platform(Git Bash) #1959

Closed
@xheke

Description

@xheke
  • I was not able to find an open or closed issue matching what I'm seeing

Setup

  • Which version of Git for Windows are you using? Is it 32-bit or 64-bit?
$ git --version --build-options

** insert your machine's response here **

git version 2.19.2.windows.1
cpu: x86_64
built from commit: 26dcaa1
sizeof-long: 4
sizeof-size_t: 8

  • Which version of Windows are you running? Vista, 7, 8, 10? Is it 32-bit or 64-bit?
$ cmd.exe /c ver

** insert your machine's response here **

Microsoft Windows [Version 10.0.16299.726]

  • What options did you set as part of the installation? Or did you choose the
    defaults?
# One of the following:
> type "C:\Program Files\Git\etc\install-options.txt"
> type "C:\Program Files (x86)\Git\etc\install-options.txt"
> type "%USERPROFILE%\AppData\Local\Programs\Git\etc\install-options.txt"
$ cat /etc/install-options.txt

** insert your machine's response here **

$ cat /etc/install-options.txt
Editor Option: VIM
Custom Editor Path:
Path Option: Cmd
SSH Option: OpenSSH
CURL Option: OpenSSL
CRLF Option: LFOnly
Bash Terminal Option: MinTTY
Performance Tweaks FSCache: Enabled
Use Credential Manager: Enabled
Enable Symlinks: Disabled

  • Any other interesting things about your environment that might be related
    to the issue you're seeing?

** insert your response here **

Details

  • Which terminal/shell are you running Git from? e.g Bash/CMD/PowerShell/other

** insert your response here **
GIT bash

** insert your commands here **

git apply ../diff/abc.diff

  • What did you expect to occur after running these commands?

** insert here **

We want prevent commit code files with DOS format to repository.

Therefore, we enable client standard/default pre-commit hook on both Linux side and Windows side.

The hook works fine on Linux side as expected, but not works on Windows side.

We also observed that when we try to import diff with new DOS format files on the Linux side, GIT will report some whitespace warnings and this may lead commit failure with pre-commit hook impact. However, nothing happened on windows side if we do the same commands, and the commit will success even we enable the same pre-commit hook on Windows side.

We hope team can work with same style, no matter he/she work on Linux side or Windows side.

The behavior is different between Windows side and Linux side currently. In addition, we try to set core.autocrlf and core.safecrlf on Windows side, anyway, it does not prevent commit. Therefore, we hope if there have simple option to set like Linux-style on GIT bash (Windows Side) to simulate Linux environment (perhaps just for file format checking is enough) on Windows side.

  • What actually happened instead?

** insert here **
no whitespace warnings report

  • If the problem was occurring with a specific repository, can you provide the
    URL to that repository to help us with testing?

** insert URL here **

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