[v1,1/5] sequencer: update `total_nr' when adding an item to a todo list
diff mbox series

Message ID 20190925201315.19722-2-alban.gruin@gmail.com
State New
Headers show
Series
  • [v1,1/5] sequencer: update `total_nr' when adding an item to a todo list
Related show

Commit Message

Alban Gruin Sept. 25, 2019, 8:13 p.m. UTC
`total_nr' is the total amount of items, done and toto, that are in a
todo list.  But unlike `nr', it was not updated when an item was
appended to the list.

This variable is mostly used by command prompts (ie. git-prompt.sh and
the like).

Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
---
 sequencer.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Junio C Hamano Oct. 2, 2019, 2:10 a.m. UTC | #1
Alban Gruin <alban.gruin@gmail.com> writes:

> `total_nr' is the total amount of items, done and toto, that are in a
> todo list.  But unlike `nr', it was not updated when an item was
> appended to the list.

s/amount/number/, as amount is specifically for something
that cannot be counted.

Perhaps a stupid language question but what is "toto"?


> This variable is mostly used by command prompts (ie. git-prompt.sh and
> the like).
>
> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
> ---
>  sequencer.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/sequencer.c b/sequencer.c
> index d648aaf416..575b852a5a 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -2070,6 +2070,7 @@ void todo_list_release(struct todo_list *todo_list)
>  static struct todo_item *append_new_todo(struct todo_list *todo_list)
>  {
>  	ALLOC_GROW(todo_list->items, todo_list->nr + 1, todo_list->alloc);
> +	todo_list->total_nr++;
>  	return todo_list->items + todo_list->nr++;
>  }
Johannes Schindelin Oct. 2, 2019, 8:06 a.m. UTC | #2
Hi Junio,

On Wed, 2 Oct 2019, Junio C Hamano wrote:

> Alban Gruin <alban.gruin@gmail.com> writes:
>
> > `total_nr' is the total amount of items, done and toto, that are in a
> > todo list.  But unlike `nr', it was not updated when an item was
> > appended to the list.
>
> s/amount/number/, as amount is specifically for something
> that cannot be counted.
>
> Perhaps a stupid language question but what is "toto"?

"in toto" is Latin for "in total", if I remember correctly.

But in this instance, I think it is merely a typo and should have been
"todo" instead. That is what the "total_nr" is about: the number of
"done" and "todo" items, added together.

Ciao,
Dscho

>
>
> > This variable is mostly used by command prompts (ie. git-prompt.sh and
> > the like).
> >
> > Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
> > ---
> >  sequencer.c | 1 +
> >  1 file changed, 1 insertion(+)
> >
> > diff --git a/sequencer.c b/sequencer.c
> > index d648aaf416..575b852a5a 100644
> > --- a/sequencer.c
> > +++ b/sequencer.c
> > @@ -2070,6 +2070,7 @@ void todo_list_release(struct todo_list *todo_list)
> >  static struct todo_item *append_new_todo(struct todo_list *todo_list)
> >  {
> >  	ALLOC_GROW(todo_list->items, todo_list->nr + 1, todo_list->alloc);
> > +	todo_list->total_nr++;
> >  	return todo_list->items + todo_list->nr++;
> >  }
>
Junio C Hamano Oct. 2, 2019, 8:59 a.m. UTC | #3
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi Junio,
>
> On Wed, 2 Oct 2019, Junio C Hamano wrote:
>
>> Alban Gruin <alban.gruin@gmail.com> writes:
>>
>> > `total_nr' is the total amount of items, done and toto, that are in a
>> > todo list.  But unlike `nr', it was not updated when an item was
>> > appended to the list.
>>
>> s/amount/number/, as amount is specifically for something
>> that cannot be counted.
>>
>> Perhaps a stupid language question but what is "toto"?
>
> "in toto" is Latin for "in total", if I remember correctly.

And "Toto" can also be "Toyo Toki", one of the two large and well
known Japanese manufacturers of porcelain things you see in
bathrooms--oh how appropriate in this project ;-).

> But in this instance, I think it is merely a typo and should have been
> "todo" instead. That is what the "total_nr" is about: the number of
> "done" and "todo" items, added together.

If I were writing this, I would probably say "... the total number
of items, counting both done and todo,..." and with 'counting both'
I wouldn't have been so puzzled.

Thanks.

>
> Ciao,
> Dscho
>
>>
>>
>> > This variable is mostly used by command prompts (ie. git-prompt.sh and
>> > the like).
>> >
>> > Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
>> > ---
>> >  sequencer.c | 1 +
>> >  1 file changed, 1 insertion(+)
>> >
>> > diff --git a/sequencer.c b/sequencer.c
>> > index d648aaf416..575b852a5a 100644
>> > --- a/sequencer.c
>> > +++ b/sequencer.c
>> > @@ -2070,6 +2070,7 @@ void todo_list_release(struct todo_list *todo_list)
>> >  static struct todo_item *append_new_todo(struct todo_list *todo_list)
>> >  {
>> >  	ALLOC_GROW(todo_list->items, todo_list->nr + 1, todo_list->alloc);
>> > +	todo_list->total_nr++;
>> >  	return todo_list->items + todo_list->nr++;
>> >  }
>>
Johannes Schindelin Oct. 2, 2019, 9:48 a.m. UTC | #4
Hi Junio,

