{"thread":{"id":"30360","subject":"Bug (or inconsistency) in git add","startedAt":"2012-04-30T04:03:25Z","lastAt":"2012-04-30T07:02:28Z","messageCount":3,"participants":["Steve Bennett","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"190272","messageId":"CADJEhEVNPj_FrRatjD7Jmbd7i_FYg9BzNNP48_4VAr6fgqBT8Q@mail.gmail.com","threadId":"30360","inReplyTo":"CADJEhEWC=mMManxi9Q6W9EvVKmTV=i1ZxbdW4QS_ou_DrBEb+Q@mail.gmail.com","subject":"Bug (or inconsistency) in git add","fromName":"Steve Bennett","fromEmail":"stevage@gmail.com","sentAt":"2012-04-30T04:03:25Z","receivedAt":"2012-04-30T04:03:25Z","isPatch":false,"sender":{"key":"stevage@gmail.com","avatar":null},"body":"I couldn't find a bug tracker for Git, so here's my bug report.\n\nGiven a directory containing foo/bar/baz/blah.py and\nfoo/bar/baz/blem.py, this command:\n1)\ngit add foo/**/*.py\n\nproduces no output, and adds no files.\n\nThis command:\n2)\ngit add /**.py\n\nproduces no output but adds all the files.\n\nThis command:\n3)\ngit add foo/**.py\n\nproduces an error and adds no files.\n\nIMHO, \"git add\" should always produce an error message if no files\nmatched the pathspec given. So case 1) should produce an error\nmessage.\n\ngit version 1.7.9.4 on Snow Leopard. (There doesn't seem to be a\n1.7.10 at http://code.google.com/p/git-osx-installer/downloads/list?can=3)\n\nIf this is some weird bash shell behaviour, my apologies.\n\nSteve\n"},{"id":"190280","messageId":"CADJEhEXtDZGav1Y5epZQ69NWptyVyPC1hmN6=YaNYrg3vYmBqg@mail.gmail.com","threadId":"30360","inReplyTo":"CAA5Ydx9h6o=uppRk5zc9V4z1S831KGVRBzTw9oMqDjY34-noOw@mail.gmail.com","subject":"Re: Bug (or inconsistency) in git add","fromName":"Steve Bennett","fromEmail":"stevage@gmail.com","sentAt":"2012-04-30T06:46:20Z","receivedAt":"2012-04-30T06:46:20Z","isPatch":false,"sender":{"key":"stevage@gmail.com","avatar":null},"body":"On 30 April 2012 16:23, Victor Engmark <victor.engmark@gmail.com> wrote:\n> I can't answer for the absence of an error when no files are added, but\n> globbing (resolving * in paths) is done by the shell, not by git. To verify\n> a glob, just echo it:\n>\n> echo foo/**/*.py\n\nYes, it appears that the two cases are treated differently:\n1) foo/**/*.py:  the shell expands the **, and interprets it the same\nas \"*\",  so foo/**/*.py means any python file exactly one directory\ndeeper than foo\n2) /**.py: the shell ignores this and passes it straight to Git.\n\nSo I guess the missing error message I reported originally is\nlogically correct in a kind of convoluted way: the ** is actually\nmatching real files (just not the ones you expected) and they don't\nhave any changes, so you don't get any output.\n\n(Whether or not it makes sense for Git to produce identical output in\nthe case of both adding files with changes, and doing nothing at all,\nis a debate I probably shouldn't start...)\n\n> If you want to add recursively, you'll need to enable the special behavior\n> for double stars:\n>\n> shopt -s globstar\n\nLooks like I need a newer version of Bash.\n\nIn any case, it looks like Git does support some ** globbing natively.\nI'm curious about the rules for that. They don't seem to be documented\nin the git man page (http://schacon.github.com/git/user-manual.html).\n\nSteve\n"},{"id":"190282","messageId":"7vwr4xhfcr.fsf@alter.siamese.dyndns.org","threadId":"30360","inReplyTo":"CADJEhEXtDZGav1Y5epZQ69NWptyVyPC1hmN6=YaNYrg3vYmBqg@mail.gmail.com","subject":"Re: Bug (or inconsistency) in git add","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-04-30T07:02:28Z","receivedAt":"2012-04-30T07:02:28Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Steve Bennett <stevage@gmail.com> writes:\n\n> In any case, it looks like Git does support some ** globbing natively.\n\nNo, we don't.\n"}]}