WeBWorK Main Forum

Making a git repository for a local library

Making a git repository for a local library

by Alex Jordan -
Number of replies: 2
We have a locally written library of about 1500 pre-college algebra problems (still being vetted and groomed for donation to the OPL).

We have this library stored in /opt/webwork/libraries/PCC-Precollege-Algebra. I went into that folder and executed git init to begin tracking our corrections. And this has been great as far as tracking goes.

The problem we now have is that the .git folder is visible from the Library Browser. Each course has a simlink to /opt/webwork/libraries/PCC-Precollege-Algebra and a button for viewing its contents in the Library Browser. And when you push that button, you should see all of the subfolders into which we have categorized the problems. But you also see the .git folder and its subfolders, despite those being hidden on the server. Worse, they come first, and probably intimidate some of my faculty.

I tried removing all permissions from the .git folder hoping that WeBWorK would then not see them and all would be well, but then the Library Browser gives an error message when you use the button for the precollege algebra library. It cries that it cannot access the .git folder, so it can see it even though all the permissions are removed.

Does any Ubuntu/git/WeBWorK guru know if there is a quick fix for this? I noticed the OPL structure is buried one folder deeper, but I'd rather avoid doing that with our libraries unless it's just plain necessary.
In reply to Alex Jordan

hidden files visible to WeBWorK

by Alex Jordan -
A related issue: occasionally I make a tarball of .pg problems, download it, and use a mass text editor to make global changes to the files. For instance, we were able to insert PGcourse.pl into the loadMacros commands in about 1500 files all at once.

If I do this on my Mac, once the files are edited and saved, Mac OS creates hidden files that keep certain attributes like (I think) the icon used for the file. If I tarball the folder and upload it back using the File Manager, all those hidden files are unpacked. While I cannot see them from the File Manager, the Library Browser does see them, and because they still have a .pg extension, it tires to load them if I am viewing such a folder. Of course this leads to errors, so I have to remember to cleanse the tarball of these hidden files before uploading it.

To solve both these issues, could we make it so that the Library Browser is oblivious to hidden files?
In reply to Alex Jordan

Re: hidden files visible to WeBWorK

by Raymond Moberly -
The best guess for a fix to this was to add the grep clause:


sub readDirectory($) {
my $dirName = shift;
opendir my $dh, $dirName
or die "Failed to read directory $dirName: $!";
my @result = grep ! /^\./, readdir $dh;
close $dh;
return @result;
}

in Utils.pm.

It seems to require a system restart.