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

Re: [PATCH 6/6] Add a REFNAME_ALLOW_UNNORMALIZED flag to check_ref_format()

From
Junio C Hamano <gitster@pobox.com>
Date
Sep 9, 2011, 23:30 UTC
Message-ID
<7vpqj9s385.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1315568778-3592-7-git-send-email-mhagger@alum.mit.edu>
Michael Haggerty <mhagger@alum.mit.edu> writes:
Show 5 quoted lines
> Let the callers of check_ref_format() (and normalize_refname()) decide
> whether to accept unnormalized refnames via a new
> REFNAME_ALLOW_UNNORMALIZED flag.  Change callers to set this flag,
> which preserves their current behavior.  (There are likely places
> where this flag can be removed.)
Hmm, is it just me who finds --no-allow-unnormalized backwards?

More importantly, shouldn't every caller be required to normalize refnames by default, unless it can justify why it does not have to with a compelling reason?

In other words, I would be Ok if "--no-require-normalized" was the default for "git check-ref-format" for scripts' use, and I also would be perfectly fine if callers feed un-normalized strings that came from the command line argument and other end user input to normalize_refname(), but once such a string is normalized, shouldn't the rest of the callchain be passing the normalized refname all the way?

To put it another way, my knee jerk reaction is that we shouldn't need such a "flag". Shouldn't it be sufficient for normalize_refname() and nothing else to allow unnormalized input, and everybody else should barf when they see an un-normalized input?

Previous: Michael HaggertyNext: Michael Haggerty
Message 8 of 13 in “Improved infrastructure for refname normalization”
  1. 0/6 Improved infrastructure for refname normalizationMichael Haggerty, Sep 9, 2011
  2. 1/6 Change bad_ref_char() to return a boolean valueMichael Haggerty, Sep 9, 2011
  3. 2/6 git check-ref-format: add options --onelevel-ok and --refname-patternMichael Haggerty, Sep 9, 2011
  4. 3/6 Change check_ref_format() to take a flags argumentMichael Haggerty, Sep 9, 2011
  5. 4/6 Add a library function normalize_refname()Michael Haggerty, Sep 9, 2011
  6. 5/6 Do not allow ".lock" at the end of any refname componentMichael Haggerty, Sep 9, 2011
  7. 6/6 Add a REFNAME_ALLOW_UNNORMALIZED flag to check_ref_format()Michael Haggerty, Sep 9, 2011
  8. Junio C HamanoSep 9, 2011
  9. Michael HaggertySep 10, 2011
  10. A Large Angry SCMSep 9, 2011
  11. Michael HaggertySep 9, 2011
  12. Junio C HamanoSep 9, 2011
  13. Michael HaggertySep 10, 2011

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.