Commit Graph

260 Commits (master)

Author SHA1 Message Date
Sitaram Chamarty 07169c37ec allow aliasing a repo to another name
all documentation is inside Alias.pm.
2012-05-19 06:01:05 +05:30
Sitaram Chamarty bc3eb34211 simulate POST_CREATE for newly created "normal" repos
See "background" in new program src/triggers/new-normal-repos
2012-05-16 18:55:06 +05:30
Sitaram Chamarty e511943a45 just for kicks, a VREF that allows voting on changes to a branch
(manually smoke tested; no test script)

I've been meaning to do this for a while, since someone told me that is
one of gerrit's features they like.

Of course, gitolite can't/won't do the whole "code review" thing (nor
the workflow enforcement that follows).

But voting is simple -- literally 2-3 lines of code in a VREF.  (The
rest is inline documentation).
2012-05-10 12:28:37 +05:30
Sitaram Chamarty fa2893be7c the dupkeys function was already in ssh-authkeys...
...so there's no need for the VREF.

Ironically, while I was arguing with Eli that I wouldn't do it and why,
the code was *already* there, and had been for over a month!  (It must
have been there for much longer for me to have forgotten!)

TODO: convert from using fingerprint compute to actual key strings when
the complaints about speed start appearing.

My own personal speed up loop [1] I guess :)

[1]: http://thedailywtf.com/Articles/Classic-WTF-The-Speedup-Loop.aspx
2012-05-07 15:08:46 +05:30
Sitaram Chamarty e76be7ff11 move repo/user validity check deeper
(but change repo check to allow repoPATT instead of just repoNAME)

