diff options
author | Adam Jackson <ajax@redhat.com> | 2018-07-25 12:15:34 -0400 |
---|---|---|
committer | Adam Jackson <ajax@redhat.com> | 2018-07-25 12:15:34 -0400 |
commit | 5349da3c8b3d9e0ecdfcf142171587b04b3ac827 (patch) | |
tree | 8f10620df59969b971b9b8e2ad8c5343012ea4e1 | |
parent | 340cb7b046e2b43aeb62d9a278bc6acb657cbf7e (diff) |
add-gitlab-merge-requests: Add
This trick makes the gitlab merge requests heads show up as branches
under their own remote (normally named 'merge-requests'). This means you
can follow a module's development with:
$ git fetch merge-requests
Also git-describe and git-log decorations become more informative, etc.
-rwxr-xr-x | add-gitlab-merge-requests.sh | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/add-gitlab-merge-requests.sh b/add-gitlab-merge-requests.sh new file mode 100755 index 0000000..889f900 --- /dev/null +++ b/add-gitlab-merge-requests.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# +# add-gitlab-merge-requests.sh [origin] [remote] +# +# For modules hosted in gitlab, this adds a new remote named [remote] (default +# 'merge-requests') that points to the same URL as [origin] (default 'origin'), +# whose heads are the merge requests for that module. Such names are then +# visible in 'git log' decorations, eg: +# +# commit 4bfb35c1ddebc6074608c129cdce702772d47bb6 (merge-requests/51) +# Author: Peter Hutterer <peter.hutterer@who-t.net> +# Date: Mon Jul 23 21:21:31 2018 +1000 +# +# Gitlab CI: properly define empty dependencies for the wayland-web hook +# +# And in general they behave exactly like any other branch or remote, +# including that they are fetched independently from [origin]. + +origin=${1:-origin} +url=$(git remote get-url ${origin}) +remote=${2:-merge-requests} + +git remote add ${remote} ${url} +git config remote.${remote}.fetch \ + "+refs/merge-requests/*/head:refs/remotes/${remote}/*" +git fetch ${remote} |