Commit graph

30 commits

Author SHA1 Message Date
Sitaram Chamarty d3610191d3 supporting DOS and fake Unix...
I was very, very, tempted to say "sorry; not supported".  Sadly,
prudence won over juvenile glee...

PS: DOS == dominant operating system
2012-04-06 21:13:56 +05:30
Sitaram Chamarty 7c6728af89 (some minor changes)
- whitespace change to t/reset
  - remove dbg line accidentally left in in Load.pm
  - add a bit more explanation to 'writable'
2012-04-05 21:31:59 +05:30
Sitaram Chamarty 81b503d2bd GROUPLIST_PGM; manually spot-tested, no test script. PW. 2012-04-03 09:47:31 +05:30
Sitaram Chamarty 906ed4cbe2 logging, tracing, and perltidy, ...
...plus renamed a couple of log events for consistency
2012-03-30 23:07:46 +05:30
gitolite tester cc8b10483b allow perl modules as triggers also...
...and move "check_repo_write_enabled" to that mode ("writable")
2012-03-27 19:42:30 +05:30
Sitaram Chamarty 96ccbf0c1c make standalone config entries work
For example, in

    repo foo/..*
        C   =   u1 u2 u3
        RW+ =   CREATOR
        RW  =   WRITERS
        R   =   READERS

        config hooks.emailprefix = '[%GL_REPO] '
        config foo.bar  = bar one

    repo foo/u1/..*
        config bar.baz  = frob nitz

make that last config also work!
2012-03-26 05:54:17 +05:30
Sitaram Chamarty eeed52ba2e list-users acquires an optional repo name patten to speed things up
but see warnings in usage text.
2012-03-24 10:30:46 +05:30
Sitaram Chamarty 878bb3009a last check in the "dammit, don't call creator() on a missing repo" series :) 2012-03-24 10:30:45 +05:30
Sitaram Chamarty 139c08d3a1 abort on suspicious ref names
(and the other Dan Carpenter finding too, while we're about it!)

Note that neither of these is an actual issue, (and even less likely now
that gitolite is pure perl and no shell metas used) but it's just
playing safe.
2012-03-24 10:30:45 +05:30
Sitaram Chamarty f0355d749b 'gitolite writes off/on...' done 2012-03-24 10:30:45 +05:30
Sitaram Chamarty ed47d1aef8 two significant fixes to load:
- don't look for user-roles if the repo is missing (doesn't make sense
    and because we roll in the <perm> = CREATOR function into that, it
    causes bugs like [1] below)

  - allow ^CREATOR/ in repo names (i.e., don't insist it has to be
    /CREATOR/)

----

[1] here's the bug

    repo foo/..*
        C   =   u1
        RW+ =   CREATOR # <--- this line
        R   =   READERS
        RW  =   WRITERS

    causes
        GL_USER=u2 gitolite info

    to print
        hello u2, this is gitolite3 (unknown) on git 1.7.7.6

         R W  	foo/..*
         R W  	testing

    when in reality it should not be looking at CREATOR at all.
2012-03-24 10:30:44 +05:30
Sitaram Chamarty 2e1f840f13 'info' learns '-lc' option (and load.pm exports creator()) 2012-03-24 10:30:44 +05:30
Sitaram Chamarty e6ba17fc52 "deny-rules" (used to be called "deny-repo" in g2) 2012-03-24 10:30:44 +05:30
Sitaram Chamarty 3e1746b267 change die to warn if split_conf is not set but gl-conf is present
(although the opposite case is still a "die")

We found out how this can happen: if you change

    repo r1 r2

to

    @g = r1 r2
    repo @g

as found by t/deleg-2.t, which suddenly started breaking after an
apparently unrelated commit :-)
2012-03-24 10:30:44 +05:30
Sitaram Chamarty 8dcc051e64 access() with a missing repo
when a real repo (i.e., not a groupname or such) doesn't exist, checking
any permission other than ^C will give invalid results unless ^C is ok
for the user in question.

Take a look at this:

    repo    foo/CREATOR/a[0-9][0-9]
        C   =   u2 u3
        RW+ =   CREATOR
        R   =   READERS u1

