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

Re: [PATCH v2 1/3] config: create a function to format section headers

From
Ramsay Jones <ramsay@ramsayjones.plus.com>
Date
Jun 19, 2017, 12:08 UTC
Message-ID
<087c8d6e-10f0-2c1f-1974-a97f4f685288@ramsayjones.plus.com>
In-Reply-To
<1497820591-93434-1-git-send-email-sahildua2305@gmail.com>
On 18/06/17 22:16, Sahil Dua wrote:
Show 8 quoted lines
> Factor out the logic which creates section headers in the config file,
> e.g. the 'branch.foo' key will be turned into '[branch "foo"]'.
> 
> This introduces no function changes, but is needed for a later change
> which adds support for copying branch sections in the config file.
> 
> Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>

Adding my SOB isn't really appropriate here - I only made a very very minor contribution. At _most_ you might consider 'Helped-by:', but even that would probably be overkill. ;-)

Thanks.

ATB, Ramsay Jones

Show 39 quoted lines
> Signed-off-by: Sahil Dua <sahildua2305@gmail.com>
> ---
>  config.c | 13 +++++++++++--
>  1 file changed, 11 insertions(+), 2 deletions(-)
> 
> diff --git a/config.c b/config.c
> index 34a139c..32fd3c8 100644
> --- a/config.c
> +++ b/config.c
> @@ -2169,10 +2169,10 @@ static int write_error(const char *filename)
>  	return 4;
>  }
>  
> -static int store_write_section(int fd, const char *key)
> +static struct strbuf store_create_section(const char *key)
>  {
>  	const char *dot;
> -	int i, success;
> +	int i;
>  	struct strbuf sb = STRBUF_INIT;
>  
>  	dot = memchr(key, '.', store.baselen);
> @@ -2188,6 +2188,15 @@ static int store_write_section(int fd, const char *key)
>  		strbuf_addf(&sb, "[%.*s]\n", store.baselen, key);
>  	}
>  
> +	return sb;
> +}
> +
> +static int store_write_section(int fd, const char *key)
> +{
> +	int success;
> +
> +	struct strbuf sb = store_create_section(key);
> +
>  	success = write_in_full(fd, sb.buf, sb.len) == sb.len;
>  	strbuf_release(&sb);
>  
> 
Previous: Sahil DuaNext: Sahil Dua
Message 38 of 39 in “branch: add tests for new copy branch feature”
  1. 1/6 branch: add tests for new copy branch featureSahil Dua, May 31, 2017
  2. 4/6 config: modify function signature to include copy argumentSahil Dua, May 31, 2017
  3. 6/6 branch: don't copy or rename config when same branch nameSahil Dua, May 31, 2017
  4. 3/6 config: abstract out create section from key logicSahil Dua, May 31, 2017
  5. 2/6 branch: add copy branch optionSahil Dua, May 31, 2017
  6. Junio C HamanoJun 1, 2017
  7. Sahil DuaJun 1, 2017
  8. 5/6 config: add copy config section logicSahil Dua, May 31, 2017
  9. 1/3 branch: add tests for new copy branch featureSahil Dua, Jun 1, 2017
  10. 2/3 config: abstract out create section from key logicSahil Dua, Jun 1, 2017
  11. 3/3 branch: add copy branch feature implementationSahil Dua, Jun 1, 2017
  12. Ævar Arnfjörð BjarmasonJun 1, 2017
  13. Sahil DuaJun 1, 2017
  14. 1/3 branch: add tests for new copy branch featureSahil Dua, Jun 5, 2017
  15. 2/3 config: abstract out create section from key logicSahil Dua, Jun 5, 2017
  16. 3/3 branch: add copy branch feature implementationSahil Dua, Jun 5, 2017
  17. Sahil DuaJun 5, 2017
  18. Junio C HamanoJun 6, 2017
  19. Junio C HamanoJun 6, 2017
  20. Ævar Arnfjörð BjarmasonJun 6, 2017
  21. Sahil DuaJun 6, 2017
  22. Junio C HamanoJun 6, 2017
  23. 1/3 config: create a function to format section headersSahil Dua, Jun 13, 2017
  24. 2/3 branch: add test for -m renaming multiple config sectionsSahil Dua, Jun 13, 2017
  25. Junio C HamanoJun 13, 2017
  26. Ævar Arnfjörð BjarmasonJun 13, 2017
  27. Junio C HamanoJun 13, 2017
  28. Ævar Arnfjörð BjarmasonJun 13, 2017
  29. 2/3 branch: add test for -m renaming multiple config sectionsSahil Dua, Jun 18, 2017
  30. 3/3 branch: add a --copy (-c) option to go with --move (-m)Sahil Dua, Jun 13, 2017
  31. Junio C HamanoJun 13, 2017
  32. Junio C HamanoJun 13, 2017
  33. Sahil DuaJun 14, 2017
  34. 3/3 branch: add a --copy (-c) option to go with --move (-m)Sahil Dua, Jun 18, 2017
  35. Junio C HamanoJun 13, 2017
  36. Ævar Arnfjörð BjarmasonJun 13, 2017
  37. 1/3 config: create a function to format section headersSahil Dua, Jun 18, 2017
  38. Ramsay JonesJun 19, 2017
  39. Sahil DuaJun 19, 2017

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.