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

Re: [RFC/PATCH 1/4] sha1_name: creating context cache

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jun 6, 2010, 15:56 UTC
Message-ID
<vpqpr045f46.fsf@bauges.imag.fr>
In-Reply-To
<1275823848-7151-2-git-send-email-clement.poulain@ensimag.imag.fr>
Clément Poulain <clement.poulain@ensimag.imag.fr> writes:
> This cache keeps the global context for the last sha1 looked up, especially its pathname. The textconv is indeed defined by the diff driver, which is associated with a pathname, not a blob

Please, wrap your message to make it fit in 80 characters (M-q under Emacs can help). This applies to the cover email too, but is particularly important for this one, since it'll become the commit message if the patch is accepted.

Show 14 quoted lines
> diff --git a/cache.h b/cache.h
> index 0f4263c..26a1faf 100644
> --- a/cache.h
> +++ b/cache.h
> @@ -730,6 +730,14 @@ static inline unsigned int hexval(unsigned char c)
>  #define MINIMUM_ABBREV 4
>  #define DEFAULT_ABBREV 7
>  
> +struct object_resolve_context {
> +	unsigned char tree[20];
> +	char path[PATH_MAX];
> +	unsigned mode;
> +};
> +extern struct object_resolve_context object_context;

Is it really a good idea to make this a global variable? As I understand it, the semantics of this variable is that it contains information on the last sha1 name parsed (BTW, you probably want to add a comment here explaining that). Wouldn't it be more robust to have this value returned by the function doing the parsing?

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Clément PoulainNext: Jeff King
Message 6 of 8 in “git-gui blame: use textconv”
  1. 0/4 git-gui blame: use textconvClément Poulain, Jun 6, 2010
  2. 1/4 sha1_name: creating context cacheClément Poulain, Jun 6, 2010
  3. 2/4 textconv: support for cat-fileClément Poulain, Jun 6, 2010
  4. 3/4 git-gui: use textconv filter for diff and blameClément Poulain, Jun 6, 2010
  5. 4/4 t/t8007: test textconv support for cat-fileClément Poulain, Jun 6, 2010
  6. Matthieu MoyJun 6, 2010
  7. Jeff KingJun 6, 2010
  8. Clément PoulainJun 7, 2010

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.