On 07/04/13 00:35, Tommaso Cucinotta wrote: >> when creating new file. > > How did u get such message ? Pls, detail.
Actually, I've seen it happening, but not when creating a new file. Rather, when opening an existing file NOT on git repo, but from a CWD WITHIN a GIT repo. Shortly, I think it's an off-by-one bug in checkparentsdir(), that ends up checking the current dir when it exhausted the path all the way up to the root (i.e., thinking that "" is parent of "/", so going to check for "" + ".git/.svn"). Fixed in the attached patch. Example: $HOME/newfile2.lyx is already there, exists and is NOT within any GIT repo. tommaso@mobiletom:~$ ./lyx-trunk-ws/lyx/src/lyx ~/newfile2.lyx tommaso@mobiletom:~$ cd - /home/tommaso/lyx-trunk-ws/lyx tommaso@mobiletom:~/lyx-trunk-ws/lyx$ ./src/lyx ~/newfile2.lyx fatal: Not a git repository (or any of the parent directories): .git Systemcall.cpp (277): Systemcall: 'git status --porcelain "newfile2.lyx"' finished with exit code 128 With the attached patch, the problem is fixed. However, note that the problem was NOT due to my other patch, and it should affect also recent SVN trees (for which the .svn folder can now be in parent dirs...). T.
commit 3204d76f Author: Tommaso Cucinotta <tomm...@lyx.org> Date: Sun Apr 7 01:10:31 2013 +0100 Avoid check mistakenly current folder for .git/.svn/.CVS, when going up the path checking for parents. diff --git a/src/VCBackend.cpp b/src/VCBackend.cpp index 72148f72..17961779 100644 --- a/src/VCBackend.cpp +++ b/src/VCBackend.cpp @@ -108,6 +108,8 @@ bool VCS::checkparentdirs(FileName const & file, std::string const & pathname) while ( !result && !dirname.empty() ) { //this construct because of #8295 dirname = FileName(dirname.absFileName()).parentPath(); + if (dirname.empty()) + break; LYXERR(Debug::LYXVC, "check directory: " << dirname.absFileName()); tocheck = FileName(addName(dirname.absFileName(),pathname)); result = tocheck.exists();