git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jan Hudec <bulb@ucw.cz>
To: Junio C Hamano <gitster@pobox.com>
Cc: Dmitry Kakurin <dmitry.kakurin@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Petr Baudis <pasky@suse.cz>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: .gitignore, .gitattributes, .gitmodules, .gitprecious?,.gitacls? etc.
Date: Wed, 5 Sep 2007 20:38:31 +0200	[thread overview]
Message-ID: <20070905183831.GA29370@efreet.light.src> (raw)
In-Reply-To: <7vk5r5jzpn.fsf@gitster.siamese.dyndns.org>

[-- Attachment #1: Type: text/plain, Size: 1982 bytes --]

On Wed, Sep 05, 2007 at 01:14:44 -0700, Junio C Hamano wrote:
> "Dmitry Kakurin" <dmitry.kakurin@gmail.com> writes:
> 
> > I assert that since index does not have .gitattributes the one from
> > local directory should not be used.
> >
> > Think about dedicated build machine scenario: I have a machine that
> > always does sync + build. After every sync the local directory should
> > always be identical to what-was-committed.
> 
> Thinking about the reason _why_ .gitattributes may be updated,
> one would notice that it is because somebody did this command
> sequence:
> 
> 	git checkout		;# now work tree is clean
> 	edit .gitattributes	;# modify the attributes of a file
> 	edit file		;# edit the file attributes talks about
> 	git add file		;# this can be affected by .gitattributes
> 	git add .gitattributes	;# this is changed in the same commit
> 	git commit
> 
> Now, should we always take .gitattributes from the index?

Yes, they should:

$ git checkout
$ edit .gitattributes
$ edit file
$ git add file
$ git commit ;# this does NOT have the changes to .gitattributes

the above case is a user error that can (at some cost) be detected:

$ git checkout
$ edit .gitattributes
$ edit file
$ git add file
$ git add .gitattributes
Warning! Changes to gitattributes affects handling of files scheduled for
commit. Please add following files again before commit:
  file
$

It would be possible to special-case .gitattributes in add to:
 - do diff between the old and new value of .gitattributes in index,
 - list files changed in index compared to HEAD,
 - match each of them to all patterns in the diff,
 - if any matches, print the warning and list of matches.
It might be even possible to actually inspect the changes and apply those
that can be automatically (and not ask user to re-add), but some filters
loose information, so user interaction is needed to add good version.

-- 
						 Jan 'Bulb' Hudec <bulb@ucw.cz>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  parent reply	other threads:[~2007-09-05 18:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-26  2:59 .gitignore, .gitattributes, .gitmodules, .gitprecious?, .gitacls? etc Dmitry Kakurin
2007-08-26  4:37 ` Junio C Hamano
2007-08-26  5:17   ` Dmitry Kakurin
2007-08-26  5:33     ` Junio C Hamano
2007-08-26  6:36       ` Dmitry Kakurin
2007-08-26  7:28         ` Junio C Hamano
2007-08-26  8:02           ` Dmitry Kakurin
2007-08-26 10:06             ` Petr Baudis
     [not found]               ` <4C603F7C51884DF8AFAEC3F6E263798D@ntdev.corp.microsoft.com>
2007-08-27 20:27                 ` .gitignore, .gitattributes, .gitmodules, .gitprecious?,.gitacls? etc Dmitry Kakurin
     [not found]                   ` <Pine.LNX.4.64.0708280945350.28586@racer.site>
2007-09-04 20:23                     ` Jan Hudec
2007-09-05  8:06                       ` Dmitry Kakurin
2007-09-05  8:14                         ` Junio C Hamano
2007-09-05  8:31                           ` Dmitry Kakurin
2007-09-05 18:38                           ` Jan Hudec [this message]
2007-08-27  2:51             ` .gitignore, .gitattributes, .gitmodules, .gitprecious?, .gitacls? etc Sam Vilain
2007-08-27  5:52               ` David Kastrup
2007-08-27 10:56                 ` Sam Vilain
2007-08-27 11:26                   ` David Kastrup
2007-08-27 11:30                   ` Johannes Schindelin
     [not found]                     ` <46D33A15.1000003@vilain.net>
     [not found]                       ` <Pine.LNX.4.64.0708280942360.28586@racer.site>
     [not found]                         ` <46D4A4F8.9040004@vilain.net>
     [not found]                           ` <Pine.LNX.4.64.0708290007020.28586@racer.site>
2007-09-04 20:49                             ` Jan Hudec
2007-08-26 15:05     ` Johannes Schindelin
2007-08-27 11:35   ` martin f krafft
2007-08-27 15:34   ` Sergio Callegari
2007-08-27 15:48     ` David Kastrup
2007-08-27 16:54       ` Petr Baudis
2007-08-27 17:22         ` Sergio Callegari
2007-08-27 17:07       ` Sergio Callegari
2007-09-04 21:03         ` Jan Hudec

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070905183831.GA29370@efreet.light.src \
    --to=bulb@ucw.cz \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=dmitry.kakurin@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pasky@suse.cz \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).