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

Re: [PATCH 5/7] sha1-file: pass git_hash_algo to write_object_file_prepare()

From
Torsten Bögershausen <tboegi@web.de>
Date
Feb 1, 2020, 10:03 UTC
Message-ID
<20200201100337.u4ikzmrprca4ltvb@tb-raspi4>
In-Reply-To
<f256d2058736091c3d9662788762849e8df794b0.1580413221.git.matheus.bernardino@usp.br>
On Thu, Jan 30, 2020 at 05:32:21PM -0300, Matheus Tavares wrote:
Show 24 quoted lines
> Allow write_object_file_prepare() to receive arbitrary 'struct
> git_hash_algo's instead of always using the_hash_algo. The added
> parameter will be used in the next commit to make hash_object_file() be
> able to work with arbitrary git_hash_algo's, as well.
>
> Signed-off-by: Matheus Tavares <matheus.bernardino@usp.br>
> ---
>  sha1-file.c | 20 ++++++++++++--------
>  1 file changed, 12 insertions(+), 8 deletions(-)
>
> diff --git a/sha1-file.c b/sha1-file.c
> index 13b90b1cb1..e789bfd153 100644
> --- a/sha1-file.c
> +++ b/sha1-file.c
> @@ -1647,7 +1647,8 @@ void *read_object_with_reference(struct repository *r,
>  	}
>  }
>
> -static void write_object_file_prepare(const void *buf, unsigned long len,
> +static void write_object_file_prepare(const struct git_hash_algo *algo,
> +				      const void *buf, unsigned long len,
>  				      const char *type, struct object_id *oid,
>  				      char *hdr, int *hdrlen)
>  {
One minor minor suggestion/nit, may be my own type of style only.

When adding a parameter to a function, we typically add it at the end of the parameter list, rather than at the beginning. The other (unwritten) convention, when dealing with "buffer pointer/len", seams to be that buffer-ptr is the first paramter and len is is the second.

However, this is my personal note, other opinions and comments are welcome. What do others think ?

Previous: Matheus TavaresNext: Jeff King
Message 8 of 16 in “fix inconsistent uses of the_repo in parse_object()'s call chain”
  1. 0/7 fix inconsistent uses of the_repo in parse_object()'s call chainMatheus Tavares, Jan 30, 2020
  2. 1/7 diff: make diff_populate_filespec() honor its repo argumentMatheus Tavares, Jan 30, 2020
  3. 2/7 cache-tree: use given repo's hash_algo at verify_one()Matheus Tavares, Jan 30, 2020
  4. 3/7 pack-check: use given repo's hash_algo at verify_packfile()Matheus Tavares, Jan 30, 2020
  5. 4/7 streaming: allow open_istream() to handle any repoMatheus Tavares, Jan 30, 2020
  6. Junio C HamanoJan 31, 2020
  7. 5/7 sha1-file: pass git_hash_algo to write_object_file_prepare()Matheus Tavares, Jan 30, 2020
  8. Torsten BögershausenFeb 1, 2020
  9. Jeff KingFeb 1, 2020
  10. 6/7 sha1-file: pass git_hash_algo to hash_object_file()Matheus Tavares, Jan 30, 2020
  11. 7/7 sha1-file: allow check_object_signature() to handle any repoMatheus Tavares, Jan 30, 2020
  12. Junio C HamanoJan 30, 2020
  13. brian m. carlsonJan 30, 2020
  14. Jeff KingJan 31, 2020
  15. Matheus Tavares BernardinoFeb 1, 2020
  16. Jeff KingFeb 1, 2020

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.