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

Re: [PATCH v5 2/2] am: reload .gitattributes after patching it

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Aug 30, 2019, 19:46 UTC
Message-ID
<nycvar.QRO.7.76.6.1908302145270.46@tvgsbejvaqbjf.bet>
In-Reply-To
<20190829230928.GF11334@genre.crustytoothpaste.net>
Hi brian,
On Thu, 29 Aug 2019, brian m. carlson wrote:
Show 41 quoted lines
> On 2019-08-28 at 11:30:53, Johannes Schindelin wrote:
> > > diff --git a/convert.c b/convert.c
> > > index 94ff837649..0e6e9d2d75 100644
> > > --- a/convert.c
> > > +++ b/convert.c
> > > @@ -8,6 +8,7 @@
> > >  #include "pkt-line.h"
> > >  #include "sub-process.h"
> > >  #include "utf8.h"
> > > +#include "ll-merge.h"
> > >
> > >  /*
> > >   * convert.c - convert a file when checking it out and checking it in.
> > > @@ -1293,10 +1294,11 @@ struct conv_attrs {
> > >  	const char *working_tree_encoding; /* Supported encoding or default encoding if NULL */
> > >  };
> > >
> > > +static struct attr_check *check;
> > > +
> > >  static void convert_attrs(const struct index_state *istate,
> > >  			  struct conv_attrs *ca, const char *path)
> > >  {
> > > -	static struct attr_check *check;
> > >  	struct attr_check_item *ccheck = NULL;
> > >
> > >  	if (!check) {
> >
> > After this line:
> >
> >                 check = attr_check_initl("crlf", "ident", "filter",
> > 				"eol", "text", "working-tree-encoding",
> > 				NULL);
> > 		user_convert_tail = &user_convert;
> > 		git_config(read_convert_config, NULL);
> > 	}
> >
> > I am a bit worried about `user_convert`: it seems never to be re-set.
>
> Yeah, it looks like I'll need to reset that as well.  The only
> consequence is that we leak a small amount of memory if there are filter
> attributes, but it's better to avoid that leak if we can.
Okay, good, so my suggestion was not so completely off the mark.
Show 6 quoted lines
>
> > Also, how thread-safe do we need `reset_parsed_attributes()` to be?
>
> Since patch application isn't thread safe, it doesn't need to be
> thread safe at all.  The original wasn't thread safe, either, since it
> used a static variable without a mutex.
Thank you for clarifying! Much appreciated.

Ciao, Dscho

Previous: brian m. carlsonNext: Phillip Wood
Message 6 of 10 in “Honor .gitattributes with rebase --am”
  1. 0/2 Honor .gitattributes with rebase --ambrian m. carlson, Aug 25, 2019
  2. 1/2 path: add a function to check for path suffixbrian m. carlson, Aug 25, 2019
  3. 2/2 am: reload .gitattributes after patching itbrian m. carlson, Aug 25, 2019
  4. Johannes SchindelinAug 28, 2019
  5. brian m. carlsonAug 29, 2019
  6. Johannes SchindelinAug 30, 2019
  7. Phillip WoodAug 26, 2019
  8. 0/2 Honor .gitattributes with rebase --ambrian m. carlson, Sep 2, 2019
  9. 1/2 path: add a function to check for path suffixbrian m. carlson, Sep 2, 2019
  10. 2/2 am: reload .gitattributes after patching itbrian m. carlson, Sep 2, 2019

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.