aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSitaram Chamarty <sitaramc@gmail.com>2020-08-04 18:45:27 +0530
committerSitaram Chamarty <sitaramc@gmail.com>2020-08-04 18:45:27 +0530
commit91f73356bd2a30fcf6ab923ad8e616351adb6cbd (patch)
tree8cc3c53a490e8ea88060f1d6602e637a25fcf795 /src/commands/newbranch
parentInstall script can now modify shebangs when using a custom perl executable. (diff)
downloadgitolite-gentoo-91f73356bd2a30fcf6ab923ad8e616351adb6cbd.tar.gz
gitolite-gentoo-91f73356bd2a30fcf6ab923ad8e616351adb6cbd.tar.bz2
gitolite-gentoo-91f73356bd2a30fcf6ab923ad8e616351adb6cbd.zip
gitolite mirroring terminology changes
This affects the mirroring code and documentation: "slave"/"slaves" are now "copy"/"copies". Backward compatibility should be maintained; you do not need to change either your gitolite.conf, or any scripts you have written on top, until you are ready to do so. (This in turn means the word "slave" will still be present in the code, though only just as much as needed.) Should you wish to make this change, you need to migrate to the latest version (which is also tagged as 3.6.12, so if you want to wait till the distros pick it up wait for that), and then: - In the gitolite.conf file, change `option mirror.slaves` to `option mirror.copies`. - If you have any scripts that use the `gitolite mirror list slaves` command, change to `gitolite mirror list copies`. sitaram
Diffstat (limited to 'src/commands/newbranch')
-rwxr-xr-xsrc/commands/newbranch41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/commands/newbranch b/src/commands/newbranch
new file mode 100755
index 0000000..6dff545
--- /dev/null
+++ b/src/commands/newbranch
@@ -0,0 +1,41 @@
+#!/usr/bin/perl
+use strict;
+use warnings;
+
+use lib $ENV{GL_LIBDIR};
+use Gitolite::Easy;
+
+=for usage
+Usage: ssh git@host newbranch <repo name> <new branch name> <based-on ref name>
+
+Create a new branch and set it to existing branch or tag. You should have
+write access to that branch.
+
+NOTE: runs "git branch arg-2 arg-3" in repo given by arg-1, which means you
+should NOT prefix arguments with "refs/heads/" or "refs/tags/".
+
+----
+
+This is for people who have restrictions on what files they can "touch". When
+you fork a branch and change a file, even if you changed only the files you're
+allowed to, gitolite thinks you changed *all* the files in the repo because
+the "old SHA" is basically empty.
+
+This helps get around that by first creating the new branch, so that you can
+then push to it.
+
+To enable this command, add it to the rc file as a 'command'.
+
+TODO: handle deletes also (less commonly encountered and left as an "exercise
+for the reader" for now!)
+=cut
+
+usage() if not @ARGV or @ARGV < 3 or $ARGV[0] eq '-h';
+
+my $repo = shift;
+my $newbr = shift;
+my $oldref = shift;
+
+_die "you are not authorized" unless can_write($repo, "W", "refs/heads/$newbr");
+
+Gitolite::Common::_system("git", "branch", $newbr, $oldref);