u1 looking for R access on foo/u1/a11 will otherwise result in
success.
2012-03-24 10:30:43 +05:30
Sitaram Chamarty 1b31c21440 wildrepos almost done (except setperms etc)
implementation notes

  - new sugar role_names() to prefix an "@" to CREATOR, and any role
    names listed in the rc file.

  - invalidate the cache in rules() if the repo was missing.  Without
    this, an auto-create operation succeeds the ^C check and calls
    new_wild_repo(), but then -- due to the cached rules not containing
    a rule for CREATOR, the actual read/write fails.

  - treat roles (READERS, WRITERS, etc.) as group names that apply only
    to that particular repo.  Don't add them to %groups, because that
    would screw up caching, but add them in when memberships() is called
    for the user.

    This is why the membership call for the user also has a reponame
    tacked on -- i.e., a user's membership list varied depending on
    which repo you're talking about.

  - while we're about it, pretend we added "CREATOR = <content of
    gl-creator>" as another "role".  Makes things so much easier dealing
    with "RW+ = CREATOR"

  - searching for rules pertaining to foo/CREATOR/bar when looking at
    repo foo/sitaram/bar is done backwards from what g2 used to do.  G2
    used to play tricks with the do-eval'd file using global variables
    so that what you get after the do may not even contain 'CREATOR'.

    We go the other way.  We replace sitaram with CREATOR and start
    looking for memberships of *both* foo/sitaram/bar and
    foo/CREATOR/bar.

  - this doesn't work (because we don't know *what* to replace) for
    missing repos if GL_USER is not set.  This means that 'gitolite
    access ...' queries (which do not set GL_USER) cannot be used
    reliably for non-existant repos.

    Since a ^C check is the only meaningful one for a non-existent repo,
    this means you cannot do that from 'gitolite access'.

    'GL_USER=luser gitolite info' will still work though ;-)

all in all, much cleaner and simpler than g2.
2012-03-24 10:30:43 +05:30
Sitaram Chamarty a6a666af78 new option() function in load.pm to quickly test conf options
reminder: these are enabled by 'option foo = bar' keyword in conf and
apply only to the repo
2012-03-24 10:30:43 +05:30
Sitaram Chamarty 941de722da gl-perms handling and roles, first cut
(additional memberships that user has when accessing a specific repo)
2012-03-24 10:30:43 +05:30
Sitaram Chamarty 9650d2fb3f (minor)
trace rationalisation plus perltidy again
2012-03-24 10:30:43 +05:30
Sitaram Chamarty 89a1857d56 auto-create repo on 'C' perm done 2012-03-24 10:30:43 +05:30
Sitaram Chamarty a014d2ffd5 "memberships()" can now deal with most everything except roles 2012-03-24 10:30:43 +05:30
Sitaram Chamarty f21d17e086 git_configs almost done, but
real testing can only happen after wildrepos is finished (specifically,
when memberships() can return regex repo names also)
2012-03-24 10:30:43 +05:30
Sitaram Chamarty 38cb9bfda9 trace messages rationalised to 3 levels 2012-03-24 10:30:43 +05:30
Sitaram Chamarty 8714b77eae (perltidy) 2012-03-24 10:30:43 +05:30
Sitaram Chamarty 9780ddab9d (!!) personal branches -- 1 line of code, 50 lines of test!
(and by the way even in g2 this was not so easy as just ONE line of
code!)
2012-03-24 10:30:42 +05:30
Sitaram Chamarty 6624d35cf9 info command deals with groups 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 7f8020adc5 'info' command, plus lots more changes:
- usage() gets a little smarter; it now knows what function it was called
    from and tries to find a '=for function_name' chunk of data in the script

  - the various list-* functions now work off a dispatcher in Load.pm
  - (...and they all use the new usage() magic to print their helps!)

  - src/gitolite got a lot leaner due to this dispatcher

  - src/gitolite-shell became a lot more easier to read/flow

  - rc acquired '{COMMANDS}', which gitolite-shell now refers to
  - comments in the default rc file changed a bit
  - rc got a new REMOTE_COMMAND_PATT (in place of ADC_CMD_ARGS_PATT)

the rest is perltidy and stuff like that
2012-03-24 10:30:42 +05:30
Sitaram Chamarty 16d17def2a VREF code 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 56cda99edd fixup CWD in access(); see below
Calling access() changes the CWD to $GL_REPO_BASE!

This causes a problem in the update script -- you're suddenly in the
wrong directory after calling access()!

This is actually happening inside load_1(), so fix that.
2012-03-24 10:30:41 +05:30
Sitaram Chamarty 379b0c9549 install/test made easy (WARNING: read below)
(1) testing is very easy, just run this from a clone

        t/g3-clean-install-setup-test

    BUT BE WARNED THIS IS DESTRUCTIVE; details in t/WARNING

(2) install is equally simple; see 'INSTALL' in the main directory
2012-03-24 10:30:41 +05:30
Renamed from Gitolite/Conf/Load.pm (Browse further)