Re: [Q] assume unchanged?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



しらいしななこ  <nanako3@xxxxxxxxxxxxxx> 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.
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux