git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Sun Chao via GitGitGadget <gitgitgadget@gmail.com>
Date
Aug 3, 2022, 16:17 UTC
Message-ID
<pull.1301.git.git.1659543457.gitgitgadget@gmail.com>

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
Next: Sun Chao via GitGitGadget
Message 1 of 42 in “refs-advertise: add hook to filter advertised refs”
  1. 0/3 refs-advertise: add hook to filter advertised refsSun Chao via GitGitGadget, Aug 3, 2022
  2. 1/3 refs-advertise: add hook to filter advertised refsSun Chao via GitGitGadget, Aug 3, 2022
  3. 3/3 doc: add documentation for the refs-advertise hookSun Chao via GitGitGadget, Aug 3, 2022
  4. 2/3 t1419: add test cases for refs-advertise hookSun Chao via GitGitGadget, Aug 3, 2022
  5. Junio C HamanoAug 3, 2022
  6. 孙超Aug 4, 2022
  7. Jiang XinAug 10, 2022
  8. 孙超Aug 10, 2022
  9. 0/3 hide-refs: add hook to force hide refsSun Chao via GitGitGadget, Aug 15, 2022
  10. 1/3 hide-refs: add hook to force hide refsSun Chao via GitGitGadget, Aug 15, 2022
  11. 2/3 t1419: add test cases for hide-refs hookSun Chao via GitGitGadget, Aug 15, 2022
  12. 3/3 doc: add documentation for the hide-refs hookSun Chao via GitGitGadget, Aug 15, 2022
  13. Eric SunshineAug 15, 2022
  14. 孙超Aug 15, 2022
  15. Junio C HamanoAug 15, 2022
  16. 0/3 hide-refs: add hook to force hide refsSun Chao via GitGitGadget, Aug 15, 2022
  17. 1/3 hide-refs: add hook to force hide refsSun Chao via GitGitGadget, Aug 15, 2022
  18. 3/3 doc: add documentation for the hide-refs hookSun Chao via GitGitGadget, Aug 15, 2022
  19. 2/3 t1419: add test cases for hide-refs hookSun Chao via GitGitGadget, Aug 15, 2022
  20. 0/3 hide-refs: add hook to force hide refsSun Chao via GitGitGadget, Aug 15, 2022
  21. 3/3 doc: add documentation for the hide-refs hookSun Chao via GitGitGadget, Aug 15, 2022
  22. 1/3 hide-refs: add hook to force hide refsSun Chao via GitGitGadget, Aug 15, 2022
  23. Junio C HamanoAug 15, 2022
  24. 孙超Aug 16, 2022
  25. Calvin WanAug 18, 2022
  26. 孙超Aug 19, 2022
  27. 2/3 t1419: add test cases for hide-refs hookSun Chao via GitGitGadget, Aug 15, 2022
  28. 0/5 hiderefs: add hide-refs hook to hide refs dynamicallySun Chao via GitGitGadget, Sep 9, 2022
  29. 1/5 hiderefs: add hide-refs hook to hide refs dynamicallySun Chao via GitGitGadget, Sep 9, 2022
  30. Junio C HamanoSep 13, 2022
  31. Junio C HamanoSep 16, 2022
  32. 孙超Sep 17, 2022
  33. 2/5 hiderefs: use new flag to mark force hidden refsSun Chao via GitGitGadget, Sep 9, 2022
  34. 3/5 hiderefs: hornor hide flags in wire protocol V2Sun Chao via GitGitGadget, Sep 9, 2022
  35. 4/5 test: add test cases for hide-refs hookSun Chao via GitGitGadget, Sep 9, 2022
  36. 5/5 doc: add documentation for the hide-refs hookSun Chao via GitGitGadget, Sep 9, 2022
  37. 0/5 hiderefs: add hide-refs hook to hide refs dynamicallySun Chao via GitGitGadget, Sep 20, 2022
  38. 1/5 hiderefs: add hide-refs hook to hide refs dynamicallySun Chao via GitGitGadget, Sep 20, 2022
  39. 3/5 hiderefs: hornor hide flags in wire protocol V2Sun Chao via GitGitGadget, Sep 20, 2022
  40. 2/5 hiderefs: use a new flag to mark force hidden refsSun Chao via GitGitGadget, Sep 20, 2022
  41. 5/5 doc: add documentation for the hide-refs hookSun Chao via GitGitGadget, Sep 20, 2022
  42. 4/5 test: add test cases for hide-refs hookSun Chao via GitGitGadget, Sep 20, 2022

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.