{"thread":{"id":"38108","subject":"git add <single file> and git add <list of files> behave differentely for ignored files","startedAt":"2014-12-04T09:06:23Z","lastAt":"2014-12-08T16:13:08Z","messageCount":7,"participants":["Guilherme","Konstantin Khomoutov","Michael J Gruber","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"253043","messageId":"CAMDzUtzQJoEi17OfX8FPOV6SDJ_ytJSH-YTKx2DtUON35-EVSg@mail.gmail.com","threadId":"38108","inReplyTo":null,"subject":"git add <single file> and git add <list of files> behave differentely for ignored files","fromName":"Guilherme","fromEmail":"guibufolo@gmail.com","sentAt":"2014-12-04T09:06:23Z","receivedAt":"2014-12-04T09:06:23Z","isPatch":false,"sender":{"key":"guibufolo@gmail.com","avatar":null},"body":"Hello,\n\nI reported this issue on the git-user mailing list and they redirected me here.\n\nThe problem I have observed is that with a ignored path `git add\n<single file>` behaves differently then `git add <list of files>`.\n\nI my git/info/excludes file i have\n\n/COM/config\n!COM/config/Project.gny\n\nThe file COM/config/Project.gny has already been added to the\nrepository via `git add -f`.\n\nWhen doing\n\n    git add -- COM/config/Projec.gny\n\ngit will not complain but when doing\n\n    git add -- COM/config/Project.gny otherfiles.c\n\nit will report:\n\n    The following paths are ignored by one of your .gitignore files:\n    COM/config\n    Use -f if you really want to add them.\n    fatal: no files added\n\nThis odd behaviour is also present in `git check-ignore`.\n\nBefore adding the file `git check-ignore` correctly reports the file\nas ignored. After having added it via `git add -f` it won't report it\nas ignored anymore.\n\nEven if not a bug this behaviour is inconsistent and might want to be\naddressed as it makes scripting a little bit harder.\n\nThank you.\n"},{"id":"253049","messageId":"20141204141100.742f32d74dbf8d65abc8c6ae@domain007.com","threadId":"38108","inReplyTo":"CAMDzUtzQJoEi17OfX8FPOV6SDJ_ytJSH-YTKx2DtUON35-EVSg@mail.gmail.com","subject":"Re: git add <single file> and git add <list of files> behave differentely for ignored files","fromName":"Konstantin Khomoutov","fromEmail":"flatworm@users.sourceforge.net","sentAt":"2014-12-04T11:11:00Z","receivedAt":"2014-12-04T11:11:00Z","isPatch":false,"sender":{"key":"flatworm@users.sourceforge.net","avatar":null},"body":"On Thu, 4 Dec 2014 10:06:23 +0100\nGuilherme <guibufolo@gmail.com> wrote:\n\n> I reported this issue on the git-user mailing list and they\n> redirected me here.\n> \n> The problem I have observed is that with a ignored path `git add\n> <single file>` behaves differently then `git add <list of files>`.\n[...]\n\nTo those who's interested the original thread on git-users is\nhttps://groups.google.com/d/topic/git-users/322tole9am8/discussion\n"},{"id":"253050","messageId":"CAMDzUtz2BiM88y6UF2h5-NHYg=tVzysyYD+feXxKNEe-LPYfSg@mail.gmail.com","threadId":"38108","inReplyTo":"20141204141100.742f32d74dbf8d65abc8c6ae@domain007.com","subject":"Re: git add <single file> and git add <list of files> behave differentely for ignored files","fromName":"Guilherme","fromEmail":"guibufolo@gmail.com","sentAt":"2014-12-04T11:49:14Z","receivedAt":"2014-12-04T11:49:14Z","isPatch":false,"sender":{"key":"guibufolo@gmail.com","avatar":null},"body":"I forgot to mention:\n\nEnvironment: Cygwin\n\nGit version 2.1.1\n\nOn Thu, Dec 4, 2014 at 12:11 PM, Konstantin Khomoutov\n<flatworm@users.sourceforge.net> wrote:\n> On Thu, 4 Dec 2014 10:06:23 +0100\n> Guilherme <guibufolo@gmail.com> wrote:\n>\n>> I reported this issue on the git-user mailing list and they\n>> redirected me here.\n>>\n>> The problem I have observed is that with a ignored path `git add\n>> <single file>` behaves differently then `git add <list of files>`.\n> [...]\n>\n> To those who's interested the original thread on git-users is\n> https://groups.google.com/d/topic/git-users/322tole9am8/discussion\n"},{"id":"253054","messageId":"5480777D.6000205@drmicha.warpmail.net","threadId":"38108","inReplyTo":"CAMDzUtzQJoEi17OfX8FPOV6SDJ_ytJSH-YTKx2DtUON35-EVSg@mail.gmail.com","subject":"Re: git add <single file> and git add <list of files> behave differentely for ignored files","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2014-12-04T15:02:21Z","receivedAt":"2014-12-04T15:02:21Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Guilherme schrieb am 04.12.2014 um 10:06:\n> Hello,\n> \n> I reported this issue on the git-user mailing list and they redirected me here.\n> \n> The problem I have observed is that with a ignored path `git add\n> <single file>` behaves differently then `git add <list of files>`.\n> \n> I my git/info/excludes file i have\n> \n> /COM/config\n> !COM/config/Project.gny\n> \n> The file COM/config/Project.gny has already been added to the\n> repository via `git add -f`.\n> \n> When doing\n> \n>     git add -- COM/config/Projec.gny\n> \n> git will not complain but when doing\n> \n>     git add -- COM/config/Project.gny otherfiles.c\n> \n> it will report:\n> \n>     The following paths are ignored by one of your .gitignore files:\n>     COM/config\n>     Use -f if you really want to add them.\n>     fatal: no files added\n\nThis is because git add assumes you specified on of the files in error,\nand thus refuses to add the other one, too.\n\nI found that behaviour surprising. There's already a patch which, in the\n2nd case, would make \"git add\" only warn you about the ignored file but\nadd the other one anyways. It will probably make its way into the next\nrelease.\n\nFor the case of a single file (or rather: ignored files only) I'm\nwondering whether we should issue a warning, too.\n\n> This odd behaviour is also present in `git check-ignore`.\n> \n> Before adding the file `git check-ignore` correctly reports the file\n> as ignored. After having added it via `git add -f` it won't report it\n> as ignored anymore.\n\nThis is different: Once a file is \"added\", it is not ignored any more -\nyou explicitely told git to track that file (rather than ignoring it).\nSo, the output of git check-ignore is correct.\n\n> Even if not a bug this behaviour is inconsistent and might want to be\n> addressed as it makes scripting a little bit harder.\n> \n> Thank you.\n> \n\nI guess you want \"git check-ignore --no-index\". That man page may be a\nbit misleading - the description sounds as if only the patterns would\nmatter.\n\nMichael\n"},{"id":"253055","messageId":"fbc5799c32357e8bff0c690ba7bc4cd46374684d.1417706481.git.git@drmicha.warpmail.net","threadId":"38108","inReplyTo":"5480777D.6000205@drmicha.warpmail.net","subject":"[PATCH] check-ignore: clarify treatment of tracked files","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2014-12-04T15:23:05Z","receivedAt":"2014-12-04T15:23:05Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"By default, check-ignore does not list tracked files at all since\nthey are not subject to ignore patterns.\n\nMake this clearer in the man page.\n\nReported-by: Guilherme <guibufolo@gmail.com>\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n---\nThat really is a bit confusing. Does this help?\n\n Documentation/git-check-ignore.txt | 3 +++\n 1 file changed, 3 insertions(+)\n\ndiff --git a/Documentation/git-check-ignore.txt b/Documentation/git-check-ignore.txt\nindex ee2e091..788a011 100644\n--- a/Documentation/git-check-ignore.txt\n+++ b/Documentation/git-check-ignore.txt\n@@ -21,6 +21,9 @@ the exclude mechanism) that decides if the pathname is excluded or\n included.  Later patterns within a file take precedence over earlier\n ones.\n \n+By default, tracked files are not shown at all since they are not\n+subject to exclude rules; but see `--no-index'.\n+\n OPTIONS\n -------\n -q, --quiet::\n-- \n2.2.0.rc3.286.g888a711\n"},{"id":"253089","messageId":"xmqqzjb3rx1u.fsf@gitster.dls.corp.google.com","threadId":"38108","inReplyTo":"fbc5799c32357e8bff0c690ba7bc4cd46374684d.1417706481.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] check-ignore: clarify treatment of tracked files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-12-04T20:15:41Z","receivedAt":"2014-12-04T20:15:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> By default, check-ignore does not list tracked files at all since\n> they are not subject to ignore patterns.\n>\n> Make this clearer in the man page.\n>\n> Reported-by: Guilherme <guibufolo@gmail.com>\n> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n> ---\n> That really is a bit confusing. Does this help?\n\nThanks.\n\n\"git check-ignore\" is a tool to debug your .gitignore settings when\nyour expectation does not match the reality, so having this new\nsentence here is a good thing to do, but I wonder if there is a more\nprominent and central place where people learn about the ignore\nmechanism the first place.  If we had this sentence there, too, that\nmay reduce the need to debug their .gitignore settings in the first\nplace.\n\nPerhaps Documentation/gitignore.txt?  Documentation/user-manual.txt?\n\n\n>\n>  Documentation/git-check-ignore.txt | 3 +++\n>  1 file changed, 3 insertions(+)\n>\n> diff --git a/Documentation/git-check-ignore.txt b/Documentation/git-check-ignore.txt\n> index ee2e091..788a011 100644\n> --- a/Documentation/git-check-ignore.txt\n> +++ b/Documentation/git-check-ignore.txt\n> @@ -21,6 +21,9 @@ the exclude mechanism) that decides if the pathname is excluded or\n>  included.  Later patterns within a file take precedence over earlier\n>  ones.\n>  \n> +By default, tracked files are not shown at all since they are not\n> +subject to exclude rules; but see `--no-index'.\n> +\n>  OPTIONS\n>  -------\n>  -q, --quiet::\n"},{"id":"253344","messageId":"5485CE14.3080207@drmicha.warpmail.net","threadId":"38108","inReplyTo":"xmqqzjb3rx1u.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] check-ignore: clarify treatment of tracked files","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2014-12-08T16:13:08Z","receivedAt":"2014-12-08T16:13:08Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano schrieb am 04.12.2014 um 21:15:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n>> By default, check-ignore does not list tracked files at all since\n>> they are not subject to ignore patterns.\n>>\n>> Make this clearer in the man page.\n>>\n>> Reported-by: Guilherme <guibufolo@gmail.com>\n>> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n>> ---\n>> That really is a bit confusing. Does this help?\n> \n> Thanks.\n> \n> \"git check-ignore\" is a tool to debug your .gitignore settings when\n> your expectation does not match the reality, so having this new\n> sentence here is a good thing to do, but I wonder if there is a more\n> prominent and central place where people learn about the ignore\n> mechanism the first place.  If we had this sentence there, too, that\n> may reduce the need to debug their .gitignore settings in the first\n> place.\n> \n> Perhaps Documentation/gitignore.txt?  Documentation/user-manual.txt?\n\ngitignore.txt has\n\nDESCRIPTION\n       A gitignore file specifies intentionally untracked files that Git\nshould ignore. Files already tracked by Git are not affected; see the\n       NOTES below for details.\n\nI doesn't get any clearer. But then the notes read:\n\nNOTES\n       The purpose of gitignore files is to ensure that certain files\nnot tracked by Git remain untracked.\n\n       To ignore uncommitted changes in a file that is already tracked,\nuse git update-index --assume-unchanged.\n\n       To stop tracking a file that is currently tracked, use git rm\n--cached.\n\nThat is again clear for our case (line 1), but line 2 is troublesome,\nisn't it?\n\nuser-manual mainly refers to gitignore. So I guess it's good, but that\nline about assume-unchanged doesn't quite match with the discussion in\nanother current thread.\n\nMichael\n"}]}