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

Re: [Qgit RFC] commit --amend

From
MCMarco Costalba <mcostalba@gmail.com>
Date
Jul 1, 2007, 16:09 UTC
Message-ID
<e5bfff550707010909p4eba184ekff2025fb158a4aee@mail.gmail.com>
In-Reply-To
<20070701122625.GC26243@efreet.light.src>
On 7/1/07, Jan Hudec <bulb@ucw.cz> wrote:
Show 9 quoted lines
> On Mon, Jun 11, 2007 at 07:45:51 +0200, Marco Costalba wrote:
> > On 6/11/07, Jan Hudec <bulb@ucw.cz> wrote:
> > >
>
> However, I am currently not sure how to handle errors. If the current commit
> fails, it will show a message box with it's output, but I can't see where it
> is generated. It seems it's somewhere inside MyProcess, so I don't have to do
> anything special though, right?
>
You have 2 ways to start a git command:
QGit::run() and QGit::runAsync()

The first starts the command and wait for completion, a bool is returned to indicate success as example

if (!run("git read-tree --reset HEAD"))
	return false;

The second one is use to start a command and return immediately, so it's used for long commands that should be non-blocking, as example:

if (!runAsync("git diff-index -r -m --patch-with-stat HEAD"))
    return false;
In the latter case success it means the command has been _started_ successfully.

A bool is the only flag returned, because error detect is done at lower level, in MyProcess::sendErrorMsg() in file myprocess.cpp that handles the low level of running an external process and is called by run().

In case of an error MyProcess::sendErrorMsg() is called to inform the GUI (a popup dialog box) about the error and the stderr output received.

What is an error ? :-)

It's not so trivial due to different OS and git commands behaviours regarding stderr and exiting codes, check the comment at the beginning of MyProcess::on_finished() in myprocess.cpp to see *how* qgit detects an error has occurred and informs upstream.

So the bottom line is: no, you don't have to do anything special. The returned 'false' value from run() call is for your use only, if needed, you don't have to propagate upstream to let user be informed.

Hope this helps.
Marco
P.S: Why 'git-commit --amend -F' it's explicitely forbidden?
Previous: Jan HudecNext: Jan Hudec
Message 7 of 17 in “[Qgit RFC] commit --amend”
  1. Jan HudecJun 10, 2007
  2. Marco CostalbaJun 10, 2007
  3. Jan HudecJun 11, 2007
  4. Marco CostalbaJun 11, 2007
  5. Marco CostalbaJun 11, 2007
  6. Jan HudecJul 1, 2007
  7. Marco CostalbaJul 1, 2007
  8. Jan HudecJul 2, 2007
  9. Junio C HamanoJul 4, 2007
  10. Marco CostalbaJul 4, 2007
  11. Jan HudecJul 4, 2007
  12. Junio C HamanoJul 4, 2007
  13. Marco CostalbaJul 6, 2007
  14. Jan HudecJul 5, 2007
  15. Marco CostalbaJul 6, 2007
  16. Jan HudecJul 8, 2007
  17. Marco CostalbaJul 8, 2007

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.