{"thread":{"id":"38114","subject":"GIT: ignoring changes in tracked files and bug report","startedAt":"2014-12-04T22:42:11Z","lastAt":"2014-12-11T23:21:19Z","messageCount":19,"participants":["Sérgio Basto","Johannes Sixt","Nguyễn Thái Ngọc Duy","Duy Nguyen","Junio C Hamano","Philip Oakley","Andreas Schwab"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"253132","messageId":"1417732931.20814.16.camel@segulix","threadId":"38114","inReplyTo":null,"subject":"GIT: ignoring changes in tracked files and bug report","fromName":"Sérgio Basto","fromEmail":"sergio@serjux.com","sentAt":"2014-12-04T22:42:11Z","receivedAt":"2014-12-04T22:42:11Z","isPatch":false,"sender":{"key":"sergio@serjux.com","avatar":"https://gravatar.com/avatar/cb1e1c02b91fca7534374ad3e77409014e4c30c6de47356f36099793f08cc1de?d=mp&s=160"},"body":"Hi, I'm trying find a solution where I can change file in a devel\nenvironment , and not commit it into git . \n\ngit update-index --assume-unchanged <file> \n\nis one solution , not the best solution but one solution. \n\nI add 2 files that I want ignore on commits \n\ngit update-index --assume-unchanged configurations/local.defs\ngit update-index --assume-unchanged processor/default.defs\n\ngit diff -a \nis clean \ngit diff .\nis clean\n\ngit commit -a \nnothing added to commit\nbut \ngit commit . \n# Changes to be committed:\n#       modified:   configurations/local.defs\n#       modified:   processor/default.defs\n\nthis is a bug ? \n\nAnyway what is best way to deal with some files where we want change\nlocally and not commit in git . \nThe solution of have one environment variable that says if we are in\ndevel or in production , and system read the variable and choose the\nfiles to read can't be applied in my case, and is a no solution , is\nsave a variable outside of source code which I can't. \n\n\nThanks,\n-- \nSérgio M. B.\n"},{"id":"253152","messageId":"1417759955.10992.2.camel@segulix","threadId":"38114","inReplyTo":"1417732931.20814.16.camel@segulix","subject":"bug report on update-index --assume-unchanged","fromName":"Sérgio Basto","fromEmail":"sergio@serjux.com","sentAt":"2014-12-05T06:12:35Z","receivedAt":"2014-12-05T06:12:35Z","isPatch":false,"sender":{"key":"sergio@serjux.com","avatar":"https://gravatar.com/avatar/cb1e1c02b91fca7534374ad3e77409014e4c30c6de47356f36099793f08cc1de?d=mp&s=160"},"body":"Hi,\n\nI add 2 files that I want ignore on commits \ngit update-index --assume-unchanged configurations/local.defs\ngit update-index --assume-unchanged processor/default.defs\n\ngit diff -a \nis clean \ngit diff .\nis clean\ngit commit -a \n\nnothing added to commit\n\nbut \n\ngit commit . \n# Changes to be committed:\n#       modified:   configurations/local.defs\n#       modified:   processor/default.defs\n\nthis is a bug .\n\nthanks\n-- \nSérgio M. B.\n"},{"id":"253154","messageId":"548156E5.2080006@kdbg.org","threadId":"38114","inReplyTo":"1417759955.10992.2.camel@segulix","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2014-12-05T06:55:33Z","receivedAt":"2014-12-05T06:55:33Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Am 05.12.2014 07:12, schrieb Sérgio Basto:\n> Hi,\n>\n> I add 2 files that I want ignore on commits\n> git update-index --assume-unchanged configurations/local.defs\n> git update-index --assume-unchanged processor/default.defs\n>\n> git diff -a\n> is clean\n> git diff .\n> is clean\n> git commit -a\n>\n> nothing added to commit\n>\n> but\n>\n> git commit .\n> # Changes to be committed:\n> #       modified:   configurations/local.defs\n> #       modified:   processor/default.defs\n>\n> this is a bug .\n\nActually, it's a user error. When you set --assume-unchanged, then you \ngive a promise to git that you do not change the files, and git does not \nhave to check itself whether there is a change.\n\nBut since you did not keep your promise, you get what you deserve. ;-)\n\nSo, to follow-up on your nearby post: --assume-unchanged is *not* a tool \nto avoid accidentally committing changes to files that are tracked.\n\n-- Hannes\n"},{"id":"253160","messageId":"CACsJy8AVKaq4NJu=23W+wcRgVTQ7hVAOxsVwtZnZsNw6393cTA@mail.gmail.com","threadId":"38114","inReplyTo":"548156E5.2080006@kdbg.org","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-12-05T10:52:15Z","receivedAt":"2014-12-05T10:52:15Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Fri, Dec 5, 2014 at 1:55 PM, Johannes Sixt <j6t@kdbg.org> wrote:\n> Actually, it's a user error. When you set --assume-unchanged, then you give\n> a promise to git that you do not change the files, and git does not have to\n> check itself whether there is a change.\n>\n> But since you did not keep your promise, you get what you deserve. ;-)\n\nYou are correct about the original idea behind --assume-unchanged. But\nover the time I think we bend over a bit and sort of support these use\ncases. For example, aecda37 (do not overwrite files marked \"assume\nunchanged\" - 2010-05-01). The change is one-liner, so I don't mind\ndoing it.\n-- \nDuy\n"},{"id":"253159","messageId":"1417776974-6537-1-git-send-email-pclouds@gmail.com","threadId":"38114","inReplyTo":"1417732931.20814.16.camel@segulix","subject":"[PATCH] commit: ignore assume-unchanged files in \"commmit <file>\" mode","fromName":"Nguyễn Thái Ngọc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2014-12-05T10:56:14Z","receivedAt":"2014-12-05T10:56:14Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"In the same spirit of 7fce6e3 (commit: correctly respect skip-worktree\nbit - 2009-12-14), if a file is marked unchanged, skip it.\n\nNoticed-by: Sérgio Basto <sergio@serjux.com>\nSigned-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n---\n builtin/commit.c                         |  2 +-\n t/t2106-update-index-assume-unchanged.sh | 10 ++++++++++\n 2 files changed, 11 insertions(+), 1 deletion(-)\n\ndiff --git a/builtin/commit.c b/builtin/commit.c\nindex e108c53..ee3de12 100644\n--- a/builtin/commit.c\n+++ b/builtin/commit.c\n@@ -252,7 +252,7 @@ static int list_paths(struct string_list *list, const char *with_tree,\n \t\tif (!ce_path_match(ce, pattern, m))\n \t\t\tcontinue;\n \t\titem = string_list_insert(list, ce->name);\n-\t\tif (ce_skip_worktree(ce))\n+\t\tif (ce->ce_flags & (CE_VALID | CE_SKIP_WORKTREE))\n \t\t\titem->util = item; /* better a valid pointer than a fake one */\n \t}\n \ndiff --git a/t/t2106-update-index-assume-unchanged.sh b/t/t2106-update-index-assume-unchanged.sh\nindex 99d858c..dc332f5 100755\n--- a/t/t2106-update-index-assume-unchanged.sh\n+++ b/t/t2106-update-index-assume-unchanged.sh\n@@ -21,4 +21,14 @@ test_expect_success 'do not switch branches with dirty file' \\\n \t git update-index --assume-unchanged file &&\n \t test_must_fail git checkout master'\n \n+test_expect_success 'commit <paths> ignore assume-unchanged files' '\n+\t: >anotherfile &&\n+\tgit add anotherfile &&\n+\techo dirty >anotherfile &&\n+\tgit commit -m one -- file anotherfile &&\n+\tgit diff --name-only HEAD^ HEAD >actual &&\n+\techo anotherfile >expected &&\n+\ttest_cmp expected actual\n+'\n+\n test_done\n-- \n2.2.0.60.gb7b3c64\n"},{"id":"253169","messageId":"1417798622.23238.6.camel@segulix","threadId":"38114","inReplyTo":"CACsJy8AVKaq4NJu=23W+wcRgVTQ7hVAOxsVwtZnZsNw6393cTA@mail.gmail.com","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Sérgio Basto","fromEmail":"sergio@serjux.com","sentAt":"2014-12-05T16:57:02Z","receivedAt":"2014-12-05T16:57:02Z","isPatch":false,"sender":{"key":"sergio@serjux.com","avatar":"https://gravatar.com/avatar/cb1e1c02b91fca7534374ad3e77409014e4c30c6de47356f36099793f08cc1de?d=mp&s=160"},"body":"Hi,\nOn Sex, 2014-12-05 at 17:52 +0700, Duy Nguyen wrote: \n> On Fri, Dec 5, 2014 at 1:55 PM, Johannes Sixt <j6t@kdbg.org> wrote:\n> > Actually, it's a user error. When you set --assume-unchanged, then you give\n> > a promise to git that you do not change the files, and git does not have to\n> > check itself whether there is a change.\n> >\n> > But since you did not keep your promise, you get what you deserve. ;-)\n\n\nNo, I marked with assume-unchanged *after* change the file , and not\nbefore. Else don't see what is the point of assume-unchanged if you\nreally don't change the file. \n\n\n> You are correct about the original idea behind --assume-unchanged. But\n> over the time I think we bend over a bit and sort of support these use\n> cases. For example, aecda37 (do not overwrite files marked \"assume\n> unchanged\" - 2010-05-01). The change is one-liner, so I don't mind\n> doing it.\n\nI think is the right thing \n\nThanks,\n-- \nSérgio M. B.\n"},{"id":"253174","messageId":"xmqq1toeq79b.fsf@gitster.dls.corp.google.com","threadId":"38114","inReplyTo":"1417798622.23238.6.camel@segulix","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-05T18:30:24Z","receivedAt":"2014-12-05T18:30:24Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sérgio Basto <sergio@serjux.com> writes:\n\n\n> On Sex, 2014-12-05 at 17:52 +0700, Duy Nguyen wrote: \n>> On Fri, Dec 5, 2014 at 1:55 PM, Johannes Sixt <j6t@kdbg.org> wrote:\n>> > Actually, it's a user error. When you set --assume-unchanged, then you give\n>> > a promise to git that you do not change the files, and git does not have to\n>> > check itself whether there is a change.\n>> >\n>> > But since you did not keep your promise, you get what you deserve. ;-)\n>\n>\n> No, I marked with assume-unchanged *after* change the file , and not\n> before. Else don't see what is the point of assume-unchanged if you\n> really don't change the file. \n\nThat \"unchanged\" is relative to what is in the index.\n\nYour promise is \"these paths I will not modify\" and in return you\ngain performance in \"git status\" as the promise allows Git not to\ncheck with lstat() if the files in the workng tree was modified and\ninstead assume that you didn't change them.  That is the point of\nassume-unchanged bit.\n\nIf however you did something that made Git notice that you changed\nthese paths marked with assume-unchanged bit anyway, then Git will,\nwell, notice that they are not \"unchanged\" as you promised.\n"},{"id":"253175","messageId":"xmqqwq66osj8.fsf@gitster.dls.corp.google.com","threadId":"38114","inReplyTo":"CACsJy8AVKaq4NJu=23W+wcRgVTQ7hVAOxsVwtZnZsNw6393cTA@mail.gmail.com","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-05T18:33:47Z","receivedAt":"2014-12-05T18:33:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Duy Nguyen <pclouds@gmail.com> writes:\n\n> You are correct about the original idea behind --assume-unchanged. But\n> over the time I think we bend over a bit and sort of support these use\n> cases. For example, aecda37 (do not overwrite files marked \"assume\n> unchanged\" - 2010-05-01). The change is one-liner, so I don't mind\n> doing it.\n\nI think that was a misguided change to make the semantics muddy and\nto break the existing users who use the bit for its intended purpose\n(i.e. to avoid lstat() by promising that it is not necessary), and\nnot \"bending over to support\".  Offhand, I doubt we would want to\nadd more of the same kind.\n"},{"id":"253184","messageId":"12536C063959480083CC2D4CBA0BA38E@PhilipOakley","threadId":"38114","inReplyTo":"xmqq1toeq79b.fsf@gitster.dls.corp.google.com","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2014-12-05T20:04:28Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Junio C Hamano\" <gitster@pobox.com>\n> Sérgio Basto <sergio@serjux.com> writes:\n>\n>\n>> On Sex, 2014-12-05 at 17:52 +0700, Duy Nguyen wrote:\n>>> On Fri, Dec 5, 2014 at 1:55 PM, Johannes Sixt <j6t@kdbg.org> wrote:\n>>> > Actually, it's a user error. When you set --assume-unchanged, then\n>>> > you give\n>>> > a promise to git that you do not change the files, and git does\n>>> > not have to\n>>> > check itself whether there is a change.\n>>> >\n>>> > But since you did not keep your promise, you get what you deserve.\n>>> > ;-)\n>>\n>>\n>> No, I marked with assume-unchanged *after* change the file , and not\n>> before. Else don't see what is the point of assume-unchanged if you\n>> really don't change the file.\n>\n> That \"unchanged\" is relative to what is in the index.\n>\n> Your promise is \"these paths I will not modify\" and in return you\n> gain performance in \"git status\" as the promise allows Git not to\n> check with lstat() if the files in the workng tree was modified and\n> instead assume that you didn't change them.  That is the point of\n> assume-unchanged bit.\n>\n> If however you did something that made Git notice that you changed\n> these paths marked with assume-unchanged bit anyway, then Git will,\n> well, notice that they are not \"unchanged\" as you promised.\n\nThe problem here is that there is no guidance on what those actions are\nthat may make git 'notice'. The man page git-update-index isn't as clear\nas it could be. Using --really-refresh being one option that would make\ngit notice, but I wouldn't know when that is used.\n\nPart of the implied question is why \"git commit .\" would notice when\nwhen \"git commit -a\" didn't appear to. So it's unclear as to what the \nuser should have expected.\n\n(Note, I don't use assume-unchanged myself so this is more about \nsupporting the user/manual clarification. It is mentioned moderately \noften on stackoverflow etc.)\n\n--\nPhilip\n"},{"id":"253186","messageId":"xmqqfvctq030.fsf@gitster.dls.corp.google.com","threadId":"38114","inReplyTo":"12536C063959480083CC2D4CBA0BA38E@PhilipOakley","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-05T21:05:23Z","receivedAt":"2014-12-05T21:05:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Philip Oakley\" <philipoakley@iee.org> writes:\n\n> The problem here is that there is no guidance on what those actions are\n> that may make git 'notice'....\n\nI think the guidance the users need is the one j6t has given already\nin the upthread: \"If you are promising Git you are not going to\ntouch a path, do not touch it.  Bad things may happen.\"\n\nThere is no need to say \"if you touched this way or that way, then\nyou might get lucky.\" because the \"lucky\" part is not designed.  As\nwe find more codepaths that can rely on the promise by the user, we\nmay decide to take advantage of that promise even further and the\n\"lucky/unlucky\" equation _will_ change when that happens.\n"},{"id":"253187","messageId":"xmqqbnnhpzgb.fsf@gitster.dls.corp.google.com","threadId":"38114","inReplyTo":"xmqq1toeq79b.fsf@gitster.dls.corp.google.com","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-05T21:19:00Z","receivedAt":"2014-12-05T21:19:00Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> If however you did something that made Git notice that you changed\n> these paths marked with assume-unchanged bit anyway, then Git will,\n> well, notice that they are not \"unchanged\" as you promised.\n\nBy the way, this cuts both ways.  I would not bother checking with\nthe current codebase, but I know it used to be that when we have a\nblob object name and need a temporary file that holds the content\nfor read-only purpose (e.g. passing a pair of files to external diff\ndriver), we allowed Git to reuse files in the working tree whose\nblob object name we knew.  This is of course because it is faster\nthan inflating the blob contents out of the object store and writing\na new file.\n\nThat codepath is allowed to \"borrow\" the working tree file as such a\ntemporary file for read-only purpose, when a file is stat-clean\n(i.e. its contents is known to match the blob object recorded in the\nindex).  A file with assume-unchanged bit set is treated exactly the\nsame way, because the user promised not to modify it.\n\nIf the user broke the promise, then an external diff driver would\nhave been given a file whose contents does not actually match the\nwanted blob object, resulting in an incorrect diff output.\n"},{"id":"253190","messageId":"1417815590.23238.11.camel@segulix","threadId":"38114","inReplyTo":"xmqq1toeq79b.fsf@gitster.dls.corp.google.com","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Sérgio Basto","fromEmail":"sergio@serjux.com","sentAt":"2014-12-05T21:39:50Z","receivedAt":"2014-12-05T21:39:50Z","isPatch":false,"sender":{"key":"sergio@serjux.com","avatar":"https://gravatar.com/avatar/cb1e1c02b91fca7534374ad3e77409014e4c30c6de47356f36099793f08cc1de?d=mp&s=160"},"body":"On Sex, 2014-12-05 at 10:30 -0800, Junio C Hamano wrote:\n> Your promise is \"these paths I will not modify\" and in return you\n> gain performance in \"git status\"\n\nyeah  so  --assume-unchanged is for administrators of git , like I write\nI change first  and --assume-unchanged after and never change it\nagain . \nBut if it is a tool for administration of git , I don't what to say ...\nput it in a gitadmin command . \n\nI hate git and this is one one the reason . \n\n-- \nSérgio M. B.\n"},{"id":"253191","messageId":"xmqqy4qlojbv.fsf@gitster.dls.corp.google.com","threadId":"38114","inReplyTo":"1417815590.23238.11.camel@segulix","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-05T21:52:36Z","receivedAt":"2014-12-05T21:52:36Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sérgio Basto <sergio@serjux.com> writes:\n\n> On Sex, 2014-12-05 at 10:30 -0800, Junio C Hamano wrote:\n>> Your promise is \"these paths I will not modify\" and in return you\n>> gain performance in \"git status\"\n>\n> yeah  so  --assume-unchanged is for administrators of git ,...\n\nNot at all.\n\nAdministrators would typically not know (and they would not want to\nknow) what part of your particular project tree you as an individual\ndeveloper is not working on day to day.\n\nThis was added primarily by normal users (or as a response to a\nrequest from normal users) on slow filesystems (e.g. Cygwin).  When\nthey are working on one part of their project tree and know they are\nnot touching other parts, they wanted to skip slowness of having to\nlstat(2) all paths in the project tree to detect what changed during\n\"git status\".\n"},{"id":"253192","messageId":"C082ED21306F4D82BCF6B03D9163836B@PhilipOakley","threadId":"38114","inReplyTo":"xmqqfvctq030.fsf@gitster.dls.corp.google.com","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2014-12-05T21:52:36Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Junio C Hamano\" <gitster@pobox.com>\n> \"Philip Oakley\" <philipoakley@iee.org> writes:\n>\n>> The problem here is that there is no guidance on what those actions \n>> are\n>> that may make git 'notice'....\n>\n> I think the guidance the users need is the one j6t has given already\n> in the upthread: \"If you are promising Git you are not going to\n> touch a path, do not touch it.  Bad things may happen.\"\n>\n> There is no need to say \"if you touched this way or that way, then\n> you might get lucky.\" because the \"lucky\" part is not designed.  As\n> we find more codepaths that can rely on the promise by the user, we\n> may decide to take advantage of that promise even further and the\n> \"lucky/unlucky\" equation _will_ change when that happens.\n>\nHowever the man page's statement 'When the \"assume unchanged\" bit is on, \nGit stops checking the working tree files for possible modifications, so \nyou need to manually unset the bit to tell Git when you change the \nworking tree file.' can easily be understood the way Sergio has \ndescribed. Git stops checking so it won't notice any changes, which is a \ncontract it doesn't keep.\n\nPerhaps the man page itself needs rewording to be more firm that the \nuser should NOT change the file. The contract is with the user not to \nchange, rather than a contract by Git not to look.\n\nEven with that man page change, it would not solve many of the user X-Y \nproblems where what they want is an \"--ignore-this\" flag for a file \nwhich does give that alternate contract that 'git won't look until the \nflag has been cleared.\n\n--\nPhilip \n"},{"id":"253194","messageId":"87fvctoi5g.fsf@igel.home","threadId":"38114","inReplyTo":"C082ED21306F4D82BCF6B03D9163836B@PhilipOakley","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2014-12-05T22:18:03Z","receivedAt":"2014-12-05T22:18:03Z","isPatch":false,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"\"Philip Oakley\" <philipoakley@iee.org> writes:\n\n> However the man page's statement 'When the \"assume unchanged\" bit is on,\n> Git stops checking the working tree files for possible modifications, so\n> you need to manually unset the bit to tell Git when you change the working\n> tree file.' can easily be understood the way Sergio has described. Git\n> stops checking so it won't notice any changes, which is a contract it\n> doesn't keep.\n\nThe contract is: when you change the working tree file, you must tell\nGit about it.  Failure to do so is a breach of the contract.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"253213","messageId":"1417826757.30899.16.camel@segulix","threadId":"38114","inReplyTo":"12536C063959480083CC2D4CBA0BA38E@PhilipOakley","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Sérgio Basto","fromEmail":"sergio@serjux.com","sentAt":"2014-12-06T00:45:57Z","receivedAt":"2014-12-06T00:45:57Z","isPatch":false,"sender":{"key":"sergio@serjux.com","avatar":"https://gravatar.com/avatar/cb1e1c02b91fca7534374ad3e77409014e4c30c6de47356f36099793f08cc1de?d=mp&s=160"},"body":"On Sex, 2014-12-05 at 20:48 +0000, Philip Oakley wrote:\n> The problem here is that there is no guidance on what those actions\n> are\n> that may make git 'notice'. The man page git-update-index isn't as\n> clear\n> as it could be. Using --really-refresh being one option that would\n> make\n> git notice, but I wouldn't know when that is used.\n> \n> Part of the implied question is why \"git commit .\" would notice when\n> when \"git commit -a\" didn't appear to. So it's unclear as to what the \n> user should have expected.\n> \nI agree with this sentence, this is a bug because:\n\ngit commit -a ( and -a means all ) is incoherent with \"git commit .\"\nThis is stupid because when I want commit part of the tree, commit\nincludes one file that is not included when I say to commit all . \nSo maybe you should fix, git commit -a to be coherent . \n\n> (Note, I don't use assume-unchanged myself so this is more about \n> supporting the user/manual clarification. It is mentioned moderately \n> often on stackoverflow etc.)\n\nyeap  \n\nSorry I don't have time to read all messages in thread , \nbut I'm going to test git with the patch suggest in this thread , at\nleast, I solve \"my\" problem for some time ... \n\nThanks,  \n-- \nSérgio M. B.\n"},{"id":"253244","messageId":"E7C0C71D452B476D8E0E60AD75423156@PhilipOakley","threadId":"38114","inReplyTo":"1417826757.30899.16.camel@segulix","subject":"Re: bug report on update-index --assume-unchanged","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2014-12-06T13:06:08Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Sérgio Basto\" <sergio@serjux.com>\n[..]\n>> Part of the implied question is why \"git commit .\" would notice when\n>> when \"git commit -a\" didn't appear to. So it's unclear as to what the\n>> user should have expected.\n>>\n> I agree with this sentence, this is a bug because:\n>\n> git commit -a ( and -a means all ) is incoherent with \"git commit .\"\n> This is stupid because when I want commit part of the tree, commit\n> includes one file that is not included when I say to commit all .\n> So maybe you should fix, git commit -a to be coherent .\n\nUltimately this (-a vs '.' with --assume-unchanged) is not a 'bug', \nbecause it does as planned. However the documenation is 'wrong' or at \nleast misguides many readers.\n\nThank you for bring it to the list's attention.\n[..]\n>\n> Sorry I don't have time to read all messages in thread ,\n> but I'm going to test git with the patch suggest in this thread , at\n> least, I solve \"my\" problem for some time ...\n>\nMy patch, and Junio's 'squash' are to correct the documentation, and \nespecially remove the line about it having an \"ignore\" capability, which \nis a promise not kept (your -a vs '.' !).\n\nI'll be updating the documenation patch today for review, though that \ndoesn't solve the wider problem of:\n    - 'how to temporarily ignore changes to a tracked file'.\n--\nPhilip \n"},{"id":"253395","messageId":"1418093090.19104.1.camel@segulix","threadId":"38114","inReplyTo":"1417776974-6537-1-git-send-email-pclouds@gmail.com","subject":"Re: [PATCH] commit: ignore assume-unchanged files in \"commmit <file>\" mode","fromName":"Sérgio Basto","fromEmail":"sergio@serjux.com","sentAt":"2014-12-09T02:44:50Z","receivedAt":"2014-12-09T02:44:50Z","isPatch":true,"sender":{"key":"sergio@serjux.com","avatar":"https://gravatar.com/avatar/cb1e1c02b91fca7534374ad3e77409014e4c30c6de47356f36099793f08cc1de?d=mp&s=160"},"body":"On Sex, 2014-12-05 at 17:56 +0700, Nguyễn Thái Ngọc Duy wrote: \n> In the same spirit of 7fce6e3 (commit: correctly respect skip-worktree\n> bit - 2009-12-14), if a file is marked unchanged, skip it.\n> \n> Noticed-by: Sérgio Basto <sergio@serjux.com>\n> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n> ---\n>  builtin/commit.c                         |  2 +-\n>  t/t2106-update-index-assume-unchanged.sh | 10 ++++++++++\n>  2 files changed, 11 insertions(+), 1 deletion(-)\n> \n> diff --git a/builtin/commit.c b/builtin/commit.c\n> index e108c53..ee3de12 100644\n> --- a/builtin/commit.c\n> +++ b/builtin/commit.c\n> @@ -252,7 +252,7 @@ static int list_paths(struct string_list *list, const char *with_tree,\n>  \t\tif (!ce_path_match(ce, pattern, m))\n>  \t\t\tcontinue;\n>  \t\titem = string_list_insert(list, ce->name);\n> -\t\tif (ce_skip_worktree(ce))\n> +\t\tif (ce->ce_flags & (CE_VALID | CE_SKIP_WORKTREE))\n>  \t\t\titem->util = item; /* better a valid pointer than a fake one */\n>  \t}\n>  \n> diff --git a/t/t2106-update-index-assume-unchanged.sh b/t/t2106-update-index-assume-unchanged.sh\n> index 99d858c..dc332f5 100755\n> --- a/t/t2106-update-index-assume-unchanged.sh\n> +++ b/t/t2106-update-index-assume-unchanged.sh\n> @@ -21,4 +21,14 @@ test_expect_success 'do not switch branches with dirty file' \\\n>  \t git update-index --assume-unchanged file &&\n>  \t test_must_fail git checkout master'\n>  \n> +test_expect_success 'commit <paths> ignore assume-unchanged files' '\n> +\t: >anotherfile &&\n> +\tgit add anotherfile &&\n> +\techo dirty >anotherfile &&\n> +\tgit commit -m one -- file anotherfile &&\n> +\tgit diff --name-only HEAD^ HEAD >actual &&\n> +\techo anotherfile >expected &&\n> +\ttest_cmp expected actual\n> +'\n> +\n>  test_done\n\n\nworks great many thanks, \n\n-- \nSérgio M. B.\n"},{"id":"253593","messageId":"35EB570A2A994662AA2E89910ECE9668@PhilipOakley","threadId":"38114","inReplyTo":"1418093090.19104.1.camel@segulix","subject":"Re: [PATCH] commit: ignore assume-unchanged files in \"commmit <file>\" mode","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2014-12-11T23:21:19Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Sérgio Basto\" <sergio@serjux.com> Sent: Tuesday, December 09, \n2014 2:44 AM\n> On Sex, 2014-12-05 at 17:56 +0700, Nguyễn Thái Ngọc Duy wrote:\n>> In the same spirit of 7fce6e3 (commit: correctly respect \n>> skip-worktree\n>> bit - 2009-12-14), if a file is marked unchanged, skip it.\n>>\n>> Noticed-by: Sérgio Basto <sergio@serjux.com>\n>> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>\n>> ---\n>>  builtin/commit.c                         |  2 +-\n>>  t/t2106-update-index-assume-unchanged.sh | 10 ++++++++++\n>>  2 files changed, 11 insertions(+), 1 deletion(-)\n>>\n>> diff --git a/builtin/commit.c b/builtin/commit.c\n>> index e108c53..ee3de12 100644\n>> --- a/builtin/commit.c\n>> +++ b/builtin/commit.c\n>> @@ -252,7 +252,7 @@ static int list_paths(struct string_list *list, \n>> const char *with_tree,\n>>  if (!ce_path_match(ce, pattern, m))\n>>  continue;\n>>  item = string_list_insert(list, ce->name);\n>> - if (ce_skip_worktree(ce))\n>> + if (ce->ce_flags & (CE_VALID | CE_SKIP_WORKTREE))\n>>  item->util = item; /* better a valid pointer than a fake one */\n>>  }\n>>\n>> diff --git a/t/t2106-update-index-assume-unchanged.sh \n>> b/t/t2106-update-index-assume-unchanged.sh\n>> index 99d858c..dc332f5 100755\n>> --- a/t/t2106-update-index-assume-unchanged.sh\n>> +++ b/t/t2106-update-index-assume-unchanged.sh\n>> @@ -21,4 +21,14 @@ test_expect_success 'do not switch branches with \n>> dirty file' \\\n>>  git update-index --assume-unchanged file &&\n>>  test_must_fail git checkout master'\n>>\n>> +test_expect_success 'commit <paths> ignore assume-unchanged files' '\n>> + : >anotherfile &&\n>> + git add anotherfile &&\n>> + echo dirty >anotherfile &&\n>> + git commit -m one -- file anotherfile &&\n>> + git diff --name-only HEAD^ HEAD >actual &&\n>> + echo anotherfile >expected &&\n>> + test_cmp expected actual\n>> +'\n>> +\n>>  test_done\n>\n>\n> works great many thanks,\n>\nJunio: Given that this patch avoids the user surprise that the `commit \n.` and `commit -a` produced unexpectedly different effects, should it \nalso be included in the --assume unchanged patches? Or is the test \ninappropriate?\n\nI'm guessing that there will still be other potential 'gotcha' code \npaths that would still produce surprise though.\n\nPhilip \n"}]}