{"thread":{"id":"12659","subject":"[Q] assume unchanged?","startedAt":"2008-03-12T21:53:07Z","lastAt":"2008-03-13T07:33:26Z","messageCount":3,"participants":["しらいしななこ","Andreas Ericsson","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"71865","messageId":"20080227222243.6117@nanako3.bluebottle.com","threadId":"12659","inReplyTo":null,"subject":"[Q] assume unchanged?","fromName":"しらいしななこ","fromEmail":"nanako3@bluebottle.com","sentAt":"2008-03-12T21:53:07Z","receivedAt":"2008-03-12T21:53:07Z","isPatch":false,"sender":{"key":"nanako3@lavabit.com","avatar":"https://gravatar.com/avatar/3777b9e201c5883a62b1a6fdf7c53f2d712d1d80989146063ea861e33aad72a8?d=mp&s=160"},"body":"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.\n\nI 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?\n\nThe 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.\n\nCould somebody explain, please?\n\n-- \nNanako Shiraishi\nhttp://ivory.ap.teacup.com/nanako3/\n\n----------------------------------------------------------------------\nFind out how you can get spam free email.\nhttp://www.bluebottle.com/tag/3\n"},{"id":"71899","messageId":"47D8D77D.8070908@op5.se","threadId":"12659","inReplyTo":"20080227222243.6117@nanako3.bluebottle.com","subject":"Re: [Q] assume unchanged?","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2008-03-13T07:27:57Z","receivedAt":"2008-03-13T07:27:57Z","isPatch":false,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"しらいしななこ wrote:\n> I was looking at the documentation of git-update-index because I\n> thought git-add is the preferred way to do what the command was used\n> for in the old versions of git, and wanted to see if the old command\n> has more features that are missing from git-add.\n> \n> I noticed that there is --assume-unchanged option, and I read its\n> description three times, but I do not understand it.  What is it good\n> for?  Version control systems are used in order to keep track\n> changes, and if using that option makes my changes ignored, how can\n> it be a good thing?\n> \n> The manual says \"This is sometimes helpful when working with a big\n> project on a filesystem that has very slow lstat(2) system call\", but\n> unfortunately it does not answer my question.\n> \n> Could somebody explain, please?\n> \n\nIf you're hacking on, oh, let's say the openoffice repo (or something\nsimilarly huge), and the files you're actually testing are located on\nan NFS-mounted network disk, you can use \"--assume-unchanged java\n--assume-unchanged writer\" to make git not walk through those directories\nand lstat(2) everything in it to see if there are changes. For huge\nprojects, doing the lstat() walk can take a couple of seconds on a quick\nfilesystem sitting on a local disk, and several minutes on a really slow\nnetwork disk.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\nTel: +46 8-230225                  Fax: +46 8-230231\n"},{"id":"71902","messageId":"7vejafyt6h.fsf@gitster.siamese.dyndns.org","threadId":"12659","inReplyTo":"20080227222243.6117@nanako3.bluebottle.com","subject":"Re: [Q] assume unchanged?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-13T07:33:26Z","receivedAt":"2008-03-13T07:33:26Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"しらいしななこ  <nanako3@bluebottle.com> writes:\n\n> I noticed that there is --assume-unchanged option, and I read its\n> description three times, but I do not understand it.  What is it good\n> for?  Version control systems are used in order to keep track changes,\n> and if using that option makes my changes ignored, how can it be a good\n> thing?\n\n[offtopic: I wrapped your lines...]\n\nThat's an ancient invention but I think it still has two uses (at least,\nits ideas, but honestly speaking, I do not know how hard recent built-in\nPorcelains tried to keep the concept maintained---the implementation may\nhave decayed over time):\n\n - If your build system is broken such that it has a bad habit of\n   overwriting a tracked file (e.g. \"make depend\" overwriting tracked\n   Makefile), you would want to ignore such a change and keep going.  Of\n   course, you need to remember that you need to drop that assume\n   unchanged bit when you really make your own change to such a file,\n   which is a minor drawback, but when you do that you would need to clean\n   up the unrelated changes your broken build system leaves anyway, so it\n   is not a big deal.\n\n - If your filesystem is slow and you know upfront you are only going to\n   work inside a small corer of the source tree, you can tell the system\n   that \"I won't be touching these paths, and even if I did, they were\n   modified by accident\".  After that, git does not have to check for\n   modifications in the paths you marked as such.\n\nThe idea is that if an entry had \"assume unchanged\" set, then whenever we\ncheck a work tree file for that entry (e.g. \"have we changed it from the\nindex?\", \"what's the contents of the path? give it to me so that I can\ncompare it with what's in the HEAD commit\", etc.) we instead return what\nis in the index.\n\nSo it _should_ be usable as an ingredient for a narrow checkout, like:\n\n\tgit clone -n ;# no checkout\n        git read-tree HEAD ;# still no checkout\n        git checkout HEAD Documentation/ ;# only that part\n        git diff --name-only HEAD -- |\n        git update-index --assume-unchanged --stdin ;# set the magic\n\nand after doing that, git shouldn't notice that your work tree is missing\neverything outside Documentation/ hierarchy.  At least that is the idea.\n\nI would not, however, be so surprised if this bit is honored only for\nfiles that are actually checked out, as detecting of missing paths happens\nmuch earlier than checking if paths are modified, and the use of the bit\nwas about \"modified\".  In addition, no serious workflow ever used this\nfeature as far as I know in real life, so bugs remaining in the codepath\ninvolved in handling this bit are not so surprising.  It should not be too\nhard to fix them, though, if people are really interested.\n"}]}