D
D
Dmitry2016-12-15 06:21:41
git
Dmitry, 2016-12-15 06:21:41

How to solve git/phpstorm line separator problem?

Good morning.
Transferred the project from a laptop to a computer through copying, first from a laptop to a USB flash drive, then from a USB flash drive to a computer.
Saved phpstorm settings through settings export.
Now I'm trying to make a commit to git - this warning appears:
3d57b45c253a459bbc61b1905262351c.png
How to solve this problem? Select "Fix and Commit", won't this break the site on the server?
p.s. What could be causing this issue? On a laptop ubuntu 14.04 + php v.5.9, on a computer ubuntu 16.04 + php v.7.0

Answer the question

In order to leave comments, you need to log in

5 answer(s)
I
Ilya Karavaev, 2016-12-15
@Quieteroks

To you the message on "an error" gave already the answer to your question. You need to set up GIT, not PHPStorm. And even a command was written to you that you need to execute.
Nothing should break. It's just a way of wrapping lines in files.

I
index0h, 2016-12-15
@index0h

How to solve this problem?

Do not use CRLF
Perhaps the file was originally created under Windows, or you explicitly indicated to use CRLF.
Alternatively, create a .gitattributes file in the project directory with the following content (if your file extensions are missing, add by analogy)
*.php text eol=lf
*.js  text eol=lf
*.sh  text eol=lf
*.sql text eol=lf

*.json text eol=lf

*.yaml     text eol=lf
*.yml      text eol=lf
*.yml.dist text eol=lf

*.xml      text eol=lf
*.xml.dist text eol=lf

*.css  text eol=lf
*.less text eol=lf

*.jade text eol=lf
*.twig text eol=lf

composer.lock text eol=lf

.htaccess text eol=lf
.bowerrc  text eol=lf
.jshintrc text eol=lf

*.j2   text eol=lf
*.conf text eol=lf
*.md   text eol=lf

In this case, git will replace CRLF with LF on its own.

V
Valera Figol, 2017-04-28
@Kamrit

If I understand the tasks correctly:

public bool IsContains(string[] mas, string name){
foreach(int i in mas.Length){
if(i.Contains(name) return true;
}
return false;
}

R
Rsa97, 2017-04-28
@Rsa97

Method Array.Exists(T[], Predicate)

A
Alexander Ter, 2017-04-28
@alexsandr0000

It's possible, of course, but it's not the best implementation.

public static void Main(string[] args)
 {
      string[] names = { "васе", "пете", "коле" };
            var names2 = "Позвонить ";
            var readline = Console.ReadLine();
            //поиск имени
            var word = names.FirstOrDefault(n => (names2 + n) == readline);

            if (!string.IsNullOrEmpty(word))
            {
                Console.WriteLine("Вызов" + names.Aggregate((a, b) => a + ", " + b));
            }
            else
            {
                Console.WriteLine("Ошибка");
            }
            Console.ReadLine();
 }

But as a quick fix it will do.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question