GitLabgitlab-org

cli

main
ply8 git calls35 ms97 KiB6 cachedprotocol v2
128 lines3.5 KiBexecutableRaw
1#!/bin/sh
2#
3# An example hook script to block unannotated tags from entering.
4# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
5#
6# To enable this hook, rename this file to "update".
7#
8# Config
9# ------
10# hooks.allowunannotated
11# This boolean sets whether unannotated tags will be allowed into the
12# repository. By default they won't be.
13# hooks.allowdeletetag
14# This boolean sets whether deleting tags will be allowed in the
15# repository. By default they won't be.
16# hooks.allowmodifytag
17# This boolean sets whether a tag may be modified after creation. By default
18# it won't be.
19# hooks.allowdeletebranch
20# This boolean sets whether deleting branches will be allowed in the
21# repository. By default they won't be.
22# hooks.denycreatebranch
23# This boolean sets whether remotely creating branches will be denied
24# in the repository. By default this is allowed.
27# --- Command line
28refname="$1"
29oldrev="$2"
30newrev="$3"
32# --- Safety check
33if [ -z "$GIT_DIR" ]; then
34 echo "Don't run this script from the command line." >&2
35 echo " (if you want, you could supply GIT_DIR then run" >&2
36 echo " $0 <ref> <oldrev> <newrev>)" >&2
37 exit 1
38fi
40if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
41 echo "usage: $0 <ref> <oldrev> <newrev>" >&2
42 exit 1
43fi
45# --- Config
46allowunannotated=$(git config --type=bool hooks.allowunannotated)
47allowdeletebranch=$(git config --type=bool hooks.allowdeletebranch)
48denycreatebranch=$(git config --type=bool hooks.denycreatebranch)
49allowdeletetag=$(git config --type=bool hooks.allowdeletetag)
50allowmodifytag=$(git config --type=bool hooks.allowmodifytag)
52# check for no description
53projectdesc=$(sed -e '1q' "$GIT_DIR/description")
54case "$projectdesc" in
55"Unnamed repository"* | "")
56 echo "*** Project description file hasn't been set" >&2
57 exit 1
58 ;;
59esac
61# --- Check types
62# if $newrev is 0000...0000, it's a commit to delete a ref.
63zero="0000000000000000000000000000000000000000"
64if [ "$newrev" = "$zero" ]; then
65 newrev_type=delete
66else
67 newrev_type=$(git cat-file -t $newrev)
68fi
70case "$refname","$newrev_type" in
71 refs/tags/*,commit)
72 # un-annotated tag
73 short_refname=${refname##refs/tags/}
74 if [ "$allowunannotated" != "true" ]; then
75 echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
76 echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
77 exit 1
78 fi
79 ;;
80 refs/tags/*,delete)
81 # delete tag
82 if [ "$allowdeletetag" != "true" ]; then
83 echo "*** Deleting a tag is not allowed in this repository" >&2
84 exit 1
85 fi
86 ;;
87 refs/tags/*,tag)
88 # annotated tag
89 if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
90 then
91 echo "*** Tag '$refname' already exists." >&2
92 echo "*** Modifying a tag is not allowed in this repository." >&2
93 exit 1
94 fi
95 ;;
96 refs/heads/*,commit)
97 # branch
98 if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
99 echo "*** Creating a branch is not allowed in this repository" >&2
100 exit 1
101 fi
102 ;;
103 refs/heads/*,delete)
104 # delete branch
105 if [ "$allowdeletebranch" != "true" ]; then
106 echo "*** Deleting a branch is not allowed in this repository" >&2
107 exit 1
108 fi
109 ;;
110 refs/remotes/*,commit)
111 # tracking branch
112 ;;
113 refs/remotes/*,delete)
114 # delete tracking branch
115 if [ "$allowdeletebranch" != "true" ]; then
116 echo "*** Deleting a tracking branch is not allowed in this repository" >&2
117 exit 1
118 fi
119 ;;
120 *)
121 # Anything else (is there anything else?)
122 echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
123 exit 1
124 ;;
125esac
127# --- Finished
128exit 0
Diagnostics8 git calls · 35 ms
CallStatusSizeTime035 ms
discover200185 B3 ms
git.upload-pack discover
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=185
git.server.agent=git/2.56.g1891de4-Linux
git.server.object_format=sha1
git.server.caps=agent ls-refs fetch server-option object-format
git.server.fetch=shallow wait-for-done filter
git.protocol.version=2
git.pkt.frames=9
git.pkt.data=7
git.pkt.flush=2
git.pkt.delim=0
git.pkt.bytes=185
git.pkt.payload.max=35
ls-refs20058 KiB2 ms
git.upload-pack ls-refs
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=ls-refs
git.upstream.dur_ms=2
git.response.bytes=59849
git.response.cache=UPDATING
git.response.duration_ms=2
git.protocol.version=2
git.pkt.frames=731
git.pkt.data=730
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=59849
git.pkt.payload.max=143
git.ls_refs.count=730
git.ls_refs.head=refs/heads/main
fetchcombine:blob:none+tree:2 · deepen 12004.2 KiB · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=4273
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=combine:blob:none+tree:2
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=1
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=7
git.pkt.data=5
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=4273
git.pkt.payload.max=4173
git.sideband.band1.bytes=4173
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=11
git.pack.bytes=4173
git.fetch.wide.objects=11
git.fetch.wide.extra_bytes=3930
git.fetch.wide.blobs=0
fetchtree:0 · deepen 1020032 KiB · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=3
git.response.bytes=32926
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=tree:0
git.fetch.wants=0dd7574dce9e385c5c30540e6c15657adc6bdce9
git.fetch.haves.count=0
git.fetch.deepen=10
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=22
git.pkt.data=20
git.pkt.flush=1
git.pkt.delim=1
git.pkt.bytes=32926
git.pkt.payload.max=32046
git.sideband.band1.bytes=32046
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=80
git.pack.bytes=32046
git.pack.ofs_delta=36
git.pack.ref_delta=0
git.pack.chain.max=2
git.pack.trailer=cb0bad5d7ffc514895d8b21c4dd470327f90bc91
git.pack.full=44
Open pack map
fetchtree:0200269 B · hit3 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=4
git.response.bytes=269
git.response.cache=HIT
git.response.duration_ms=3
git.fetch.filter=tree:0
git.fetch.wants=03418b1543b5ed53722e5f33e3b74e146f53f68d
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=269
git.pkt.payload.max=242
git.sideband.band1.bytes=242
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=242
git.pack.trailer=026c020e1be62d2b2c6d8f3a03f3525b7a86efd1
Open pack map
fetchtree:0200474 B · hit4 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=2
git.response.bytes=474
git.response.cache=HIT
git.response.duration_ms=4
git.fetch.filter=tree:0
git.fetch.wants=7c3f97bfb728c74316598d2bbce58b3fb8dd3080
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=474
git.pkt.payload.max=447
git.sideband.band1.bytes=447
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=447
git.pack.trailer=8479fc10eb7e3b4ab926685ee5a551ec5eb00e71
Open pack map
fetchtree:0200459 B · hit2 ms
git.upload-pack fetch
http.response.status_code=200
git.upstream.cf_ray=-
git.upstream.phase=fetch
git.upstream.dur_ms=21
git.response.bytes=459
git.response.cache=HIT
git.response.duration_ms=2
git.fetch.filter=tree:0
git.fetch.wants=2f6bc382bc7a73c9331b843ccc187e6ce8618d73
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=459
git.pkt.payload.max=432
git.sideband.band1.bytes=432
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0
git.pack.objects=1
git.pack.bytes=432
git.pack.trailer=fc2e9690b01682f106088547b32fb83e09704b92
Open pack map
fetch2001.2 KiB · hit21 ms
git.upload-pack fetch
http.response.status_code=200
git.response.bytes=1212
git.response.cache=HIT
git.response.duration_ms=21
git.fetch.wants=5014c4b31cb9700dbd458c8841d8cd91d3b8773c
git.fetch.haves.count=0
git.fetch.deepen=0
git.fetch.thin_pack=false
git.fetch.ofs_delta=true
git.protocol.version=2
git.pkt.frames=4
git.pkt.data=3
git.pkt.flush=1
git.pkt.delim=0
git.pkt.bytes=1212
git.pkt.payload.max=1185
git.sideband.band1.bytes=1185
git.sideband.band2.bytes=0
git.sideband.band3.bytes=0

Each row is one HTTP round trip ply made to the git server for this page, on one timeline. discover asks what the server speaks, ls-refs lists branch tips, fetch brings objects by id. A hit was served by Workers Cache. Tap a row for its wire details.

Remote
https://gitlab.com/gitlab-org/cli
Ref
refs/heads/main
Commit
0dd7574dce9e385c5c30540e6c15657adc6bdce9
cf-ray
a5e1431b9ea80bf5
Request
68036465…
Protocol
v2 · sha1
Agent
git/2.56.g1891de4-Linux
Filter
advertised
Fetch
shallow wait-for-done filter
Capabilities
agent ls-refs fetch server-option object-format