]> git.lyx.org Git - features.git/blobdiff - src/VCBackend.cpp
Replacing git status --porcelain along with output parsing, with a simple git ls...
[features.git] / src / VCBackend.cpp
index e3cfed340446f590b2b2c816bc4ecc7d6b6b4464..cec36fce065d83028f47363e77fa8204baba1b20 100644 (file)
@@ -1833,32 +1833,14 @@ FileName const GIT::findFile(FileName const & file)
                return FileName();
        }
 
-       // --porcelain selects a format that is supposed to be stable across
-       // git versions
        string const fname = onlyFileName(file.absFileName());
        LYXERR(Debug::LYXVC, "LyXVC: Checking if file is under git control for `"
                        << fname << '\'');
-       bool found = 0 == doVCCommandCall("git status --porcelain " +
-                               quoteName(fname) + " > " +
-                               quoteName(tmpf.toFilesystemEncoding()),
+       doVCCommandCall("git ls-files " +
+                       quoteName(fname) + " > " +
+                       quoteName(tmpf.toFilesystemEncoding()),
                        file.onlyPath());
-       if (found)
-       {
-               // The output is empty for file names NOT in repo.
-               // The output contains a line starting with "??" for unknown
-               // files, no line for known unmodified files and a line
-               // starting with "M" or something else for modified/deleted
-               // etc. files.
-               if (tmpf.isFileEmpty())
-                       found = false;
-               else {
-                       ifstream ifs(tmpf.toFilesystemEncoding().c_str());
-                       string test;
-                       if ((ifs >> test))
-                               found = (test != "??");
-                       // else is no error
-               }
-       }
+       bool found = !tmpf.isFileEmpty();
        tmpf.removeFile();
        LYXERR(Debug::LYXVC, "GIT control: " << (found ? "enabled" : "disabled"));
        return found ? file : FileName();