This is because there are/will be some situations where access() is
called without those two checks being done (i.e., it is not only from
src/commands/access that it is called).
2012-05-06 19:02:42 +05:30
Sitaram Chamarty 196706c145 bugfix: smart http mode wasn't running pre_ and post_ git triggers
(while we're about it, we also steal Michael Brown's idea (patch #2 in
[1] and get rid of GIT_HTTP_BACKEND).

[1]: http://groups.google.com/group/gitolite/msg/adfae758dd28f2a8
2012-05-05 18:07:15 +05:30
Sitaram Chamarty 6d057fb84c allow info to print description also 2012-05-04 18:13:42 +05:30
Sitaram Chamarty d8df4a9344 git-config bugfix + backward compat breakage in usage of 'config'
(1) the backward compat breakage: you can't create empty-valued config
    keys anymore.  That is, you can't do the eqvt of the following shell
    command using gitolite

        git config foo.bar ""

(2) fixed a bug where this:

        repo foo
            config foo.bar =

    when queried using

        gitolite git-config -r foo .

    would return even the empty valued ones, which -- remember! -- are
    not supposed to exist anymore.

    Fixing this bug allows situations like this to not show the admin
    repo in gitweb:

        repo [a-z].*
            config gitweb.owner = P-h B

        repo gitolite-admin
            config gitweb.owner =

----

background...

Somewhere in g3 (well actually in 057506b), we lost the ability to
distinguish
    config foo.bar  =   ""
from
    config foo.bar =

I decided that conflating them is more intuitive for most people,
because a survey [1] revealed that no one seemed to want the equivalent
of the following shell command:

----

[1] ...of a (small prime greater than 1) number of people on #git
2012-05-04 17:30:22 +05:30
Andreas Stenius 47a0c44540 migrated htpasswd command from g2.
(with some fixups by committer)
2012-05-03 11:04:22 +05:30
Sitaram Chamarty 49d132a969 minor fix to info command output under httpd...
when running under httpd, $ENV{USER} is not set, so we use a (hopefully
informative) default to print.

Thanks to Thomas Hager (duke at sigsegv dot at) for catching this.
2012-05-01 15:06:06 +05:30
Sitaram Chamarty c145528849 (minor typo fix) 2012-05-01 14:20:13 +05:30
Sitaram Chamarty 850882c1a6 allow VREF code to print to STDOUT...
Using a g2-style "chained update hook" as a VREF doesn't *quite* work:

  - all STDOUT from the hook is lost
  - worse, all lines get parsed as a ref followed by a message, and if
    the ref doesn't look like a ref it dies

So now we do all this only if the message starts with 'VREF/'.  Any
other output is just printed out as is.
2012-04-30 06:02:17 +05:30
Sitaram Chamarty 48ed4deb8f BSD compat changes
thanks to milki for all the efforts!

Details:

  - partial-copy fell afoul of BSD not having $RANDOM
  - test suite: fix bad GNU sort with good perl sort
  - test suite: fix md5sum dependency (which BSD doesn't have or can't
    easily have or requires extra options or whatever...), by doing it
    in perl.  (Requires Digest::MD5, which is probably available
    anyway, but since this is only for the test suite, meh!)
2012-04-28 22:58:09 +05:30
Sitaram Chamarty e919a0b7ca solaris doesn't like 'hostname -s'...
(luckily, unlike linux, it doesn't spew a usage message to STDOUT!)
2012-04-28 12:04:51 +05:30
Sitaram Chamarty 7d6b04605d fix test suite's dependency on time zone
I had not remembered that the 'tc' subcommand in tsh adds *text* that
contains the current time, so commit SHAs were changing.

Thanks to milki for catching this, and in fact being the only person who
ever appears to have attempted to run the test suite at all!
2012-04-28 04:55:49 +05:30
Sitaram Chamarty 5d366b5c0e new VREF: MAX_NEWBIN_SIZE (manual spot testing only) 2012-04-23 17:27:00 +05:30
Sitaram Chamarty d74f596e23 make can_write() in Easy.pm more flexible 2012-04-23 17:27:00 +05:30
Sitaram Chamarty 198dcfd4c8 POST_CREATE efficiency... (please read below if you care)
The POST_CREATE trigger is called when

  * a user creates a new "wild" repo,
  * a user uses the "perms" command, and
  * a user uses the "fork" command.

The trigger calls 3 programs (see rc file):

    post-compile/update-git-configs
    post-compile/update-gitweb-access-list
    post-compile/update-git-daemon-access-list

(They are also called by the POST_COMPILE trigger, by the way.)

However, the 3 programs shown are a bit wasteful -- they run through
*all* the repos when really only *one* repo has been affected.

This patch

  * passes the repo name to the 3 programs (duh!)

  * adds the optimisation to the first of the 3 programs listed above
    (the one dealing with 'git config').

For the other two programs (gitweb and git-daemon), you have 3 choices:

  * if you don't have too many repos, ignore the problem.

  * take out the 2nd and 3rd lines from the POST_CREATE list in the rc
    file, so they don't run.

    Then run 'gitolite trigger POST_COMPILE' from cron at regular
    intervals.  (Note that is POST_COMPILE not POST_CREATE!)  However,
    this means that gitweb and daemon permissions won't be current
    immediately after someone adds a new repo or sets perms etc.; they
    get updated only on the next cron run.

  * patch the programs to add this optimisation (and send me the
    patches).  The optimisation would check if arg-1 ($1 in shell,
    $ARGV[0] in perl) is 'POST_CREATE', and if it is, take the *next*
    argument as a repo name that may have changed.
2012-04-22 22:44:39 +05:30
Sitaram Chamarty 895b3614ed (minor) add a bit more detail on usage text for 'info' 2012-04-22 22:43:45 +05:30
Sitaram Chamarty 6b65e7853f (minor) add quotes to make repo name stand out in error message 2012-04-22 22:43:45 +05:30
Sitaram Chamarty c3ec518cef fork command, and some core changes to make it work...
- access command allows checking ^C
  - ^C check will fail when the repo exists
2012-04-22 16:56:21 +05:30
Thomas Hager 3a7b547759 replaced /bin/echo with printf, Solaris echo doesn't recognize -n
gitolite setup fails to check admin pubkey, because $text always
contains 2 or more lines after tsh_try() (the key and -n).

[committer adds:
    I wasn't sure if 'printf' would work on cygwin, so I chose what
    looked like a safer option, but apparently it wasn't safe enough and
    fell afoul of Solaris.

    Anyway I managed to check (using a small test program) with someone
    who runs gitolite on cygwin, and it works.

    If you're wondering why I didn't just use echo followed by chomp(),
    that would of course have been the easy way out but I wanted to see
    how you'd do it without a post-processing option.  It became a
    frustrating challenge of sorts because it seems such a trivial thing!
]
2012-04-18 14:19:51 +05:30
Thomas Hager aaccb367ec changes to support Solaris default shell
Solaris default bourne shell does not recognize $(), and does not allow
exporting a variable and assigning a value to it in one step.
2012-04-18 13:42:50 +05:30
Sitaram Chamarty 1c15b4cc2d (perltidy) 2012-04-18 06:26:53 +05:30
Sitaram Chamarty 2cb7d8313e (minor) make trigger function name consistent with other similar uses
writable() in Writable.pm renamed to "access_1" to be consistent; i.e.,
reflect the trigger name
2012-04-18 06:23:21 +05:30
Sitaram Chamarty 581e79d745 logging die and warn messages
- change a few important die()s to _die()s
  - setup SIGs for both die and warn so any others will get caught
2012-04-18 06:23:21 +05:30
Sitaram Chamarty 67327ebfb4 (minor) add svnserve command 2012-04-18 06:23:21 +05:30
Sitaram Chamarty 273e6fd627 "fake Unix" strikes again...
The fix is easy enough, but I hate having to code work-arounds for
proprietary OSs when the same code works fine on Linux and BSD.

/me wisely avoids words like posix in his rant ;-)

Thanks to Franck Zoccolo for help in finding what the problem was and
when and why it occurred.

----

Someday there will be some issue that requires a fix with significant
code change (or worse, a change that is incompatible with Linux), and I
will probably refuse.  Of course, I will be properly regretful about my
inability to fix it.[1]
2012-04-17 14:14:28 +05:30
Sitaram Chamarty b5024027ca yaaay! http is finally done! 2012-04-15 21:14:56 +05:30
Sitaram Chamarty 720729e4b4 (minor) do not run `gitolite query-rc` from *perl* programs!
I must have blindly converted from some shell-thinking/shell-code for
these to have slipped through!

(found when doing an audit of all system, exec, ``, qx, and tsh_)
2012-04-13 15:35:13 +05:30
Sitaram Chamarty afc2c14a65 (minor) t/reset and test scripts were not getting a VERSION file 2012-04-11 19:06:13 +05:30
Sitaram Chamarty 4c5bb27739 pre-existing repo instructions were WRONG...
- fix them
  - but (at the cost of some efficiency) try to compensate if the admin
    did not follow those instructions, by running hook_1 anyway
2012-04-11 19:03:17 +05:30
Sitaram Chamarty 8c28fd2241 D...
(manually tested, no test script)

the whimsically named "D" command deletes repos, and is the opposite of
the "C" permission that enables the user to create one in the first
place.  See the usage message for user info, and look in the comments of
the code itself for admin info.
2012-04-11 07:06:45 +05:30
Sitaram Chamarty bbaacfaee7 (mostly) doc changes
- minor typo fixes, clarifications, etc.

  - keep sts.html url consistent, because many people link to
    http://sitaramc.github.com/gitolite/sts.html

  - create a common migration doc, so the old 'migr.html' does not 404
    when g3 docs become "main"

  - progit doc done

  - add gitosis convert script (FWIW)

  - a minor comment fix to Sugar.pm
2012-04-10 15:41:32 +05:30
Sitaram Chamarty c5e0e929a7 sskm: minimum changes, minimally smoke tested!
(thanks to fabian@hirschm.net for testing more thoroughly as well)
2012-04-10 04:23:57 +05:30
Sitaram Chamarty 48f1e7c781 'gitolite git-config' should print only value when regex not used...
not repo<tab>key<tab>value.  Also, honor '-n' (no newline)
2012-04-08 11:31:04 +05:30
Sitaram Chamarty 55e9b47bd1 CpuTime module learns to compute elapsed time 2012-04-08 06:07:14 +05:30
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 057506b73f remove quotes around option values
for example, this now works (it used to save the quotes also)

    option mirror.master = "ilh-95"
2012-04-06 17:26:27 +05:30
Sitaram Chamarty e1c7e546aa cpu-time command -> CpuTime trigger module...
...now that triggers are not restricted to external programs and can be
perl code called by gitolite-shell (thus in the same PID), there's no
need to compute and pass along the times() array.

This also changes the arguments to POST_GIT; they're now the same as
PRE_GIT's.
2012-04-06 17:26:27 +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 8df28a02db (minor) comments and clarifications in default rc 2012-04-04 05:01:10 +05:30
Sitaram Chamarty 495390926d added sshkeys-lint as a command 2012-04-03 17:15:13 +05:30
Sitaram Chamarty 35953a5bd3 added 'gitolite push' to make server side pushes easier...
also force the update hook to log SHAs of bypassed pushes
2012-04-03 16:40:06 +05:30
Sitaram Chamarty ad77cef7de (mainly for fedora) '-s' gets a shell. Manual spot-testing only
also includes "use $USER if username not passed"
2012-04-03 15:06:08 +05:30
Sitaram Chamarty 81b503d2bd GROUPLIST_PGM; manually spot-tested, no test script. PW. 2012-04-03 09:47:31 +05:30
gitolite tester 8e8ccb50f4 additions to default rc (commented out) for mirroring 2012-04-02 13:18:30 +05:30
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 0dfabe9f45 added "INPUT" trigger (not yet documented; internal use only for now) 2012-03-30 23:07:46 +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 dfb9844dfb info command simplified
(thanks to Eli for the back-and-forth that led to this)
2012-03-30 22:57:06 +05:30
Sitaram Chamarty 5db29062f5 try: info command header enhanced 2012-03-28 15:31:31 +05:30
Sitaram Chamarty 9c460a4b9a patch to make things work under selinux...
...at the cost of some nice warnings

(thanks to Seth Robertson for reporting the issue and then verifying the
fix, since I don't run selinux)
2012-03-27 22:25:39 +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 5e11d104c7 ssh-authkeys: remove needless map
someone reported an error on "my $_" (presumably old perl) but I now
realise the whole map is useless; both the lists concerned have already
been chomped.
2012-03-27 06:22:07 +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 c14e01d6c0 new 'gitolite print-default-rc' command 2012-03-25 09:19:38 +05:30
Sitaram Chamarty efb29ed135 enhance usage message for 'gitolite setup' 2012-03-24 10:30:46 +05:30
Sitaram Chamarty 8bffbfa02a 3 old VREFs moved in,
untested but they're just update hooks anyway so they should work fine
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 329d757167 partial-copy: manually spot-tested (i.e., no test in suite). PW. 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 b39100053d POST_GIT triggers get 4 more arguments 2012-03-24 10:30:45 +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 446a611327 enhance the projects.list updater to look at 'gitweb.*' config settings also
(not just 'R = gitweb')

Can you tell I really, really, don't want anything to do with gitweb and
daemon to be part of gitolite *core*?  :-)
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 5e2e13aac2 review all user input, system(), and `` 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 43f95f9b22 (minor) help command usage message changed 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 bc2bd7a78c oops; the $repo argument to PRE_ and POST_GIT triggers was wrong! 2012-03-24 10:30:45 +05:30
Sitaram Chamarty 34cfdb4355 add some checks to perms
- check user auth
  - check role names in legacy mode
2012-03-24 10:30:44 +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 741512482b 'info' learned not to show ^C column when used with '-p' 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 32494cfa0c info learned '-p' and pattern limiting.
'-p' is what gives you 'expand' now
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 c79f9d2381 glt learns to deal better with non-git commands 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
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 44e6bc4bb2 logging (but see below)
The logging is both for paranoia and parsing/automated processing.  The
ones you're probably interested in parsing should be easy to pick out
and are very likely to have tab-delimited fields already.
2012-03-24 10:30:43 +05:30
Sitaram Chamarty 5b93dd4b53 minor changes to the testing infrastructure 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 45348a4225 access() learned a new trick :) 2012-03-24 10:30:43 +05:30
Sitaram Chamarty 876b554fb5 changes to custom command invocation etc.; see below
- 'post-compile' subdir moved under 'commands/' but only for
    sanity; has no real significance now

  - new, internal use only, gitolite command run-all, as in

        gitolite run-all POST_COMPILE

    which runs all the commands in @{ $rc{POST_COMPILE} } in sequence.
    You can sdo this for any section of course, though this is the only
    one in the rc right now.

    (Future candidates: PRE_GIT, POST_GIT, PRE_CREATE, POST_CREATE)
