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

Re: [PATCH] git-p4: Handle p4 submit failure

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 30, 2015, 16:44 UTC
Message-ID
<xmqqeggcmhle.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<CAJA=mv4Tr_DoBMwR8hK_fEJ1PFCYTu17HHvEnFWMANGFcf0Wpg@mail.gmail.com>
Etienne Girard <etienne.g.girard@gmail.com> writes:
Show 5 quoted lines
> Clean the workspace if p4_write_pipe raised SystemExit,
> so that the user don't have to do it themselves.
>
> Signed-off-by: GIRARD Etienne <egirard@murex.com>
> ---

Thanks. As I do not really do "p4", I am CC'ing this response to the area experts.

First, one "procedural" comment.

You sent the patch from your gmail.com address, but signed it off with another address (with name spelled differently). If applied as-is, the result will have your gmail.com address listed as the author and that will be the name you would see in "git shortlog".

If you rather prefer to be known as the name and address you placed on your sign-off, while sending the patch from another address, you can do so by staring the _body_ of the message with what is called an "in-body header", like this:

        From: GIRARD Etienne <egirard@murex.com>
        Clean the workspace if p4_write_pipe raised SystemExit,
        so that the user don't have to do it themselves.
        Signed-off-by: GIRARD Etienne <egirard@murex.com>
        ---
	  ... here you have the usual patch ...

That "From:" line would sit on the first line of the body of your message, separated by a blank line from the body of the log message.

This is not even a problem from the project's point of view, but I thought you would want to be aware of it, and may want a chance to change it.

	Note: this time, you do not need to resend the patch; just
	please let me know if you want me to do the equivalent of
	the above while applying to make your murex address and name
	appear as the author in "git log" and "git shortlog" output.

FYI, you could override the "Subject:" of your e-mail header with an in-body header (this is often useful when replying to an existing discussion thread with a patch that shows a solution), e.g.

        From: GIRARD Etienne <egirard@murex.com>
	Subject: git-p4: clean up after p4 submit failure
        Clean the workspace if p4_write_pipe raised SystemExit,
        so that the user don't have to do it themselves.
        Signed-off-by: GIRARD Etienne <egirard@murex.com>
        ---
	  ... here you have the usual patch ...
Show 7 quoted lines
>  git-p4.py | 71 +++++++++++++++++++++++++++++++++------------------------------
>  1 file changed, 37 insertions(+), 34 deletions(-)
>
> The p4 submit command may fail, for example if the changelist contains
> a job that does not exist in the Jobs section. If this is the case,
> p4_write_pipe will exit the script. This change makes it so that the
> workspace is reverted before letting the script die.

Some of the information contained in this paragraph deserves to be in the log message proper. How about

        From: GIRARD Etienne <egirard@murex.com>
	Subject: git-p4: clean up after p4 submit failure
	When "p4 submit" command fails in P4Submit.applyCommit, the
	workspace is left with the changes.  We already have a code
        to revert the changes to the workspace when the user decides
	to cancel submission by aborting the editor that edits the
	change description, and we should treat the "p4 submit"
	failure the same way.
        Clean the workspace if p4_write_pipe raised SystemExit,
        so that the user don't have to do it themselves.
        Signed-off-by: GIRARD Etienne <egirard@murex.com>
or something like that?

While trying to come up with the above description, I started wondering if the error message wants to differentiate the two cases.

When self.edit_template() returns false, we know that the user actively said "no I do not want to submit", and "Submission cancelled" is perfectly fine, but when "p4 submit" fails because it did not like the change description or if it found some other issues, it is not necessarily that the user said "I want to cancel"; it is more like "Submission failed".

Hmm?
Previous: Etienne GirardNext: Etienne Girard
Message 2 of 6 in “git-p4: Handle p4 submit failure”
  1. git-p4: Handle p4 submit failureEtienne Girard, Oct 28, 2015
  2. Junio C HamanoOct 30, 2015
  3. Etienne GirardOct 30, 2015
  4. Junio C HamanoOct 30, 2015
  5. Luke DiamandOct 30, 2015
  6. Junio C HamanoOct 30, 2015

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.