From: Junio C Hamano <gitster@pobox.com>
To: しらいしななこ <nanako3@bluebottle.com>
Cc: git@vger.kernel.org
Subject: Re: [Q] assume unchanged?
Date: Thu, 13 Mar 2008 00:33:26 -0700 [thread overview]
Message-ID: <7vejafyt6h.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: 20080227222243.6117@nanako3.bluebottle.com
しらいしななこ <nanako3@bluebottle.com> writes:
> I noticed that there is --assume-unchanged option, and I read its
> description three times, but I do not understand it. What is it good
> for? Version control systems are used in order to keep track changes,
> and if using that option makes my changes ignored, how can it be a good
> thing?
[offtopic: I wrapped your lines...]
That's an ancient invention but I think it still has two uses (at least,
its ideas, but honestly speaking, I do not know how hard recent built-in
Porcelains tried to keep the concept maintained---the implementation may
have decayed over time):
- If your build system is broken such that it has a bad habit of
overwriting a tracked file (e.g. "make depend" overwriting tracked
Makefile), you would want to ignore such a change and keep going. Of
course, you need to remember that you need to drop that assume
unchanged bit when you really make your own change to such a file,
which is a minor drawback, but when you do that you would need to clean
up the unrelated changes your broken build system leaves anyway, so it
is not a big deal.
- If your filesystem is slow and you know upfront you are only going to
work inside a small corer of the source tree, you can tell the system
that "I won't be touching these paths, and even if I did, they were
modified by accident". After that, git does not have to check for
modifications in the paths you marked as such.
The idea is that if an entry had "assume unchanged" set, then whenever we
check a work tree file for that entry (e.g. "have we changed it from the
index?", "what's the contents of the path? give it to me so that I can
compare it with what's in the HEAD commit", etc.) we instead return what
is in the index.
So it _should_ be usable as an ingredient for a narrow checkout, like:
git clone -n ;# no checkout
git read-tree HEAD ;# still no checkout
git checkout HEAD Documentation/ ;# only that part
git diff --name-only HEAD -- |
git update-index --assume-unchanged --stdin ;# set the magic
and after doing that, git shouldn't notice that your work tree is missing
everything outside Documentation/ hierarchy. At least that is the idea.
I would not, however, be so surprised if this bit is honored only for
files that are actually checked out, as detecting of missing paths happens
much earlier than checking if paths are modified, and the use of the bit
was about "modified". In addition, no serious workflow ever used this
feature as far as I know in real life, so bugs remaining in the codepath
involved in handling this bit are not so surprising. It should not be too
hard to fix them, though, if people are really interested.
prev parent reply other threads:[~2008-03-13 7:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-12 21:53 [Q] assume unchanged? しらいしななこ
2008-03-13 7:27 ` Andreas Ericsson
2008-03-13 7:33 ` 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=7vejafyt6h.fsf@gitster.siamese.dyndns.org \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=nanako3@bluebottle.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).