From 5349da3c8b3d9e0ecdfcf142171587b04b3ac827 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Wed, 25 Jul 2018 12:15:34 -0400 Subject: 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. --- add-gitlab-merge-requests.sh | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 add-gitlab-merge-requests.sh 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 +# 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} -- cgit v1.2.3