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

Re: [PATCH] Allow git-diff exit with codes similar to diff(1)

From
Alex Riesen <raa.lkml@gmail.com>
Date
Mar 14, 2007, 08:37 UTC
Message-ID
<81b0412b0703140137i6d0df44aua9205e81249570ea@mail.gmail.com>
In-Reply-To
<Pine.LNX.4.63.0703140237270.22628@wbgn013.biozentrum.uni-wuerzburg.de>
On 3/14/07, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
Show 21 quoted lines
> > > So, big master to hom everybody bows, how to return the correct value
> > > when executing a pager? Because this _has_ to be done if we go that
> > > way.
> >
> > Why? If you execute the pager, nobody cares about the error value
> > anyway.
> >
> > I don't see why you would mix in a pager here. If you do
> >
> >       diff -u file1 file2 | less -S
> >
> > the return value of the pipe will not only generally be totally
> > uninteresting and never used, but it will be the return value of "less"
> > anyway. Which is what we'd get quite naturally.
>
> The thing is, most people do not realize that
>
>         git diff file1 file2
>
> _will_ execute a pager. As foreground process. And the return value is
> that of the pager.

In this example this is obviously (sometimes it is obscurely) interactive. The return code is seldom expected.

More sneaky case could be this:
  git diff file1 file2 > tmp && do_something
  rm -f tmp
But we have isatty in setup_pager, so this works properly.
Previous: Johannes SchindelinNext: Johannes Schindelin
Message 9 of 32 in “Allow git-diff exit with codes similar to diff(1)”
  1. Allow git-diff exit with codes similar to diff(1)Alex Riesen, Mar 14, 2007
  2. Johannes SchindelinMar 14, 2007
  3. Linus TorvaldsMar 14, 2007
  4. Junio C HamanoMar 14, 2007
  5. Linus TorvaldsMar 14, 2007
  6. Johannes SchindelinMar 14, 2007
  7. Linus TorvaldsMar 14, 2007
  8. Johannes SchindelinMar 14, 2007
  9. Alex RiesenMar 14, 2007
  10. Johannes SchindelinMar 14, 2007
  11. Alex RiesenMar 14, 2007
  12. Johannes SchindelinMar 14, 2007
  13. Simon 'corecode' SchubertMar 15, 2007
  14. Alex RiesenMar 15, 2007
  15. Junio C HamanoMar 14, 2007
  16. Alex RiesenMar 14, 2007
  17. Junio C HamanoMar 14, 2007
  18. Junio C HamanoMar 14, 2007
  19. Alex RiesenMar 14, 2007
  20. Junio C HamanoMar 14, 2007
  21. Alex RiesenMar 14, 2007
  22. Junio C HamanoMar 14, 2007
  23. Alex RiesenMar 14, 2007
  24. Junio C HamanoMar 14, 2007
  25. Allow git-diff exit with codes similar to diff(1)Alex Riesen, Mar 14, 2007
  26. Junio C HamanoMar 14, 2007
  27. Alex RiesenMar 14, 2007
  28. Junio C HamanoMar 14, 2007
  29. Allow git-diff exit with codes similar to diff(1)Alex Riesen, Mar 14, 2007
  30. Junio C HamanoMar 14, 2007
  31. Junio C HamanoMar 14, 2007
  32. Alex RiesenMar 14, 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.