Skip to content

refs-advertise: add hook to filter advertised refs

Sun Chao via GitGitGadget git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3refs-advertise: add hook to filter advertised refsMakefile builtin/receive-pack.c ls-refs.c +6 more+538 -90 replies
2/3t1419: add test cases for refs-advertise hookt/t1419-refs-advertise-hooks.sh t/t1419/common-functions.sh t/t1419/once-0000-abnormal-refs-advertise-hook.sh +5 more+980 -00 replies
3/3doc: add documentation for the refs-advertise hookDocumentation/githooks.txt+70 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/3] refs-advertise: add hook to filter advertised refs

Gerrit is implemented by JGit and is known as a centralized workflow system which supports reference-level access control for repository. If we choose to work in centralized workflow like what Gerrit provided, reference-level access control is needed and is possible if we add a reference advertise filter hook just like what Gerrit did.

This hook would be invoked by 'git-receive-pack' and 'git-upload-pack' during the reference discovery phase and the commit fetching phase, each reference and will be filtered by this hook. Git server can put reference-level control process to this hook and the git client does not need to change or known about that.

And there is also a partial clone issue says 'Dynamic object fetching' causes the server send a full set of info/refs when the connection is established, and if there are large number of refs, will incur significant overhead, and if we put such kind of hook maybe it will help.

In Huawei company, we are trying to copy the reference-level control feature from Gerrit to CGit (which is used by our git server), and we think maybe this hook is a good idea and wish for your replies, thanks!

Sun Chao (3):
refs-advertise: add hook to filter advertised refs
t1419: add test cases for refs-advertise hook
doc: add documentation for the refs-advertise hook

 Documentation/githooks.txt                    |  70 +++++
 Makefile                                      |   2 +
 builtin/receive-pack.c                        |  12 +
 ls-refs.c                                     |  30 ++-
 refs/refs-advertise.c                         | 246 +++++++++++++++++
 refs/refs-advertise.h                         |  11 +
 t/helper/test-refs-advertise.c                | 202 ++++++++++++++
 t/helper/test-tool.c                          |   1 +
 t/helper/test-tool.h                          |   1 +
 t/t1419-refs-advertise-hooks.sh               | 138 ++++++++++
 t/t1419/common-functions.sh                   |  80 ++++++
 .../once-0000-abnormal-refs-advertise-hook.sh | 199 ++++++++++++++
 t/t1419/test-0000-standard-git-clone.sh       |  56 ++++
 t/t1419/test-0001-standard-git-push.sh        |  34 +++
 ...0002-ls-remote-with-refs-advertise-hook.sh |  95 +++++++
 ...03-upload-pack-with-refs-advertise-hook.sh | 127 +++++++++
 ...4-receive-pack-with-refs-advertise-hook.sh | 251 ++++++++++++++++++
 upload-pack.c                                 |  42 ++-
 18 files changed, 1588 insertions(+), 9 deletions(-)
 create mode 100644 refs/refs-advertise.c
 create mode 100644 refs/refs-advertise.h
 create mode 100644 t/helper/test-refs-advertise.c
 create mode 100755 t/t1419-refs-advertise-hooks.sh
 create mode 100644 t/t1419/common-functions.sh
 create mode 100644 t/t1419/once-0000-abnormal-refs-advertise-hook.sh
 create mode 100644 t/t1419/test-0000-standard-git-clone.sh
 create mode 100644 t/t1419/test-0001-standard-git-push.sh
 create mode 100644 t/t1419/test-0002-ls-remote-with-refs-advertise-hook.sh
 create mode 100644 t/t1419/test-0003-upload-pack-with-refs-advertise-hook.sh
 create mode 100644 t/t1419/test-0004-receive-pack-with-refs-advertise-hook.sh

base-commit: 350dc9f0e8974b6fcbdeb3808186c5a79c3e7386
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1301%2Fsunchao9%2Frefs_advertise-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1301/sunchao9/refs_advertise-v1
Pull-Request: https://github.com/git/git/pull/1301

Signature · 1 line
gitgitgadget