On Tue, Apr 9, 2013 at 6:26 PM, Nico Williams <[email protected]> wrote: > So, to wrap up, I think you want: > > fork(), chdir() to the directory containing the file, exec() git > status --porcelain, and parse the result in the parent process (read > via a pipe), then display the status (for each file making up a LyX > document).
And don't forget to see git status --help (or man git-status) for the format of git status --porcelain. Yeah, this sort of thing is not easy using the git commands. There's a git library out there you might be able to use. But for my money, the best thing to do would be to have a script per-VCS that you exec to tell you the status of a document's files and then you warn the user if any of those files have unstaged or uncommitted changes, or are untracked files in a workspace, but if they are not in a workspace, then say nothing. Under no circumstance should LyX *ever* run "git checkout" to "checkout a file" -- one does not do this in git, generally, and when one does "git checkout -- some-file" one does not mean what one would mean with RCS, say. The only git commands that LyX should execute at all should be informational, or "git add <file-list>", nothing else (and git add *only* if the user said to). For anything else LyX should run gitk or whatever other GUI, or start a terminal with an interactive shell. Nico --
