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

Re: [PATCH] [Outreachy] cleanup: use list.h in mru.h and mru.c

From
Christian Couder <christian.couder@gmail.com>
Date
Sep 27, 2017, 11:30 UTC
Message-ID
<CAP8UFD24A8rxMfLMFmSStWnBMMeB58SqUdNoo3niQuc7LqRMMg@mail.gmail.com>
In-Reply-To
<CAL21BmnvJSaN+Tnw7Hdc5P5biAnM5dfWR7gX5FrAG1r_D8th=A@mail.gmail.com>

About the title, we don't usually start with "fix:" or "cleanup:" or "feature:". We usually start with the (main) area of the code that is changed.

So maybe something like "mru: use double-linked list implementation from list.h" would be better.

On Wed, Sep 27, 2017 at 12:18 PM, Оля Тележная <olyatelezhnaya@gmail.com> wrote:
> Remove implementation of double-linked list in mru.c and mru.h and use
> implementation from list.h.

It is important in the commit message to get a good idea of the reason why the patch is a good thing. So for example "Simplify mru.c, mru.h and related code by reusing the double-linked list implementation from list.h instead of a custom one." could be a bit better.

> Signed-off-by: Olga Telezhnaia <olyatelezhnaya@gmail.com>
> Mentored-by: Christian Couder <christian.couder@gmail.com>, Jeff King
> <peff@peff.net>
I think it's better if Peff is on another "Mentored-by: ..." line.
Show 6 quoted lines
> ---
>  builtin/pack-objects.c |  5 +++--
>  mru.c                  | 51 +++++++++++++++-----------------------------------
>  mru.h                  | 31 +++++++++++++-----------------
>  packfile.c             |  6 ++++--
>  4 files changed, 35 insertions(+), 58 deletions(-)

Here we can see that saying that we simplify things is probably true as the patch deletes more lines than it adds.

Show 11 quoted lines
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index f721137ea..fb4c9be89 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -995,8 +995,8 @@ static int want_object_in_pack(const unsigned char *sha1,
>          struct packed_git **found_pack,
>          off_t *found_offset)
>  {
> - struct mru_entry *entry;
>   int want;
> +        struct list_head *pos;
It looks like there are indentation problems in the patch.
Did you try to send it to you and apply what you received?
When I try to apply it to master I get:
> git am ~/Downloads/original_msg.txt
Applying: cleanup: use list.h in mru.h and mru.c
.git/rebase-apply/patch:18: indent with spaces.
        struct list_head *pos;
.git/rebase-apply/patch:152: indent with spaces.
        void *item;
error: patch failed: builtin/pack-objects.c:995
error: builtin/pack-objects.c: patch does not apply
error: patch failed: mru.c:1
error: mru.c: patch does not apply
error: patch failed: mru.h:8
error: mru.h: patch does not apply
error: patch failed: packfile.c:876
error: packfile.c: patch does not apply
Patch failed at 0001 cleanup: use list.h in mru.h and mru.c
The copy of the patch that failed is found in: .git/rebase-apply/patch
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

I am stopping here as it's quite difficult to read patches that have indentation problems.

Previous: Оля ТележнаяNext: Olga Telezhnaya
Message 2 of 26 in “[Outreachy] cleanup: use list.h in mru.h and mru.c”
  1. [Outreachy] cleanup: use list.h in mru.h and mru.cОля Тележная, Sep 27, 2017
  2. Christian CouderSep 27, 2017
  3. mru: use double-linked list from list.hOlga Telezhnaya, Sep 28, 2017
  4. Junio C HamanoSep 28, 2017
  5. Jeff KingSep 28, 2017
  6. Junio C HamanoSep 28, 2017
  7. Jeff KingSep 28, 2017
  8. Jeff KingSep 28, 2017
  9. Jeff KingSep 28, 2017
  10. Christian CouderSep 29, 2017
  11. Jeff KingSep 29, 2017
  12. Christian CouderSep 29, 2017
  13. Оля ТележнаяSep 29, 2017
  14. Оля ТележнаяSep 29, 2017
  15. Jeff KingSep 29, 2017
  16. Оля ТележнаяSep 30, 2017
  17. Jeff KingOct 2, 2017
  18. Jeff KingSep 29, 2017
  19. Junio C HamanoSep 30, 2017
  20. mru: use double-linked list from list.hOlga Telezhnaya, Sep 30, 2017
  21. Jeff KingOct 2, 2017
  22. Оля ТележнаяOct 2, 2017
  23. Jeff KingOct 3, 2017
  24. Junio C HamanoNov 8, 2017
  25. Jeff KingNov 8, 2017
  26. Оля ТележнаяNov 10, 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.