Make run_git() and run_git_ex() available to plugins.
Also makes git_run_ex() always return "" on failure (some git commands
have some output on stdout also on failure (eg git-rev-parse)).
Add support for use with worktrees.
Move get_git_dir() to the global scope, and add get_git_commondir().
Update the installer and access-control to use the above.
Plugins: Default the plugin to pike-gitlab.
Plugins: Support selecting a plugin via environment variable.
Fixed typo in error message.
Added plugin api.
Install the githelper-plugins symlink.
Moved check_commit_msg() into CommitHookUtilsRepo.
This is in preparation for adding support for plugins.
Improved error message.
Show the arguments given to the git binary in the
git failure message.
Support committing on a detached HEAD.
This fixes failures to amend commits during interactive rebase.
Handle pushing of orphan commits
Added support for tracking branches.
These are a class of branches that essentially behave as movable tags.
Improved compatibility with *old* versions of Pike.
Added access level ACCESS_GROUP.
This is to simplify detection of access to group-level tags and branches.
Allow ordinary group members to create group tags and branches.
Use symbolic names for all access_level checks.
Users should always have full permissions to their own group.
Added some startup debug code.
This debug is enabled by starting githelper.pike with /bin/sh
(eg via switching the #! directive at the start of the file
Preprocessor directives should not be indented.
Allow .gitattributes in subdirectories.
pre-receive: Don't fail group access check silently.
Support both 8.1 and 7.8
Fixed warnings about static.
The keyword "static" has been marked deprecated in Pike 8.0.
Thanks to Chris Angelico <firstname.lastname@example.org> for the report.
Add support for group-based access control.
This patch adds support for a group file ".git/info/group"
containing a mapping from group names to member users.
Note that the first listed member of a group gets full
access and the following basic access. Users not listed
get no access. If multiple users need full access, this
can be achieved by having multiple entries for the group.
Also cleans up the access level handling code somewhat
by introducing an enum AccessLevel.
Removed broken use of Stdio.is_file(path)
Stdio.is_file(path) should not be used to check if some path is a
file, because it is not whether path is a file or not in the working
tree which is relevant, but rather whether or not it is one in the
commit/stage being investigated. In fact, there might not even be
a working tree since this test is also run on the server.
Instead, use get_file(path,2), which returns the empty string for
directories, which should have the intended effect of not complaining
about foreign_ident being removed from directories.
Add a kluge to handle pushes to branches with exactly one commit
When pushing to a branch, githelper checks if the old head of the
branch is reachable from the new head following only first-parents.
As an optimization, no more first-parents are followed once the old
head has been reached, which is to say old^ and its ancestors are
excluded from the rev-list. However, if old does not have a parent,
then rev-list fails to interpret old^. So as a kluge, detect this
case and disable the optimization as needed...
Allow removal of bogus foreign_ident entries for nonfiles.
There is one such mistake for /lib/modules/MIME.pmod in
.gitattributes on the main pike branches.
Fixed recognition of unterminated idents.
Implement access control namespaces
You now get access to tags and branches bases on their name:
Full access (create, delete and rebase/move all allowed, no policy
checking of commits)
No push access, unless the previous rule also matches
Regular access (no delete or rebase/move, names of newly created
branches and tags must contain no slashes, and branch names must not
consist entirely of digits and full stops)
Fix problem when changing a file into a directory
Add a second "allow_empty" mode to get_committed_file, which returns
the empty string is the named file is actually a directory. This is
used by the check_ident() function, which is ok since a directory
can't contain any expanded idents, so there is nothing to check.
Note that get_staged_file() ought to support this mode as well.
Currently, running get_staged_file() on a directory actually returns
the contents of the first file in the directory, which is a bug.
Check that pushes preserve first-parent ancestry
In addition to checking that a push is fast-forward, make sure
that the old head can be reached through first-parent pointers only.
This prevents tracking branches which have been pulled with merge
instead of rebase from being pushed by mistake.
Improve performance of run_git_ex()
Instead of calling Pike.DefaultBackend() until p->status() says tha
the process has terminated, loop until both stdout and stderr have
been closed. This is better because otherwise we may be stuck
inside the backend for up to one second while the process is already
terminated. This change gives a considerable speedup on Solaris.
Report all errors instead of stopping at the first one.
Improved some error messages.
Relax check on removal of foreign_ident
The foreign_ident attribute is now allowed to be removed from a file
which has already been been deprived of its expanded ident string.
This situation can happen when amending rebased commits.
Don't fail in check_ident on deleted files.
Only check each commit once in the recieve hook.
Add a post-rewrite hook to check rebases.
Re-run tests in post-commit hook
If amending a commit, the pre-commit hook will only see the
new changes being amended to the commit, not the changes
which were originally in the commit. Therefore, amending
an old broken commit might not show all problems unless
the result is also double checked.
Made it to work with 7.6.
To be a bit nicer to folks that have that old version in their paths, as
it's still the stock version coming with many dists.
Check also for weird control characters in recoded commit message.
Check encoding of commit messages.
Check dates of commits.
Make sure that git diff understands that .gitattributes is a pathname.
Check that tags are not moved and branches only fast-forwarded.
Optimized attribute lookup.
Added a post commit hook, to re-checkout files with ident.
"fe" should have been "fi".
Made a convenience function to split with \n and remove last element.
Prevent code working with idents from being munged by the ident handling itself...
Improve code reuse yet a little more.
Improve code reuse a little more.
Improve code reuse a little.
Pre-reverse attribute arrays for simpler access.
Improved attribute checking in server hook.
Server side hook.
Disable stupid filter.
Don't process changes to macro definitions in .gitattributes.
Restrict use of .gitattributes to top level dir.
Check for removal of lines from .gitattributes.
Check for blocker attributes on commit.
Replace PostCheckoutHook with PreCommitHook.
Learn how to count... :)
Name params to post-checkout hook.
No args given to filter functions...
Nice, but ultimately useless, ident filter finished...
Whitespace fixes, and added a missing error message.
Added missing return statement.