{"thread":{"id":"36062","subject":"Bad git log behavior with multiple glob path arguments","startedAt":"2014-03-05T05:56:20Z","lastAt":"2014-03-05T16:21:53Z","messageCount":3,"participants":["Jeremy Nickurak","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"236069","messageId":"CA+eQo_21j=GzsvWAjxzr+aFYcPcnnyozySOo0m9bO-xJq_6a9A@mail.gmail.com","threadId":"36062","inReplyTo":null,"subject":"Bad git log behavior with multiple glob path arguments","fromName":"Jeremy Nickurak","fromEmail":"jeremy@nickurak.ca","sentAt":"2014-03-05T05:56:20Z","receivedAt":"2014-03-05T05:56:20Z","isPatch":false,"sender":{"key":"jeremy@nickurak.ca","avatar":null},"body":"git log seems to understand globs in the last path argument, and the\nlast path argument only. I didn't see anything in the git log man page\nexpressly saying this was to be expected, but it does seem like it\nought to work for all the arguments or none of them.\n\nHere's a little shell script I ended up using to convince myself I\nwasn't going crazy. I'd expect the same output for all of the git log\ntest, since they all specify (either with globs or not) all the files\nadded to the repository. Alternatively, if globs aren't expected to\nwork, I'd at least expect all the glob tests to return nothing.\n\nNote that glob matching doesn't seem to occur unless '--' is included.\nI'm not exactly clear on why that is.\n\n#!/bin/sh\n\nTESTREPO=\"$(pwd)/bad-glob-test-repo\"\n\nrm  -rf \"$TESTREPO\"\n\necho \"Running tests in $TESTREPO\"\nmkdir \"$TESTREPO\"\ncd \"$TESTREPO\"\nmkdir subdira\nmkdir subdirb\nmkdir subdirc\n\ngit init\necho a > subdira/file.txt\necho b > subdirb/file.txt\necho c > subdirc/file.txt\n\ngit add subdira/file.txt\ngit commit -m 'a'\n\ngit add subdirb/file.txt\ngit commit -m 'b'\n\ngit add subdirc/file.txt\ngit commit -m 'c'\n\necho Glob Test 1: git log --oneline -- 'subdira/*.txt' 'subdirb/*.txt'\n'subdirc/*.txt'\ngit log --oneline -- 'subdira/*.txt' 'subdirb/*.txt' 'subdirc/*.txt'\n\necho Glob Test 2: git log --oneline -- 'subdira/*.txt' 'subdirc/*.txt'\n'subdirb/*.txt'\ngit log --oneline -- 'subdira/*.txt' 'subdirc/*.txt' 'subdirb/*.txt'\n\necho Glob Test 3: git log --oneline -- 'subdirb/*.txt' 'subdira/*.txt'\n'subdirc/*.txt'\ngit log --oneline -- 'subdirb/*.txt' 'subdira/*.txt' 'subdirc/*.txt'\n\necho Glob Test 4: git log --oneline -- 'subdirb/*.txt' 'subdirc/*.txt'\n'subdira/*.txt'\ngit log --oneline -- 'subdirb/*.txt' 'subdirc/*.txt' 'subdira/*.txt'\n\necho Glob Test 5: git log --oneline -- 'subdirc/*.txt' 'subdira/*.txt'\n'subdirb/*.txt'\ngit log --oneline -- 'subdirc/*.txt' 'subdira/*.txt' 'subdirb/*.txt'\n\necho Glob Test 6: git log --oneline -- 'subdirc/*.txt' 'subdirb/*.txt'\n'subdira/*.txt'\ngit log --oneline -- 'subdirc/*.txt' 'subdirb/*.txt' 'subdira/*.txt'\n\necho Explicit Test 1: git log --oneline -- 'subdira/file.txt'\n'subdirb/file.txt' 'subdirc/file.txt'\ngit log --oneline -- 'subdira/file.txt' 'subdirb/file.txt' 'subdirc/file.txt'\n\necho Explicit Test 2: git log --oneline -- 'subdira/file.txt'\n'subdirc/file.txt' 'subdirb/file.txt'\ngit log --oneline -- 'subdira/file.txt' 'subdirc/file.txt' 'subdirb/file.txt'\n\necho Explicit Test 3: git log --oneline -- 'subdirb/file.txt'\n'subdira/file.txt' 'subdirc/file.txt'\ngit log --oneline -- 'subdirb/file.txt' 'subdira/file.txt' 'subdirc/file.txt'\n\necho Explicit Test 4: git log --oneline -- 'subdirb/file.txt'\n'subdirc/file.txt' 'subdira/file.txt'\ngit log --oneline -- 'subdirb/file.txt' 'subdirc/file.txt' 'subdira/file.txt'\n\necho Explicit Test 5: git log --oneline -- 'subdirc/file.txt'\n'subdira/file.txt' 'subdirb/file.txt'\ngit log --oneline -- 'subdirc/file.txt' 'subdira/file.txt' 'subdirb/file.txt'\n\necho Explicit Test 6: git log --oneline -- 'subdirc/file.txt'\n'subdirb/file.txt' 'subdira/file.txt'\ngit log --oneline -- 'subdirc/file.txt' 'subdirb/file.txt' 'subdira/file.txt'\n\n-- \nJeremy Nickurak -= Email/XMPP: -= jeremy@nickurak.ca =-\n"},{"id":"236081","messageId":"CACsJy8A28x5m1SLV-R=QrFniPXUbV+x9N27GA-j+Ut_oe_6oGQ@mail.gmail.com","threadId":"36062","inReplyTo":"CA+eQo_21j=GzsvWAjxzr+aFYcPcnnyozySOo0m9bO-xJq_6a9A@mail.gmail.com","subject":"Re: Bad git log behavior with multiple glob path arguments","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2014-03-05T10:01:17Z","receivedAt":"2014-03-05T10:01:17Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, Mar 5, 2014 at 12:56 PM, Jeremy Nickurak <jeremy@nickurak.ca> wrote:\n> git log seems to understand globs in the last path argument, and the\n> last path argument only. I didn't see anything in the git log man page\n> expressly saying this was to be expected, but it does seem like it\n> ought to work for all the arguments or none of them.\n\nWhat version did you use? We have a fix in the same area,\ne4ddb05 (tree_entry_interesting: match against all pathspecs -\n2014-01-25), and it's in v1.8.5.5 and v1.9.0\n\n> Here's a little shell script I ended up using to convince myself I\n> wasn't going crazy. I'd expect the same output for all of the git log\n> test, since they all specify (either with globs or not) all the files\n> added to the repository. Alternatively, if globs aren't expected to\n> work, I'd at least expect all the glob tests to return nothing.\n>\n> Note that glob matching doesn't seem to occur unless '--' is included.\n\ndo you mean \"git log\" does not run at all and complains about\ndisambiguation, or it runs but nothing is filtered?\n\n> I'm not exactly clear on why that is.\n>\n> #!/bin/sh\n>\n> TESTREPO=\"$(pwd)/bad-glob-test-repo\"\n>\n> rm  -rf \"$TESTREPO\"\n>\n> echo \"Running tests in $TESTREPO\"\n> mkdir \"$TESTREPO\"\n> cd \"$TESTREPO\"\n> mkdir subdira\n> mkdir subdirb\n> mkdir subdirc\n>\n> git init\n> echo a > subdira/file.txt\n> echo b > subdirb/file.txt\n> echo c > subdirc/file.txt\n>\n> git add subdira/file.txt\n> git commit -m 'a'\n>\n> git add subdirb/file.txt\n> git commit -m 'b'\n>\n> git add subdirc/file.txt\n> git commit -m 'c'\n>\n> echo Glob Test 1: git log --oneline -- 'subdira/*.txt' 'subdirb/*.txt'\n> 'subdirc/*.txt'\n> git log --oneline -- 'subdira/*.txt' 'subdirb/*.txt' 'subdirc/*.txt'\n>\n> echo Glob Test 2: git log --oneline -- 'subdira/*.txt' 'subdirc/*.txt'\n> 'subdirb/*.txt'\n> git log --oneline -- 'subdira/*.txt' 'subdirc/*.txt' 'subdirb/*.txt'\n>\n> echo Glob Test 3: git log --oneline -- 'subdirb/*.txt' 'subdira/*.txt'\n> 'subdirc/*.txt'\n> git log --oneline -- 'subdirb/*.txt' 'subdira/*.txt' 'subdirc/*.txt'\n>\n> echo Glob Test 4: git log --oneline -- 'subdirb/*.txt' 'subdirc/*.txt'\n> 'subdira/*.txt'\n> git log --oneline -- 'subdirb/*.txt' 'subdirc/*.txt' 'subdira/*.txt'\n>\n> echo Glob Test 5: git log --oneline -- 'subdirc/*.txt' 'subdira/*.txt'\n> 'subdirb/*.txt'\n> git log --oneline -- 'subdirc/*.txt' 'subdira/*.txt' 'subdirb/*.txt'\n>\n> echo Glob Test 6: git log --oneline -- 'subdirc/*.txt' 'subdirb/*.txt'\n> 'subdira/*.txt'\n> git log --oneline -- 'subdirc/*.txt' 'subdirb/*.txt' 'subdira/*.txt'\n>\n> echo Explicit Test 1: git log --oneline -- 'subdira/file.txt'\n> 'subdirb/file.txt' 'subdirc/file.txt'\n> git log --oneline -- 'subdira/file.txt' 'subdirb/file.txt' 'subdirc/file.txt'\n>\n> echo Explicit Test 2: git log --oneline -- 'subdira/file.txt'\n> 'subdirc/file.txt' 'subdirb/file.txt'\n> git log --oneline -- 'subdira/file.txt' 'subdirc/file.txt' 'subdirb/file.txt'\n>\n> echo Explicit Test 3: git log --oneline -- 'subdirb/file.txt'\n> 'subdira/file.txt' 'subdirc/file.txt'\n> git log --oneline -- 'subdirb/file.txt' 'subdira/file.txt' 'subdirc/file.txt'\n>\n> echo Explicit Test 4: git log --oneline -- 'subdirb/file.txt'\n> 'subdirc/file.txt' 'subdira/file.txt'\n> git log --oneline -- 'subdirb/file.txt' 'subdirc/file.txt' 'subdira/file.txt'\n>\n> echo Explicit Test 5: git log --oneline -- 'subdirc/file.txt'\n> 'subdira/file.txt' 'subdirb/file.txt'\n> git log --oneline -- 'subdirc/file.txt' 'subdira/file.txt' 'subdirb/file.txt'\n>\n> echo Explicit Test 6: git log --oneline -- 'subdirc/file.txt'\n> 'subdirb/file.txt' 'subdira/file.txt'\n> git log --oneline -- 'subdirc/file.txt' 'subdirb/file.txt' 'subdira/file.txt'\n>\n> --\n> Jeremy Nickurak -= Email/XMPP: -= jeremy@nickurak.ca =-\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n\n\n-- \nDuy\n"},{"id":"236090","messageId":"CA+eQo_2Gcipe7VA7WMY+etULjmSC=TqGmpZmGSGeWv03c93FDA@mail.gmail.com","threadId":"36062","inReplyTo":"CACsJy8A28x5m1SLV-R=QrFniPXUbV+x9N27GA-j+Ut_oe_6oGQ@mail.gmail.com","subject":"Re: Bad git log behavior with multiple glob path arguments","fromName":"Jeremy Nickurak","fromEmail":"jeremy@nickurak.ca","sentAt":"2014-03-05T16:21:53Z","receivedAt":"2014-03-05T16:21:53Z","isPatch":false,"sender":{"key":"jeremy@nickurak.ca","avatar":null},"body":"On Wed, Mar 5, 2014 at 3:01 AM, Duy Nguyen <pclouds@gmail.com> wrote:\n> On Wed, Mar 5, 2014 at 12:56 PM, Jeremy Nickurak <jeremy@nickurak.ca> wrote:\n>> git log seems to understand globs in the last path argument, and the\n>> last path argument only. I didn't see anything in the git log man page\n>> expressly saying this was to be expected, but it does seem like it\n>> ought to work for all the arguments or none of them.\n>\n> What version did you use? We have a fix in the same area,\n> e4ddb05 (tree_entry_interesting: match against all pathspecs -\n> 2014-01-25), and it's in v1.8.5.5 and v1.9.0\n\nSo close! :) 1.8.5.3\n\n>> Note that glob matching doesn't seem to occur unless '--' is included.\n>\n> do you mean \"git log\" does not run at all and complains about\n> disambiguation, or it runs but nothing is filtered?\n\nIt complains about disambiguation:\n\n$ mkdir -p ~/tmp; cd ~/tmp; git init; echo hello > hello.txt; git add\nhello.txt; git commit -m hello; echo \"Without --:\"; git log --oneline\n'*.txt'; echo \"With --:\"; git log --oneline -- '*.txt';\nReinitialized existing Git repository in /home/nickuj/tmp/.git/\nOn branch master\nnothing to commit, working directory clean\nWithout --:\nfatal: ambiguous argument '*.txt': unknown revision or path not in the\nworking tree.\nUse '--' to separate paths from revisions, like this:\n'git <command> [<revision>...] -- [<file>...]'\nWith --:\n78ff378 hello\n"}]}