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

Re: [PATCH Outreachy v2 1/2] format: create pretty.h file

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 12, 2017, 22:12 UTC
Message-ID
<xmqqh8svzjbx.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<0102016049efb7b4-b8dc7cff-5ddf-4692-ba1c-3551720ec28d-000000@eu-west-1.amazonses.com>
Olga Telezhnaya <olyatelezhnaya@gmail.com> writes:
Show 32 quoted lines
>  builtin/notes.c       |  2 +-
>  builtin/reset.c       |  2 +-
>  builtin/show-branch.c |  2 +-
>  commit.h              | 81 +----------------------------------------------
>  pretty.h              | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++
>  revision.h            |  2 +-
>  6 files changed, 92 insertions(+), 84 deletions(-)
>  create mode 100644 pretty.h
>
> diff --git a/builtin/notes.c b/builtin/notes.c
> index 1a2c7d92ad7e7..7c8176164561b 100644
> --- a/builtin/notes.c
> +++ b/builtin/notes.c
> @@ -12,7 +12,7 @@
>  #include "builtin.h"
>  #include "notes.h"
>  #include "blob.h"
> -#include "commit.h"
> +#include "pretty.h"
>  #include "refs.h"
>  #include "exec_cmd.h"
>  #include "run-command.h"
> ...
> diff --git a/commit.h b/commit.h
> index 99a3fea68d3f6..8c68ca1a5a187 100644
> --- a/commit.h
> +++ b/commit.h
> @@ -7,6 +7,7 @@
>  #include "decorate.h"
>  #include "gpg-interface.h"
>  #include "string-list.h"
> +#include "pretty.h"

This is much nicer than what I imagined, which was to just add this line here, move decls from commit.h to pretty.h, and do nothing else, which would be the absolute safest thing from the point of view of other topics in flight. Separation of "pretty.h" would stay to be an implementation detail of the "commit.h" file, where everybody expects to find these decls.

Instead, this patch inspects each and every .c user of "commit.h" and replaces its '#include' with the new one if it only uses things declared in "pretty.h", which makes it very clear who have been depending on what in the patch. Those that include "commit.h" because they need both the "what is a commit object" aspect and "how to pretty print" aspect can keep using their original '#include' to ease the transition.

Let's see how well this plays with other topics in flight---I had to apply an evil merge to queue the previous one, if I recall right, as a user of "commit.h" that did not use pretty-print (hence did not get "pretty.h" with the previous round of this patch) gained use of pretty-print function, or something like that.

Will queue.
Thanks.
 
Previous: Olga Telezhnaya
Message 14 of 14 in “format: create pretty.h file”
  1. 1/2 format: create pretty.h fileOlga Telezhnaya, Dec 8, 2017
  2. 2/2 format: create docs for pretty.hOlga Telezhnaya, Dec 8, 2017
  3. Eric SunshineDec 8, 2017
  4. Junio C HamanoDec 8, 2017
  5. Jeff KingDec 10, 2017
  6. Junio C HamanoDec 10, 2017
  7. Оля ТележнаяDec 11, 2017
  8. Junio C HamanoDec 11, 2017
  9. Eric SunshineDec 8, 2017
  10. Junio C HamanoDec 8, 2017
  11. Оля ТележнаяDec 9, 2017
  12. 1/2 format: create pretty.h fileOlga Telezhnaya, Dec 12, 2017
  13. 2/2 format: create docs for pretty.hOlga Telezhnaya, Dec 12, 2017
  14. Junio C HamanoDec 12, 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.