2012-03-24 10:30:43 +05:30
Sitaram Chamarty efe37fb8a3 honor umask 2012-03-24 10:30:43 +05:30
Sitaram Chamarty db8dc8ca2d allow trace mode from remote client
just say (for example):

    git push git@server:reponame.git1

for trace level 1, and similarly for 2 and 3
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 afcd974afa record and maintain a 'version' (for info and elsewhere) 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 5e2563bb8c setup was over-engineered... 2012-03-24 10:30:42 +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 876f6517f5 (testing help) allow a *testing* rc to override the normal one 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 446bd19de7 tsh/test learn the cmp() function to make full output compares easier 2012-03-24 10:30:42 +05:30
Sitaram Chamarty fb332a6c76 (!!) neat little 'access' command...
...makes it sooo much eaier to check access rights from external scripts
2012-03-24 10:30:42 +05:30
Sitaram Chamarty 9a8a86306b _system() is less verbose
otherwise things like 'gitolite access' print extra junk that is
confusing.
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 5ebb981efa new sugar -- keysubdirs as groups. TODO: add appropriate commented entry to Gitolite::Rc.pm also 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 141b2ce897 more tests 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 89cc3a303d Test.pm learned confreset() and confadd() 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 356ff2b757 store got a few more validations
(a full scan of all input data is pending; this is just for diagnostics)
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 0aeb0cd5e2 ssh-authkeys done! 2012-03-24 10:30:42 +05:30
Sitaram Chamarty cbd4d43687 (minor) usage() sub can handle multiple usage sections in the same script 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 84422ccf30 (rc) prefix GL_BINDIR to PATH
Needed when the user didn't actually "install" but is just running it by
using the full path to "gitolite".  Without this, every time my code
runs "gitolite <some sub-command>" I have to prefix "gitolite" with
$ENV{GL_BINDIR}, which is kinda painful...
2012-03-24 10:30:42 +05:30
Sitaram Chamarty 428485086f query-rc learned '-n' to avoid the need to chomp() the result 2012-03-24 10:30:42 +05:30
Sitaram Chamarty ef476f0d32 common: slurp() learns to look at wantarray 2012-03-24 10:30:42 +05:30
Sitaram Chamarty c19f75e119 (subconf) add the warning message
(not as prominent as in g2 though...)
2012-03-24 10:30:42 +05:30
Sitaram Chamarty d64663d12e COUNT VREF and tests 2012-03-24 10:30:42 +05:30
Sitaram Chamarty 16d17def2a VREF code 2012-03-24 10:30:42 +05:30
Sitaram Chamarty ef021ee293 (test) forgot to set user.email/name to the standard value
caused old test scripts to fail (wherever I was checking the actual SHA
anyway)
2012-03-24 10:30:41 +05:30