Commit graph

89 commits

Author SHA1 Message Date
gitolite tester 25bb1c00db mirroring without sausages
(or at least without showing the making of said sausages)
2012-04-02 13:18:30 +05:30
Sitaram Chamarty b78466b164 put the VERSION file in the right place
I don't know why I had put VERSION in GL_ADMIN_BASE, which is pretty
stupid.  It should be in GL_BINDIR.

It also has nothing to do with setup -- the file needs to be generated
at 'install' time.
2012-04-02 13:18:30 +05:30
Sitaram Chamarty 4e093d5909 migration bug: admin repo hooks not updated by 'gitolite setup'
because the loop in the code below was sending out $repo =
'./gitolite-admin.git' to hook_1(), inside which there is an explicit
check for 'gitolite-admin', which of course doesn't match
'./gitolite-admin'!
2012-03-31 00:02:08 +05:30
Sitaram Chamarty 2c1f46c055 %HOSTNAME and new subconf enhancement 2012-03-30 23:08:53 +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
Sitaram Chamarty a439f47a67 GL_BYPASS_UPDATE_HOOK -> GL_BYPASS_ACCESS_CHECKS, also added to gitolite-shell 2012-03-30 23:07:46 +05:30
Sitaram Chamarty c2991d974d the 'eval' in run() needed to die on error 2012-03-30 22:57:06 +05:30
Sitaram Chamarty 2bec551009 'writes' -> 'writable', order of arguments changed 2012-03-27 19:42:30 +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 1cf062fad5 ACCESS_CHECK split into ACCESS_1 and ACCESS_2; docs updated 2012-03-27 19:42:30 +05:30
Sitaram Chamarty 93fb9552d2 perl API docs, plus one minor change to the code...
in_group() accepts group name with or without leading '@'
2012-03-27 11:31:43 +05:30
Sitaram Chamarty 276900edbb fixup new check-g2-compat, lots of migration related changes...
aaargh!  I forgot to 'git rm' something despite documenting it to be
gone and not using it
2012-03-26 21:35:39 +05:30
Sitaram Chamarty 61f6967f67 partial-copy fixed...
...there was one real bug, plus I had forgotten to put a comented out
line in the rc file, but most of the rest of the effort was moving the
test script over.

oh and I'd also forgotten to move this from 'commands' to 'triggers' :-)
2012-03-26 21:27:49 +05:30
Sitaram Chamarty 07cf7fedfe move triggers into their own subdir...
...otherwise 'gitolite help' was getting too confusing, mixing up stuff
that users should not be running directly (even on the server)

----

implementation notes:

those who are worried about the '../triggers/' in various parts of the
code here, remember you can only do that from a command line on the
server.  Remote users can only use commands that have been explicitly
listed in the COMMANDS hash in the rc file.  This means they can't even
access other commands in the same directory as, say, the 'info' command,
so a '../' is definitely not going to work.
2012-03-26 11:02:57 +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 2845de74ea Easy.pm learns config(), acquires a test script 2012-03-25 19:31:01 +05:30
Sitaram Chamarty 2139099706 arguments in rc for triggered programs...
...using 'renice' as example and first user

(also had to re-arrange rc file to a more sensible order)
2012-03-25 12:17:37 +05:30
Sitaram Chamarty cb9794d55b warn about test suite clobbering lots of stuff
(not just ~/.ssh!)
2012-03-25 11:07:11 +05:30
Sitaram Chamarty 3ed923f503 new check-g2-compat, lots of migration related changes
- rc differences moved to their own file
  - main g2migr now helps interpret output of check-g2-compat
  - Gitolite::Compat gone; no point...
2012-03-25 09:43:23 +05:30
Sitaram Chamarty efb29ed135 enhance usage message for 'gitolite setup' 2012-03-24 10:30:46 +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 0748b1225b external programs can get settings from rc; see below
non-core programs can get their settings from the rc file also.
cpu-time is a perl example and desc is a shell example.

