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

Re: [PATCH v2 1/4] notes: preserve object type given by "add -C"

From
Nguyen Thai Ngoc Duy <pclouds@gmail.com>
Date
May 12, 2012, 05:20 UTC
Message-ID
<CACsJy8Avusvu9LJeg1L=OZ9=qW+FaqbNWfA_rrZJUY_3WqfhOg@mail.gmail.com>
In-Reply-To
<7vzk9eju4m.fsf@alter.siamese.dyndns.org>
On Sat, May 12, 2012 at 4:16 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 7 quoted lines
> Nguyễn Thái Ngọc Duy  <pclouds@gmail.com> writes:
>
>> _Automatically_ converting a non-blob object to a blob is
>> wrong. Either this way, or reject non-blob objects upfront.
>
> But wouldn't it be even _more_ wrong to stuff a non-blob object at the
> leaf level of the notes tree?

If people deliberately want to do that and notes subsystem knows not to mess with non-blob objects, I think it's ok. Though if users want to add some text, but put non-blob by mistake, then it's wrong to accept it.

Show 7 quoted lines
> It is not automatically "converting"; as far as the notes subsystem is
> concerned, the data you throw at it to be associated with an object the
> note annotates has always been uninterpreted stream of bytes.  If an
> application wants to store the raw representation of a commit object
> including the log message and its header, it has every right to expect
> that it can use "git cat-file commit $argument_to_the_C_option" as the
> source of that uninterpreted stream of bytes, doesn't it?

Some part of git-notes expects this stream of bytes to be textual, human readable. In that case, "git notes add -C commit/tag"'s stuffing a blob with the given commit/tag content to notes tree may make sense. Personally I'd rather stuff the commit/tag object instead so no new blobs are created. The end result is the same: read_sha1_file() always return correct text, so does "git notes show".

The difference after this series is "notes add -C commit; notes append -m foo" now results in an error message while it case goes smoothly without the series. Perhaps we can be more flexible here on appending and allow to append non-tree objects to non-tree objects, resulting in a blob note.

-- 
Duy
Previous: Junio C HamanoNext: Junio C Hamano
Message 24 of 29 in “notes: do not accept non-blobs as new notes”
  1. notes: do not accept non-blobs as new notesNguyễn Thái Ngọc Duy, May 8, 2012
  2. Jeff KingMay 8, 2012
  3. Junio C HamanoMay 8, 2012
  4. Nguyen Thai Ngoc DuyMay 9, 2012
  5. Jeff KingMay 9, 2012
  6. Junio C HamanoMay 9, 2012
  7. Jeff KingMay 9, 2012
  8. 0/4 git-notes ui fixes regarding non-blobs notesNguyễn Thái Ngọc Duy, May 10, 2012
  9. 1/4 notes: preserve object type given by "add -C"Nguyễn Thái Ngọc Duy, May 10, 2012
  10. 2/4 notes: "add -c" refuses to open an editor with non-blobsNguyễn Thái Ngọc Duy, May 10, 2012
  11. Johannes SixtMay 10, 2012
  12. Nguyen Thai Ngoc DuyMay 11, 2012
  13. 3/4 notes: refuse to edit non-blobsNguyễn Thái Ngọc Duy, May 10, 2012
  14. 4/4 notes: refuse to append to non-blob notesNguyễn Thái Ngọc Duy, May 10, 2012
  15. 4/4 notes: only append a blob to a blobNguyễn Thái Ngọc Duy, May 10, 2012
  16. Jeff KingMay 10, 2012
  17. Nguyen Thai Ngoc DuyMay 10, 2012
  18. Jeff KingMay 10, 2012
  19. Junio C HamanoMay 11, 2012
  20. Jeff KingMay 10, 2012
  21. 0/4 non-blob notes fixesNguyễn Thái Ngọc Duy, May 11, 2012
  22. 1/4 notes: preserve object type given by "add -C"Nguyễn Thái Ngọc Duy, May 11, 2012
  23. Junio C HamanoMay 11, 2012
  24. Nguyen Thai Ngoc DuyMay 12, 2012
  25. Junio C HamanoMay 12, 2012
  26. Nguyen Thai Ngoc DuyMay 12, 2012
  27. 2/4 notes: "add -c" refuses to open an editor with non-blobsNguyễn Thái Ngọc Duy, May 11, 2012
  28. 3/4 notes: refuse to edit non-blobsNguyễn Thái Ngọc Duy, May 11, 2012
  29. 4/4 notes: only allow to append a blob to a blobNguyễn Thái Ngọc Duy, May 11, 2012

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.