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

Re: [PATCH 2/2] diff_index: honor in-index, not working-tree, .gitattributes

From
Jay Soffian <jaysoffian@gmail.com>
Date
Sep 23, 2011, 00:38 UTC
Message-ID
<CAG+J_DzUQ3OGfiX=vHVGC7SHvwToVjD7uwFyDa8Tq6t7YwX12Q@mail.gmail.com>
In-Reply-To
<7v8vpgxkvb.fsf@alter.siamese.dyndns.org>
On Thu, Sep 22, 2011 at 6:39 PM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> Jay Soffian <jaysoffian@gmail.com> writes:
>
>> When diff'ing the index against a tree (using either diff-index
>> or diff --cached), git previously looked at .gitattributes in the
>> working tree before considering .gitattributes in the index, even
>> though the diff itself otherwise ignores the working tree.
>
> We can take attributes only from one place (so far from the working tree
> and perhaps from the index), people had to live within the limitation that
> comes from the "single source only" semantics. It also happens to be
> easier to understand (recall the complexity of the examples Jeff gave
> about "textconv" during "diff" which ideally should apply from its own
> side and "funcname", which does not even have a right answer).
>
> In practice, because development progresses by making everything
> (including the .gitattributes file) better, I think "use the newer one"
> would be a good compromise when we have two possible sources to grab
> attributes from but we can only use one source.
I agree with that...
> In that sense, I am somewhat skeptical about what this patch tries to
> do. The working tree is where people make the progress to update the
> index.

... but it still seems inconsistent that --cached ignores the working tree except for .gitattributes.

This also happens to be the only way to get diff-index to work with a bare repo and temporary (on-disk) index. But that's less important if we implement what's suggested in the next paragraph.

Show 10 quoted lines
> A related tangent.
>
> I think the logical conclusion of assuming that we will keep the "single
> source only" semantics (which I think we will, by the way, unless I hear a
> concrete proposal to how we apply attributes from more than one sources in
> what way to which side of the diff) is that a patch might be an
> improvement over the current behaviour if it teaches "diff-tree" to read
> from the tree and populate the in-core index (never writing it out to
> $GIT_DIR/index) from the postimage tree (i.e. "diff preimage postimage" or
> "diff -R postimage preimage") when it is run in a bare repository.
Okay, I can give that a try.
> It
> would be a regression if the attributes mechanism is used for auditing
> purposes (as we start reading from a tree that is being audited using the
> very attributes it brings in), though.
--[no-]tree-attributes?
j.
Previous: Junio C HamanoNext: Jay Soffian
Message 4 of 11 in “Teach '--cached' option to check-attr”
  1. 1/2 Teach '--cached' option to check-attrJay Soffian, Sep 22, 2011
  2. 2/2 diff_index: honor in-index, not working-tree, .gitattributesJay Soffian, Sep 22, 2011
  3. Junio C HamanoSep 22, 2011
  4. Jay SoffianSep 23, 2011
  5. Jay SoffianSep 23, 2011
  6. Junio C HamanoSep 23, 2011
  7. Jay SoffianSep 23, 2011
  8. Junio C HamanoSep 23, 2011
  9. Michael HaggertySep 23, 2011
  10. Jay SoffianSep 23, 2011
  11. Junio C HamanoSep 22, 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.