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

Re: [PATCH 1/2] diff: use HEAD for attributes when using bare repository

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 14, 2023, 16:54 UTC
Message-ID
<xmqqttynqnnj.fsf@gitster.g>
In-Reply-To
<0fc704cf1c0724473a61086098d44c3a82938b03.1678758818.git.gitgitgadget@gmail.com>
"John Cai via GitGitGadget" <gitgitgadget@gmail.com> writes:
> From: John Cai <johncai86@gmail.com>
>
> (a4cf900e diff: teach diff to read algorithm from diff driver,
> 2022-02-20) does not support bare repositories.

Wrong placement of opening parenthesis, i.e. "a4cf900e (diff: teach diff to read algorithm from diff driver, 2023-02-20)". The date is also wrong. Use "git show -s --format=reference a4cf900e". Insert its output directly to your editor instead of transcribing manually.

I do not think the commit is to blame in the first place for two reasons.

 * Even in a bare repository, the attributes defined in the
   $GIT_DIR/info/attributes file are in effect, and the new feature
   added by a4cf900e should work just fine with it.
 * By definition, there is no working tree in a bare repository, and
   it always has been naturally expected we won't read attributes
   from working tree files.  This is in no way limited to the diff
   driver feature recently added.

So the above does not look like a good first sentence to explain this change.

> Since running diff
> on bare repositories is often done on Git servers, it would be useful to
> allow bare repositories to also take advantage of setting the algorithm
> via the diff driver.

Since referring to in-tree attributes is often useful with any command, not limited to "diff", I wonder if it is feasible to add support for the --attr-source=<tree> option globally, instead of implementing such an option piecemeal. If your "git diff" in a bare repository starts honoring attributes recorded in HEAD, don't your users expect your "git log" and "git show" to also honor them?

Previous: John Cai via GitGitGadgetNext: Junio C Hamano
Message 4 of 15 in “diff: support bare repositories when reading gitattributes for diff algorithm”
  1. 0/2 diff: support bare repositories when reading gitattributes for diff algorithmJohn Cai via GitGitGadget, Mar 14, 2023
  2. 2/2 diff: add --attr-source to read gitattributes from a commitJohn Cai via GitGitGadget, Mar 14, 2023
  3. 1/2 diff: use HEAD for attributes when using bare repositoryJohn Cai via GitGitGadget, Mar 14, 2023
  4. Junio C HamanoMar 14, 2023
  5. Junio C HamanoMar 14, 2023
  6. John CaiMar 14, 2023
  7. Junio C HamanoMar 14, 2023
  8. John CaiMar 16, 2023
  9. Junio C HamanoMar 16, 2023
  10. John CaiMar 17, 2023
  11. Philippe BlainMar 14, 2023
  12. John CaiMar 14, 2023
  13. Junio C HamanoMar 14, 2023
  14. Jeff KingMar 16, 2023
  15. Junio C HamanoMar 16, 2023

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.