git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kristian Amlie <kristian.amlie@nokia.com>
To: ext Junio C Hamano <gitster@pobox.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Re: [PATCH 2/2] Make Git respect changes to .gitattributes during checkout.
Date: Thu, 19 Mar 2009 16:42:27 +0100	[thread overview]
Message-ID: <49C267E3.1020205@nokia.com> (raw)
In-Reply-To: <7vprgkg2kx.fsf@gitster.siamese.dyndns.org>

ext Junio C Hamano wrote:
> In a well structured git program, we always read from the work tree and
> the index (to see if there is something changed---you need to be able to
> apply convert_to_git when you do this), internally compute what should
> happen (e.g. decide that the new result needs to be checked out for a
> path), and then write it out (you apply convert_to_working_tree while you
> do this).  So how about doing something like the attached patch?
> 
> The patch allows the caller to tell the usual "read from the working tree,
> if not use the version from the index as the fallback" logic to be swapped
> around, and take the index version.  It may or may not pass your new tests
> (I haven't even compile tested it), but I think the damage is minimized
> compared to your version.

You're right, that's a much cleaner approach. The patch is really good
as far as I can see. It fixes both my test cases (including the one I
wasn't able to fix), and there are no additional failures when running
the autotests. Do you have second thoughts about it, or is it good
enough to apply?

If it is, I'll move the test case into t0021-conversion.sh like you said
and give you a new patch for that.

> It is great that you are trying to fix this issue for the most obvious
> "switching between two branches while not having a local change" case, but
> frankly, I do not think this is solvable in more general cases, and that
> is why it was kept "known to be broken, not worth fixing" state.
> 
> For example, you may notice that, after making a clean checkout, one path
> has a wrong attribute assigned to it, and may try to correct it.  But how?
> 
>  $ edit .gitattributes ;# mark foo.dat as binary
>  $ rm foo.dat
>  $ git checkout foo.dat ;# make sure the new settings is correct???

As far as I can see, this works without any modifications to the patch.
Is that maybe because git_attr_set_direction() is not called if you use
that form of checkout?

--
Kristian

  reply	other threads:[~2009-03-19 15:44 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-28 15:25 Honoring a checked out gitattributes file Kristian Amlie
2009-01-28 16:44 ` Michael J Gruber
2009-01-28 17:25   ` Kristian Amlie
2009-01-30 13:00     ` Kristian Amlie
2009-01-30 13:00       ` [PATCH] Add a test for checking whether gitattributes is honored by checkout Kristian Amlie
2009-03-12  9:36       ` Honoring a checked out gitattributes file Kristian Amlie
2009-03-12  9:36         ` [PATCH 1/2] Add a test for checking whether gitattributes is honored by checkout Kristian Amlie
2009-03-12  9:36           ` [PATCH 2/2] Make Git respect changes to .gitattributes during checkout Kristian Amlie
2009-03-12  9:59             ` Johannes Sixt
2009-03-12 10:23               ` Kristian Amlie
2009-03-13 13:24               ` Honoring a checked out gitattributes file Kristian Amlie
2009-03-13 13:24                 ` [PATCH 1/2] Add a test for checking whether gitattributes is honored by checkout Kristian Amlie
2009-03-13 13:24                   ` [PATCH 2/2] Make Git respect changes to .gitattributes during checkout Kristian Amlie
2009-03-14  4:17                     ` Junio C Hamano
2009-03-19 15:42                       ` Kristian Amlie [this message]
2009-03-19 21:06                         ` Junio C Hamano
2009-03-20  8:11                           ` Kristian Amlie
2009-03-20  9:32                             ` [PATCH] Add a test for checking whether gitattributes is honored by checkout Kristian Amlie
2009-03-14  4:36                   ` [PATCH 1/2] " Junio C Hamano
2009-03-12  9:47           ` Matthieu Moy
2009-03-12  9:53             ` Kristian Amlie
2009-01-28 17:55 ` Honoring a checked out gitattributes file Jeff King

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=49C267E3.1020205@nokia.com \
    --to=kristian.amlie@nokia.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).