commit 2b79392b3d3539e258b5bdc9a123b60805d4b7ac
Author: Pavel Sanda <[email protected]>
Date:   Sun Oct 11 22:14:45 2026 +0200

    RCS: prefix filename arguments with ./
    
    RCS has no --, so using prefixing with "./" because an argument starting
    with '.' can never be read as a flag while naming the same file.
    
    Tier 01 DiD / vcs-args: ./ prefix for RCS filename arguments
    
    https://www.mail-archive.com/[email protected]/msg227023.html
    
    Assisted-by: Claude Opus 5
---
 src/VCBackend.cpp | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp
index 897c35489f..458a75db9c 100644
--- a/src/VCBackend.cpp
+++ b/src/VCBackend.cpp
@@ -126,6 +126,8 @@ FileName VCS::checkParentDirs(FileName const & start, 
std::string const & file)
 //
 /////////////////////////////////////////////////////////////////////
 
+// Don't use absolute paths here, "./" is added to guard against "-files".
+
 RCS::RCS(FileName const & m, Buffer * b) : VCS(b), master_(m)
 {
        // Here we know that the buffer file is either already in RCS or
@@ -235,7 +237,7 @@ void RCS::registrer(string const & msg)
        string cmd = "ci -q -u -i -t-\"";
        cmd += msg;
        cmd += "\" ";
-       cmd += quoteName(onlyFileName(owner_->absFileName()));
+       cmd += quoteName("./" + onlyFileName(owner_->absFileName()));
        doVCCommand(cmd, FileName(owner_->filePath()));
 }
 
@@ -278,7 +280,7 @@ string RCS::copy(support::FileName const & newFile, string 
const & msg)
 LyXVC::CommandResult RCS::checkIn(string const & msg, string & log)
 {
        int ret = doVCCommand("ci -q -u -m\"" + msg + "\" "
-                   + quoteName(onlyFileName(owner_->absFileName())),
+                   + quoteName("./" + onlyFileName(owner_->absFileName())),
                    FileName(owner_->filePath()));
        if (ret)
                return LyXVC::ErrorCommand;
@@ -323,7 +325,7 @@ bool RCS::isCheckInWithConfirmation()
 string RCS::checkOut()
 {
        owner_->markClean();
-       int ret = doVCCommand("co -q -l " + 
quoteName(onlyFileName(owner_->absFileName())),
+       int ret = doVCCommand("co -q -l " + quoteName("./" + 
onlyFileName(owner_->absFileName())),
                    FileName(owner_->filePath()));
        return ret ? string() : "RCS: Proceeded";
 }
@@ -367,7 +369,7 @@ bool RCS::lockingToggleEnabled()
 bool RCS::revert()
 {
        if (doVCCommand("co -f -u" + version_ + ' '
-                   + quoteName(onlyFileName(owner_->absFileName())),
+                   + quoteName("./" + onlyFileName(owner_->absFileName())),
                    FileName(owner_->filePath())))
                return false;
        // We ignore changes and just reload!
@@ -387,7 +389,7 @@ void RCS::undoLast()
 {
        LYXERR(Debug::LYXVC, "LyXVC: undoLast");
        doVCCommand("rcs -o" + version_ + ' '
-                   + quoteName(onlyFileName(owner_->absFileName())),
+                   + quoteName("./" + onlyFileName(owner_->absFileName())),
                    FileName(owner_->filePath()));
 }
 
@@ -400,7 +402,7 @@ bool RCS::undoLastEnabled()
 
 void RCS::getLog(FileName const & tmpf)
 {
-       doVCCommand("rlog " + quoteName(onlyFileName(owner_->absFileName()))
+       doVCCommand("rlog " + quoteName("./" + 
onlyFileName(owner_->absFileName()))
                    + " > " + quoteName(tmpf.toFilesystemEncoding()),
                    FileName(owner_->filePath()));
 }
@@ -448,7 +450,7 @@ bool RCS::getRevisionInfo()
                LYXERR(Debug::LYXVC, "Could not generate logfile " << tmpf);
                return false;
        }
-       doVCCommand("rlog -r " + quoteName(onlyFileName(owner_->absFileName()))
+       doVCCommand("rlog -r " + quoteName("./" + 
onlyFileName(owner_->absFileName()))
                + " > " + quoteName(tmpf.toFilesystemEncoding()),
                FileName(owner_->filePath()));
 
@@ -499,7 +501,7 @@ bool RCS::prepareFileRevision(string const &revis, string & 
f)
        }
 
        doVCCommand("co -p" + rev + ' '
-                     + quoteName(onlyFileName(owner_->absFileName()))
+                     + quoteName("./" + onlyFileName(owner_->absFileName()))
                      + " > " + quoteName(tmpf.toFilesystemEncoding()),
                FileName(owner_->filePath()));
        tmpf.refresh();
-- 
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs

Reply via email to