From: Jakub Narebski <jnareb@gmail.com>
To: Johannes Sixt <j.sixt@viscovery.net>
Cc: llucianf <llucianf@gmail.com>,
git@vger.kernel.org, Ferry Huberts <mailings@hupie.com>
Subject: Re: gitignore design
Date: Fri, 29 Jul 2011 06:19:44 -0700 (PDT) [thread overview]
Message-ID: <m3pqktql6s.fsf@localhost.localdomain> (raw)
In-Reply-To: <4E32AE7C.70004@viscovery.net>
Johannes Sixt <j.sixt@viscovery.net> writes:
> Am 7/29/2011 14:19, schrieb Jakub Narebski:
> > For that you can use 'assume-unachanged' mechanism (note: it is local
> > to repository). The gitignore(7) manpage says:
> >
> > NOTES
> > The purpose of gitignore files is to ensure that certain files not tracked
> > by git remain untracked.
> >
> > To ignore uncommitted changes in a file that is already tracked, use
> > `git update-index --assume-unchanged <file>`.
>
> This statement in our documentation is *wrong*!! Please do not suggest it
> for cases like the OP's!
>
> See the discussion of assume-unchanged in git-update-index: This bit
> actually means that git may assume that the file was not changed, and it
> can take the worktree's data when it otherwise would have to unpack the
> index's data. IOW, using it for the purposes that the OP would need is
> *dangerous*.
Are you sure? It seems to work as I thought it would.
$ git init
Initialized empty Git repository in /tmp/jnareb/test/.git/
[master!test]$ echo foo >foo
[master!test]$ echo bar >bar
[master!test]$ echo bar >.gitignore
[master!test]$ git add .
[master!test]$ git commit -m Initial
[master (root-commit) 522267b] Initial
2 files changed, 2 insertions(+), 0 deletions(-)
create mode 100644 .gitignore
create mode 100644 foo
[master!test]$ git add -f bar
[master!test]$ git commit -m 'Add bar (ignored)'
[master a708f70] Add bar (ignored)
1 files changed, 1 insertions(+), 0 deletions(-)
create mode 100644 bar
[master!test]$ echo foo >>foo
[master!test]$ echo bar >>bar
[master!test]$ git status -s
M bar
M foo
[master!test]$ git update-index --assume-unchanged bar
[master!test]$ git status -s
M foo
[master!test]$ git commit -a -m "assume-unchanged bar, both changed"
[master ec74f8e] assume-unchanged bar, both changed
1 files changed, 1 insertions(+), 0 deletions(-)
[master!test]$ git status -s
[master!test]$ git show
commit ec74f8e3f3f819bba22453324d7659fe8dd253e8
Author: Jakub Narebski <jnareb@gmail.com>
Date: Fri Jul 29 44 2011 +0200
assume-unchanged bar, both changed
diff --git a/foo b/foo
index 257cc56..0d55bed 100644
--- a/foo
+++ b/foo
@@ -1 +1,2 @@
foo
+foo
Notice that change to 'bar' didn't get comitted.
--
Jakub Narębski
next prev parent reply other threads:[~2011-07-29 13:19 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-29 10:20 gitignore design llucianf
2011-07-29 11:51 ` Ferry Huberts
2011-07-29 12:01 ` llucianf
2011-07-29 12:08 ` Ferry Huberts
2011-07-29 12:16 ` llucianf
2011-07-29 12:27 ` Jakub Narebski
2011-07-29 12:44 ` llucianf
2011-07-29 12:57 ` Jakub Narebski
2011-07-29 14:01 ` Ferry Huberts
2011-07-29 12:19 ` Jakub Narebski
2011-07-29 12:58 ` Johannes Sixt
2011-07-29 13:19 ` Jakub Narebski [this message]
2011-07-29 13:31 ` Johannes Sixt
2011-07-29 21:39 ` Jakub Narebski
2011-07-30 3:10 ` Nguyen Thai Ngoc Duy
2011-07-30 6:45 ` Piotr Krukowiecki
2011-07-30 13:22 ` Nguyen Thai Ngoc Duy
2011-07-30 15:52 ` Piotr Krukowiecki
2011-07-30 16:01 ` Clemens Buchacher
2011-07-29 16:44 ` Philip Oakley
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=m3pqktql6s.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=git@vger.kernel.org \
--cc=j.sixt@viscovery.net \
--cc=llucianf@gmail.com \
--cc=mailings@hupie.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).