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

[PATCH v3 0/3] rev-parse: strengthen validation of ref@{n} references

From
Jon Seymour <jon.seymour@gmail.com>
Date
Aug 24, 2010, 04:52 UTC
Message-ID
<1282625564-12752-1-git-send-email-jon.seymour@gmail.com>
In-Reply-To
<20100824001454.GB17406@burratino>
This series changes git rev-parse so that references of the form:
       ref@{n}

cause rev-parse to fail with a non-zero status code if n >= size of the reference log for ref.

The first commit implements the changed behaviour; the second commit replaces uses of fprintf (within sha1_name.c) with warning; the third commit updates the tests to include tests for the changed behaviour.

This is the third revision of this series. It differs from the first in that it uses die rather than error to report the condition and thus exits early, without generating any output on stdout for the failing argument. It also reports just a single fatal message instead of both an error message and a fatal message.

The original patch and this revision are both based on suggestions from Junio. Corrections to diagnostic output inspired by Jonathan Nieder's review.

Jon Seymour (3):
  rev-parse: exit with non-zero status if ref@{n} is not valid.
  sha1_name.c: use warning in preference to fprintf(stderr
  rev-parse: tests git rev-parse --verify master@{n}, for various n
 sha1_name.c                    |   20 +++++++++++---------
 t/t1503-rev-parse-verify.sh    |   11 +++++++++++
 t/t1506-rev-parse-diagnosis.sh |    9 +++++++++
 3 files changed, 31 insertions(+), 9 deletions(-)
-- 
1.7.2.1.100.gceecd
Previous: Jonathan NiederNext: Jon Seymour
Message 14 of 20 in “RFD: should git rev-parse exit with non-zero status if ref@{n} is not valid?”
  1. Jon SeymourAug 18, 2010
  2. Jon SeymourAug 18, 2010
  3. Junio C HamanoAug 18, 2010
  4. Jon SeymourAug 18, 2010
  5. 0/4 rev-parse: improve reporting of invalid log referencesJon Seymour, Aug 21, 2010
  6. 1/4 rev-parse: exit with non-zero status if ref@{n} is not valid.Jon Seymour, Aug 21, 2010
  7. 2/4 rev-parse: suppress duplicate log limit exceeded message.Jon Seymour, Aug 21, 2010
  8. Junio C HamanoAug 22, 2010
  9. Jon SeymourAug 23, 2010
  10. Junio C HamanoAug 23, 2010
  11. 0/2 rev-parse: strengthen validation of ref@{n} referencesJon Seymour, Aug 23, 2010
  12. 1/2 rev-parse: exit with non-zero status if ref@{n} is not valid.Jon Seymour, Aug 23, 2010
  13. Jonathan NiederAug 24, 2010
  14. 0/3 rev-parse: strengthen validation of ref@{n} referencesJon Seymour, Aug 24, 2010
  15. 1/3 rev-parse: exit with non-zero status if ref@{n} is not valid.Jon Seymour, Aug 24, 2010
  16. 2/3 sha1_name.c: use warning in preference to fprintf(stderrJon Seymour, Aug 24, 2010
  17. 3/3 rev-parse: tests git rev-parse --verify master@{n}, for various nJon Seymour, Aug 24, 2010
  18. 2/2 rev-parse: tests git rev-parse --verify master@{n}, for various nJon Seymour, Aug 23, 2010
  19. 3/4 rev-parse: introduce get_sha1_gentlyJon Seymour, Aug 21, 2010
  20. 4/4 rev-parse: tests that git rev-parse --verify master@{n}Jon Seymour, Aug 21, 2010

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.