{"thread":{"id":"13043","subject":"diff-tree -r and new directories","startedAt":"2008-04-10T06:29:47Z","lastAt":"2008-04-10T07:24:59Z","messageCount":3,"participants":["Johannes Sixt","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"74017","messageId":"47FDB3DB.8020705@viscovery.net","threadId":"13043","inReplyTo":null,"subject":"diff-tree -r and new directories","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-04-10T06:29:47Z","receivedAt":"2008-04-10T06:29:47Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"In one of my scriptlets I have this:\n\n   git diff-tree -r --name-only --diff-filter=AM -z \"$rev\" HEAD --\n\nand I had assumed that only files would ever be listed because of the -r\nswitch. But this is not true: If there is a new directory, it lists only\nthe directory's name instead of the files. Is this the intent? Is it worth\nchanging?\n\n-- Hannes\n"},{"id":"74031","messageId":"7v1w5eyzeh.fsf@gitster.siamese.dyndns.org","threadId":"13043","inReplyTo":"47FDB3DB.8020705@viscovery.net","subject":"Re: diff-tree -r and new directories","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-04-10T06:52:54Z","receivedAt":"2008-04-10T06:52:54Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Sixt <j.sixt@viscovery.net> writes:\n\n> In one of my scriptlets I have this:\n>\n>    git diff-tree -r --name-only --diff-filter=AM -z \"$rev\" HEAD --\n>\n> and I had assumed that only files would ever be listed because of the -r\n> switch. But this is not true: If there is a new directory, it lists only\n> the directory's name instead of the files. Is this the intent? Is it worth\n> changing?\n\nHmm. you would need a better reproduction recipe than that.\n\n    $ git init\n    Initialized empty Git repository in .git/\n    $ >file\n    $ git add file\n    $ git commit -a -m initial\n    Created initial commit 2f9da65: initial\n     0 files changed, 0 insertions(+), 0 deletions(-)\n     create mode 100644 file\n    $ mkdir new\n    $ >new/file\n    $ git add new/file\n    $ git commit -a -m second\n    Created commit a1fa8fb: second\n     0 files changed, 0 insertions(+), 0 deletions(-)\n     create mode 100644 new/file\n    $ git diff-tree -r --name-only --diff-filter=AM -z HEAD^ HEAD |\n      tr '\\0' '\\n'\n    new/file\n    $ git diff-tree --name-only --diff-filter=AM -z HEAD^ HEAD |\n      tr '\\0' '\\n'\n    new\n\nPerhaps you somehow did not have \"-r\" even though you thought you had?\n"},{"id":"74034","messageId":"47FDC0CB.7050203@viscovery.net","threadId":"13043","inReplyTo":"7v1w5eyzeh.fsf@gitster.siamese.dyndns.org","subject":"Re: diff-tree -r and new directories","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2008-04-10T07:24:59Z","receivedAt":"2008-04-10T07:24:59Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Junio C Hamano schrieb:\n> Johannes Sixt <j.sixt@viscovery.net> writes:\n> \n>> In one of my scriptlets I have this:\n>>\n>>    git diff-tree -r --name-only --diff-filter=AM -z \"$rev\" HEAD --\n>>\n>> and I had assumed that only files would ever be listed because of the -r\n>> switch. But this is not true: If there is a new directory, it lists only\n>> the directory's name instead of the files. Is this the intent? Is it worth\n>> changing?\n> \n> Hmm. you would need a better reproduction recipe than that.\n\nHeh. It turns out that the questionable directory is actually versioned by\ngit. My scriptlets have added it as a submodule while I looked in the\nother direction:\n\n  $ git diff --summary $rev.. -- . | cat\n  create mode 160000 D/Project/foo\n\n:-) Problem solved. Thank you.\n\n-- Hannes\n"}]}