On Wed, 2 Oct 2019, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> > On Wed, 2 Oct 2019, Junio C Hamano wrote:
> >
> >> Alban Gruin <alban.gruin@gmail.com> writes:
> >>
> >> > `total_nr' is the total amount of items, done and toto, that are in a
> >> > todo list.  But unlike `nr', it was not updated when an item was
> >> > appended to the list.
> >>
> >> s/amount/number/, as amount is specifically for something
> >> that cannot be counted.
> >>
> >> Perhaps a stupid language question but what is "toto"?
> >
> > "in toto" is Latin for "in total", if I remember correctly.
>
> And "Toto" can also be "Toyo Toki", one of the two large and well
> known Japanese manufacturers of porcelain things you see in
> bathrooms--oh how appropriate in this project ;-).

You made me laugh out loud! :-)

> > But in this instance, I think it is merely a typo and should have been
> > "todo" instead. That is what the "total_nr" is about: the number of
> > "done" and "todo" items, added together.
>
> If I were writing this, I would probably say "... the total number
> of items, counting both done and todo,..." and with 'counting both'
> I wouldn't have been so puzzled.

I also like it better the way you put it.

Ciao,
Dscho

>
> Thanks.
>
> >
> > Ciao,
> > Dscho
> >
> >>
> >>
> >> > This variable is mostly used by command prompts (ie. git-prompt.sh and
> >> > the like).
> >> >
> >> > Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
> >> > ---
> >> >  sequencer.c | 1 +
> >> >  1 file changed, 1 insertion(+)
> >> >
> >> > diff --git a/sequencer.c b/sequencer.c
> >> > index d648aaf416..575b852a5a 100644
> >> > --- a/sequencer.c
> >> > +++ b/sequencer.c
> >> > @@ -2070,6 +2070,7 @@ void todo_list_release(struct todo_list *todo_list)
> >> >  static struct todo_item *append_new_todo(struct todo_list *todo_list)
> >> >  {
> >> >  	ALLOC_GROW(todo_list->items, todo_list->nr + 1, todo_list->alloc);
> >> > +	todo_list->total_nr++;
> >> >  	return todo_list->items + todo_list->nr++;
> >> >  }
> >>
>
Alban Gruin Oct. 2, 2019, 6:03 p.m. UTC | #5
Hi Junio and Johannes,

Le 02/10/2019 à 10:59, Junio C Hamano a écrit :
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
>> Hi Junio,
>>
>> On Wed, 2 Oct 2019, Junio C Hamano wrote:
>>
>>> Alban Gruin <alban.gruin@gmail.com> writes:
>>>
>>>> `total_nr' is the total amount of items, done and toto, that are in a
>>>> todo list.  But unlike `nr', it was not updated when an item was
>>>> appended to the list.
>>>
>>> s/amount/number/, as amount is specifically for something
>>> that cannot be counted.
>>>

Thank you for these corrections, I really appreciate it :)

>>> Perhaps a stupid language question but what is "toto"?
>>
>> "in toto" is Latin for "in total", if I remember correctly.
> 
> And "Toto" can also be "Toyo Toki", one of the two large and well
> known Japanese manufacturers of porcelain things you see in
> bathrooms--oh how appropriate in this project ;-).
> 

In French, it’s the name of a recurring character in children’s jokes.
It’s also used sometimes as a dummy variable name like foo or bar.

>> But in this instance, I think it is merely a typo and should have been
>> "todo" instead. That is what the "total_nr" is about: the number of
>> "done" and "todo" items, added together.
> 

Correct.

> If I were writing this, I would probably say "... the total number
> of items, counting both done and todo,..." and with 'counting both'
> I wouldn't have been so puzzled.
> 

I will change this.

Cheers,
Alban



> Thanks.
> 
>>
>> Ciao,
>> Dscho
>>
>>>
>>>
>>>> This variable is mostly used by command prompts (ie. git-prompt.sh and
>>>> the like).
>>>>
>>>> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
>>>> ---
>>>>  sequencer.c | 1 +
>>>>  1 file changed, 1 insertion(+)
>>>>
>>>> diff --git a/sequencer.c b/sequencer.c
>>>> index d648aaf416..575b852a5a 100644
>>>> --- a/sequencer.c
>>>> +++ b/sequencer.c
>>>> @@ -2070,6 +2070,7 @@ void todo_list_release(struct todo_list *todo_list)
>>>>  static struct todo_item *append_new_todo(struct todo_list *todo_list)
>>>>  {
>>>>  	ALLOC_GROW(todo_list->items, todo_list->nr + 1, todo_list->alloc);
>>>> +	todo_list->total_nr++;
>>>>  	return todo_list->items + todo_list->nr++;
>>>>  }
>>>

Patch
diff mbox series

diff --git a/sequencer.c b/sequencer.c
index d648aaf416..575b852a5a 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -2070,6 +2070,7 @@  void todo_list_release(struct todo_list *todo_list)
 static struct todo_item *append_new_todo(struct todo_list *todo_list)
 {
 	ALLOC_GROW(todo_list->items, todo_list->nr + 1, todo_list->alloc);
+	todo_list->total_nr++;
 	return todo_list->items + todo_list->nr++;
 }