(info is not a good example because it does not use "Gitolite::Easy")
2012-03-24 10:30:46 +05:30
Sitaram Chamarty 0b8b144630 trigger prefixes an extra first argument -- the trigger name 2012-03-24 10:30:46 +05:30
Sitaram Chamarty 14e1354433 query-rc learns '-q' option 2012-03-24 10:30:45 +05:30
Sitaram Chamarty e9ea674be9 (minor) fixup various TODOs and such
some got junked, some were already done or got done, and some were
converted into actual todo items in the 'todo' file.
2012-03-24 10:30:45 +05:30
Sitaram Chamarty 1c590e633f run compat checks when old rc found
(also removed legacy-delegation sugar script)
2012-03-24 10:30:45 +05:30
Sitaram Chamarty 8dc43affdb minor changes to testing setup 2012-03-24 10:30:45 +05:30
Sitaram Chamarty 320356d66c cleaned up logging quite a bit; details:
- a remote "id" (usually the IP) is generated and logged on the first
    log message in a "transaction"

  - speaking of which, a new "transaction ID" is logged that stays the
    same for each input command/invocation, tying together all the
    spawned commands

  - so now time stamps can be generated each time they are needed,
    rather than re-use the one at the beginning

  - log messages have a keyword at the start now
        remote, (create), check1 -- from gitolite-shell
        update, check2 -- from update
        post-up -- from post-update
        command -- from gitolite
        die, system -- from anywhere
2012-03-24 10:30:45 +05:30
Sitaram Chamarty bb9f045ec3 trigger POST_CREATE from user actions
- uncomment the POST_CREATE section in rc by default now
  - have perms call 'gitolite trigger POST_CREATE'
2012-03-24 10:30:45 +05:30
Sitaram Chamarty 98a6b08ff4 'desc' command added (manually smoke tested only; no test script) 2012-03-24 10:30:45 +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 999f9cd39d make site-local scripts easier to write
- new Gitolite::Easy module hides all the other stuff
  - (put GL_ADMIN_BASE and GL_REPO_BASE into %ENV)
  - new 'gitolite creator' shell command
  - 'writes' command modified to use Gitolite::Easy.  It is also the
    only dual mode command -- it can be invoked remotely as well as
    locally.  I deem that the required trick to make other remote-only
    commands work locally is too much trouble for what is probably a
    rarely used command.
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 1ec8be663e (test infrastructure) CLONE/PUSH macros redefined 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 3f7edfea67 usage() needed some minor fixes... 2012-03-24 10:30:44 +05:30
Sitaram Chamarty af11919025 git-configs update code done 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 b1a75b7889 gitweb/daemon post-create scripts done 2012-03-24 10:30:44 +05:30
Sitaram Chamarty 24b36f11c5 (perltidy) 2012-03-24 10:30:44 +05:30
Sitaram Chamarty d853c58ada (!!) trigger mechanism... read below
new triggers:

  - PRE_GIT and POST_GIT in gitolite-shell
  - PRE_CREATE and POST_CREATE when a new wild repo is created
  - (POST_COMPILE had already existed)
  - ACCESS_CHECK triggers both in gitolite-shell and the update hook

  - trace() learned to print the file name if called from top level and
    a function name is not available

note: trigger was called 'run-all' and only had POST_COMPILE.  The code
existed in gitolite-shell, but is now moved to Rc.pm.
2012-03-24 10:30:44 +05:30
Sitaram Chamarty 4c1017a529 new sugar 'legacy-delegation-abort', enabled by default 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 e743cab1a3 perms command done (smoke tested) 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 3c5ae7f26b added 'RW+CDM' perm function, including some test code for 'D' 2012-03-24 10:30:43 +05:30
Sitaram Chamarty 5ae9b4abab new sugar function to help with RW+CDM 2012-03-24 10:30:43 +05:30