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.