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 -- gitgitgadget