git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [GSoC][PATCH 0/1] sequencer: print an error message if append_todo_help() fails
@ 2018-06-26 10:04 Alban Gruin
  2018-06-26 10:04 ` [GSoC][PATCH 1/1] " Alban Gruin
  0 siblings, 1 reply; 5+ messages in thread
From: Alban Gruin @ 2018-06-26 10:04 UTC (permalink / raw)
  To: git
  Cc: Stefan Beller, Christian Couder, Pratik Karki,
	Johannes Schindelin, phillip.wood, Alban Gruin

Currently, append_todo_help() does not warn the user if an error occurs
when trying to write to the todo file.  This patch addresses this
problem.

This patch is based on ag/rebase-i-append-todo-help.

Alban Gruin (1):
  sequencer: print an error message if append_todo_help() fails

 sequencer.c | 3 +++
 1 file changed, 3 insertions(+)

-- 
2.18.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [GSoC][PATCH 1/1] sequencer: print an error message if append_todo_help() fails
  2018-06-26 10:04 [GSoC][PATCH 0/1] sequencer: print an error message if append_todo_help() fails Alban Gruin
@ 2018-06-26 10:04 ` Alban Gruin
  2018-06-26 12:57   ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Alban Gruin @ 2018-06-26 10:04 UTC (permalink / raw)
  To: git
  Cc: Stefan Beller, Christian Couder, Pratik Karki,
	Johannes Schindelin, phillip.wood, Alban Gruin

This adds an error when append_todo_help() fails to write its message to
the todo file.

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

diff --git a/sequencer.c b/sequencer.c
index 7cc76332e..7c4bdbb99 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -4380,6 +4380,9 @@ int append_todo_help(unsigned edit_todo, unsigned keep_empty)
 	}
 
 	ret = fputs(buf.buf, todo);
+	if (ret)
+		error_errno(_("Could not append help text to '%s'"), rebase_path_todo());
+
 	fclose(todo);
 	strbuf_release(&buf);
 
-- 
2.18.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [GSoC][PATCH 1/1] sequencer: print an error message if append_todo_help() fails
  2018-06-26 10:04 ` [GSoC][PATCH 1/1] " Alban Gruin
@ 2018-06-26 12:57   ` Johannes Schindelin
  2018-06-26 19:53     ` Junio C Hamano
  0 siblings, 1 reply; 5+ messages in thread
From: Johannes Schindelin @ 2018-06-26 12:57 UTC (permalink / raw)
  To: Alban Gruin
  Cc: git, Stefan Beller, Christian Couder, Pratik Karki, phillip.wood

Hi Alban,

On Tue, 26 Jun 2018, Alban Gruin wrote:

> This adds an error when append_todo_help() fails to write its message to
> the todo file.
> 
> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>

ACK.

We *may* want to fold that into the commit that adds `append_todo_help()`.
And, as I mentioned previously, I would love for that function to be used
as an excuse to introduce the long-overdue `interactive-rebase.c`
(`sequencer.c` is supposed to be the backend for cherry-pick and revert
and interactive rebase, but not a catch-all for *all* of those things, it
is already way too long to be readable, and I take blame for a large part
of that.)

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GSoC][PATCH 1/1] sequencer: print an error message if append_todo_help() fails
  2018-06-26 12:57   ` Johannes Schindelin
@ 2018-06-26 19:53     ` Junio C Hamano
  2018-06-26 21:52       ` Johannes Schindelin
  0 siblings, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2018-06-26 19:53 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Alban Gruin, git, Stefan Beller, Christian Couder, Pratik Karki,
	phillip.wood

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:

> Hi Alban,
>
> On Tue, 26 Jun 2018, Alban Gruin wrote:
>
>> This adds an error when append_todo_help() fails to write its message to
>> the todo file.
>> 
>> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
>
> ACK.
>
> We *may* want to fold that into the commit that adds `append_todo_help()`.

Absolutely.  This looks more like an "oops, I made a mess and here
is a fix on top", and even worse, it does not make an effort to help
readers where the mess was made (iow, which commit it goes on to
of); it is better to be squashed in.

