Hi Jonathan,

On Tue, 27 Oct 2015, Johannes Schindelin wrote:

> On Mon, 26 Oct 2015, Jonathan Nieder wrote:
> 
> > Does the 'exec' after the fi need this as well?  exec is supposed to
> > itself print a message and exit when it runs into an error.  Would
> > including an 'else' with the if make the control flow clearer?  E.g.
> > 
> >     if test -n "$TEST_GDB_GIT"
> >     then
> >             exec gdb --args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> >     else
> >             exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"
> >     fi
> 
> I suppose you're right! The `exec` can fail easily, e.g. when `gdb` was
> not found.

Actually, after reading the patch again, I think it is better to be less
intrusive and add the error message *just* for the gdb case, as it is
right now:

-- snipsnap --
 export GIT_EXEC_PATH GITPERLLIB PATH GIT_TEXTDOMAINDIR
 
+if test -n "$TEST_GDB_GIT"
+then
+       exec gdb -args "${GIT_EXEC_PATH}/@@PROG@@" "$@"
+       echo "Could not run gdb -args ${GIT_EXEC_PATH}/@@PROG@@ $*" >&2
+       exit 1
+fi
+
 exec "${GIT_EXEC_PATH}/@@PROG@@" "$@"

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to