Draft: fetch-pack: refactor packet writing
Refactor write_fetch_command_and_capabilities() to be a more general purpose function write_command_and_capabilities(), so that it can be used by both fetch and future command.
Here "command" means the "operations" supported by Git’s wire protocol https://git-scm.com/docs/protocol-v2. An example would be a git's subcommand, such as git-fetch(1); or an operation supported by the server side such as "object-info" implemented in "a2ba162c (object-info: support for retrieving object info, 2021-04-20)".
In a future separate series, we can move write_command_and_capabilities() to a higher-level file, such as connect.c, so that it becomes accessible to other commands.
Helped-by: Jonathan Tan jonathantanmy@google.com Helped-by: Christian Couder chriscool@tuxfamily.org Signed-off-by: Calvin Wan calvinwan@google.com Signed-off-by: Eric Ju eric.peijian@gmail.com