不为.m matlab文件做git CRLF转换? [英] Not doing git CRLF conversion for .m matlab files?

查看:171
本文介绍了不为.m matlab文件做git CRLF转换?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

即使在Windows上,Matlab .m文件也使用Unix LF行尾。我期望设置git配置文件,以便.m文件不会被其他普通文本文件转换回CRLF(即,我使用LF作为回购库中的默认样式,即使它的Windows)。



可以这样做吗?
$ b编辑:从Matlab 2008b手册。 (在编辑和调试M文件下)
$ b


行结束符在MATLAB软件提供的文件中删除
Windows平台;影响在记事本应用程序中查看

在以前的版本中,MATLAB for Windows
平台提供的文本文件在每个$ b的末尾包含回车符和换行符$ b线。从R2007b开始,MATLAB提供的文本文件不会在每行末尾包含回车符和换行符。



受影响的文件类型为:
.asc
.bat
.c
.cc
.cdr
.cpp
.def
。for
gs.rights
.h
.ini
.m
.mdl
.pl
自述
.tlc
。 tmf
.txt p

如果您在MATLAB和其他常见的
文本编辑器中查看这些文件,但没有影响记事本
应用程序。



兼容性注意事项。如果您使用记事本应用程序查看MATLAB提供的
视图文件,您将看到回车符和换行符
符号而不是行结束符。这使
记事本应用程序中的文件不易读取。其他文本编辑器可能会显示符号
而不是行结尾,但是测试过的常见文本编辑器中,没有发现
这样做。



作为记事本应用程序的替代方法,请使用随Windows平台提供的Microsoft
写字板应用程序或其他文本
编辑器来查看这些文件。



解决方案>

core.autocrlf config设置为false, core。

  lf  [core] 
autocrlf = false
eol = lf

另外,查看<$ c $下的 gitattributes c>检出和检入


Matlab .m files use the Unix LF line endings even on Windows. I'm look to set up the git config file so that the .m files are not converted back to CRLF as other regular text files would be (i.e. I am using LF as the default style within the repo, even though its Windows).

Can this be done?

EDIT: from Matlab 2008b manual. (under Editing and Debugging M-Files)

Line Endings Removed in Files Provided with MATLAB Software for Windows Platforms; Impacts Viewing in Notepad Application

In previous versions, text files provided with MATLAB for Windows platforms included a carriage return and line feed at the end of each line. Starting in R2007b, the text files MATLAB provides do not include a carriage return and line feed at the end of each line.

File types affected are: .asc .bat .c .cc .cdr .cpp .def .for gs.rights .h .ini .m .mdl .pl readme .tlc .tmf .txt

There is no impact if you view the files in MATLAB and other common text editors, with the known exception of the Microsoft Notepad application.

Compatibility Considerations. If you use the Notepad application to view files provided with MATLAB, you see carriage return and line feed symbols instead of line endings. This makes the files less readable in the Notepad application. Other text editors might display the symbols instead of line endings, but of the common text editors tested, none have been found that do so.

As an alternative to the Notepad application, use the Microsoft WordPad application, provided with Windows platforms, or another text editor to view the files.

解决方案

Set the core.autocrlf config to false and core.eol to lf on Windows.

[core]
    autocrlf = false
    eol = lf

Also, have a look at gitattributes under Checking-out and checking-in

这篇关于不为.m matlab文件做git CRLF转换?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