I do not know offhand who Alban's mentors are, but one thing I think
is a good thing for them to teach is how to better organize the
changes with readers in mind.  The author of a patch series knows
his or her patches and how they relate to each other a lot better
than the readers of patches, who are reading not just his or her
patches but the ones from a lot wider set of contributors.  Even
though append-todo-help and edit-todo may have been developed as
separate steps in author's mind, it is criminal to send them as if
they are completely separate topics that can independently applied,
especially when one depends on the other.  It is a lot more helpful
to the readers if they were sent as a larger single series, because
doing so _will_ tell the readers which order the dependency goes.

> And, as I mentioned previously, I would love for that function to be used
> as an excuse to introduce the long-overdue `interactive-rebase.c`

I am not sure if I like this direction.  

As newbies are often very bad at coming up with APIs and naming
global functions, keeping everything as "static" inside a single
sequencer.c tends to avoid contaminating the global namespace.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [GSoC][PATCH 1/1] sequencer: print an error message if append_todo_help() fails
  2018-06-26 19:53     ` Junio C Hamano
@ 2018-06-26 21:52       ` Johannes Schindelin
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Schindelin @ 2018-06-26 21:52 UTC (permalink / raw)
  To: Junio C Hamano
  Cc: Alban Gruin, git, Stefan Beller, Christian Couder, Pratik Karki,
	phillip.wood

Hi Junio,

On Tue, 26 Jun 2018, Junio C Hamano wrote:

> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > On Tue, 26 Jun 2018, Alban Gruin wrote:
> >
> >> This adds an error when append_todo_help() fails to write its message to
> >> the todo file.
> >> 
> >> Signed-off-by: Alban Gruin <alban.gruin@gmail.com>
> >
> > ACK.
> >
> > We *may* want to fold that into the commit that adds `append_todo_help()`.
> 
> Absolutely.  This looks more like an "oops, I made a mess and here
> is a fix on top", and even worse, it does not make an effort to help
> readers where the mess was made (iow, which commit it goes on to
> of); it is better to be squashed in.
> 
> I do not know offhand who Alban's mentors are, but one thing I think
> is a good thing for them to teach is how to better organize the
> changes with readers in mind.  The author of a patch series knows
> his or her patches and how they relate to each other a lot better
> than the readers of patches, who are reading not just his or her
> patches but the ones from a lot wider set of contributors.  Even
> though append-todo-help and edit-todo may have been developed as
> separate steps in author's mind, it is criminal to send them as if
> they are completely separate topics that can independently applied,
> especially when one depends on the other.  It is a lot more helpful
> to the readers if they were sent as a larger single series, because
> doing so _will_ tell the readers which order the dependency goes.

Chris & Stefan are Alban's mentors, and I spend quite a bit of my time on
IRC, ready to help Alban when he has questions. Chris & Stephan mainly act
as first-line reviewers.

> > And, as I mentioned previously, I would love for that function to be
> > used as an excuse to introduce the long-overdue `interactive-rebase.c`
> 
> I am not sure if I like this direction.

Blame me, not Alban. I am pretty familiar with sequencer.c, and I know
that it is way too large.

> As newbies are often very bad at coming up with APIs and naming global
> functions, keeping everything as "static" inside a single sequencer.c
> tends to avoid contaminating the global namespace.

Then I just need to make sure to suggest good names that are safe for the
global namespace, don't I?

Seeing as sequencer.c is so long already, it is own little mega namespace
anyway, so we already have to be very careful *within* sequencer.c.

Ciao,
Dscho

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-26 21:52 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26 10:04 [GSoC][PATCH 0/1] sequencer: print an error message if append_todo_help() fails Alban Gruin
2018-06-26 10:04 ` [GSoC][PATCH 1/1] " Alban Gruin
2018-06-26 12:57   ` Johannes Schindelin
2018-06-26 19:53     ` Junio C Hamano
2018-06-26 21:52       ` Johannes Schindelin

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).