]> git.lyx.org Git - lyx.git/blobdiff - src/VCBackend.cpp
FindAdv: Amend ec387b6d: Handle search for '{' and '}'
[lyx.git] / src / VCBackend.cpp
index 01d546d3d4637064cb7a4e232331ba5cd64a7ad5..b20a586090379718c4e153a69e22488cb6673b1d 100644 (file)
@@ -107,7 +107,6 @@ bool VCS::makeRCSRevision(string const &version, string &revis) const
 
 FileName VCS::checkParentDirs(FileName const & start, std::string const & file)
 {
-       static FileName empty;
        FileName dirname = start.onlyPath();
        do {
                FileName tocheck = FileName(addPathName(dirname.absFileName(), file));
@@ -117,7 +116,7 @@ FileName VCS::checkParentDirs(FileName const & start, std::string const & file)
                // this construct because of #8295
                dirname = FileName(dirname.absFileName()).parentPath();
        } while (!dirname.empty());
-       return empty;
+       return FileName();
 }
 
 
@@ -162,8 +161,8 @@ bool RCS::retrieve(FileName const & file)
 {
        LYXERR(Debug::LYXVC, "LyXVC::RCS: retrieve.\n\t" << file);
        // The caller ensures that file does not exist, so no need to check that.
-       return doVCCommandCall("co -q -r " + quoteName(file.toFilesystemEncoding()),
-                              FileName()) == 0;
+       int const ret = doVCCommandCall("co -q -r " + quoteName(file.toFilesystemEncoding()));
+       return ret == 0;
 }
 
 
@@ -1183,12 +1182,8 @@ void SVN::scanMaster()
        // vcstatus code is somewhat superflous,
        // until we want to implement read-only toggle for svn.
        vcstatus_ = NOLOCKING;
-       if (checkLockMode()) {
-               if (isLocked())
-                       vcstatus_ = LOCKED;
-               else
-                       vcstatus_ = UNLOCKED;
-       }
+       if (checkLockMode())
+               vcstatus_ = isLocked() ? LOCKED : UNLOCKED;
 }
 
 
@@ -1835,7 +1830,7 @@ bool GIT::findFile(FileName const & file)
        string const fname = onlyFileName(file.absFileName());
        LYXERR(Debug::LYXVC, "LyXVC: Checking if file is under git control for `"
                        << fname << '\'');
-       int const ret = doVCCommandCall("git log " + quoteName(fname),
+       int const ret = doVCCommandCall("git log -n 0 " + quoteName(fname),
                        file.onlyPath());
        bool const found = (ret == 0);
        LYXERR(Debug::LYXVC, "GIT control: " << (found ? "enabled" : "disabled"));