git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [Q] assume unchanged?
@ 2008-03-12 21:53 しらいしななこ
  2008-03-13  7:27 ` Andreas Ericsson
  2008-03-13  7:33 ` Junio C Hamano
  0 siblings, 2 replies; 3+ messages in thread
From: しらいしななこ @ 2008-03-12 21:53 UTC (permalink / raw)
  To: git

I was looking at the documentation of git-update-index because I thought git-add is the preferred way to do what the command was used for in the old versions of git, and wanted to see if the old command has more features that are missing from git-add.

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?

The manual says "This is sometimes helpful when working with a big project on a filesystem that has very slow lstat(2) system call", but unfortunately it does not answer my question.

Could somebody explain, please?

-- 
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/

----------------------------------------------------------------------
Find out how you can get spam free email.
http://www.bluebottle.com/tag/3

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Q] assume unchanged?
  2008-03-12 21:53 [Q] assume unchanged? しらいしななこ
@ 2008-03-13  7:27 ` Andreas Ericsson
  2008-03-13  7:33 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Ericsson @ 2008-03-13  7:27 UTC (permalink / raw)
  To: しらいしななこ; +Cc: git

しらいしななこ wrote:
> I was looking at the documentation of git-update-index because I
> thought git-add is the preferred way to do what the command was used
> for in the old versions of git, and wanted to see if the old command
> has more features that are missing from git-add.
> 
> 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?
> 
> The manual says "This is sometimes helpful when working with a big
> project on a filesystem that has very slow lstat(2) system call", but
> unfortunately it does not answer my question.
> 
> Could somebody explain, please?
> 

If you're hacking on, oh, let's say the openoffice repo (or something
similarly huge), and the files you're actually testing are located on
an NFS-mounted network disk, you can use "--assume-unchanged java
--assume-unchanged writer" to make git not walk through those directories
and lstat(2) everything in it to see if there are changes. For huge
projects, doing the lstat() walk can take a couple of seconds on a quick
filesystem sitting on a local disk, and several minutes on a really slow
network disk.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Q] assume unchanged?
  2008-03-12 21:53 [Q] assume unchanged? しらいしななこ
  2008-03-13  7:27 ` Andreas Ericsson
@ 2008-03-13  7:33 ` Junio C Hamano
  1 sibling, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2008-03-13  7:33 UTC (permalink / raw)
  To: しらいしななこ; +Cc: git

しらいしななこ  <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.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-03-13  7:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-03-12 21:53 [Q] assume unchanged? しらいしななこ
2008-03-13  7:27 ` Andreas Ericsson
2008-03-13  7:33 ` Junio C Hamano

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).