info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

"dirinfo" hack


From: R Bresner
Subject: "dirinfo" hack
Date: Thu, 04 Oct 2001 22:18:35 +0100

Don't know if anyone is interested, but a very simple hack
to implement a dirinfo is to add the following code
to add.c:

        if(( n = Parse_Info( CVSROOTADM_DIRINFO, repository, precommit_proc, 1
)))
           {
             error(0, 0, "Pre-check for directory add failed (%s)", repository
);
             goto out;
           }

I put the code in the add_directory() function, using precommit_proc()
from
commit.c as my callback. Works very nicely, thanks to whoever wrote
that.
And, of course, change precommit_proc from static to not static.
CVSROOTADM_DIRINFO is #defined in cvs.h as "dirinfo",.
It would probably be more correct to create a "prediradd_proc()" or
something.

Tada:

        :~/cvs-1.11/src/cvtest/b$ cvs add testing_testing/
        DIRINFO SCRIPT TEST: /home/rbresner/CVREPO/cvtest/b
        Hello. You are rbresner, you may NOT ADD A DIR!!
        cvs add: Pre-check for directory add failed
(/home/rbresner/CVREPO/cvtest/b)
        :~/cvs-1.11/src/cvtest/b$ 

Useful? Maybe to some. Changes:
        add.c
        cvs.h
        commit.c

I put the add_directory() changes near the comment:
        /* There used to be some code here which would prompt for
           whether to add the directory.  The details of that code had
           bitrotted, but more to the point it can't work
           client/server, doesn't ask in the right way for GUIs, etc.
           A better way of making it harder to accidentally add
           directories would be to have to add and commit directories
           like for files.  The code was #if 0'd at least since CVS 1.5.  */

Probably, the change could go earlier, but it seemed appropriate there.

cheers,

--
Robert Bresner
address@hidden



reply via email to

[Prev in Thread] Current Thread [Next in Thread]