From: Junio C Hamano <gitster@pobox.com>
To: bdowning@lavos.net (Brian Downing)
Cc: git@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
msysgit@googlegroups.com
Subject: Re: Git no longer reads attributes from the index properly
Date: Fri, 20 Mar 2009 03:16:45 -0700 [thread overview]
Message-ID: <7v4oxojy7m.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <20090320084031.GD1037@lavos.net> (Brian Downing's message of "Fri, 20 Mar 2009 03:40:31 -0500")
bdowning@lavos.net (Brian Downing) writes:
> However, that commit looks like it's solving a different problem
> entirely (supporting changing between two branches where .gitattributes
> exists in both cases) and happens to fix the no .gitattributes -> read
> from index regression at the same time. I don't know enough about the
> guts to tell, but does this also fix the core problem of the regression
> (I assume something about trying to read from the wrong index, given the
> commit that broke it), or does it just happen to work around it?
Actually the commit solves both.
Notice that the second hunk of the patch to unpack-trees passes o->result
to the new git_attr_set_direction() function to tell it to read from the
new index, instead of reading from the wrong one. In addition, by setting
the direction to CHECKOUT, it favors to read the attribute data from the
index over from the work tree.
Note that this is merely a "good enough" approximation and arguing that we
should only read from the in-index attributes during checkout (and read
only from work tree attributes during checkin) is futile. Look at other
thread with Kristian Amlie for details.
diff --git a/unpack-trees.c b/unpack-trees.c
index e547282..661218c 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -105,6 +106,7 @@ static int check_updates(struct unpack_trees_options *o)
cnt = 0;
}
+ git_attr_set_direction(GIT_ATTR_CHECKOUT, &o->result);
for (i = 0; i < index->cache_nr; i++) {
struct cache_entry *ce = index->cache[i];
prev parent reply other threads:[~2009-03-20 10:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-20 7:35 Git no longer reads attributes from the index properly Brian Downing
2009-03-20 8:27 ` Junio C Hamano
2009-03-20 8:40 ` Brian Downing
2009-03-20 9:45 ` Michael J Gruber
2009-03-20 10:16 ` Junio C Hamano [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7v4oxojy7m.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=bdowning@lavos.net \
--cc=git@vger.kernel.org \
--cc=msysgit@googlegroups.com \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).