{"thread":{"id":"12364","subject":"git diff --name-status does not always list changed files","startedAt":"2008-02-28T14:47:14Z","lastAt":"2008-02-28T22:51:08Z","messageCount":6,"participants":["Sebastian Schuberth","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"70258","messageId":"fq6hhi$cub$1@ger.gmane.org","threadId":"12364","inReplyTo":null,"subject":"git diff --name-status does not always list changed files","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2008-02-28T14:47:14Z","receivedAt":"2008-02-28T14:47:14Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"Hi,\n\nI was getting a lot of \"no newline at end of file\" warnings with GCC, so \nI decided to fix these files in my clean working tree with\n\nfor i in `find . -iname \"*.c\" -o -iname \"*.cc\" -o -iname \"*.cpp\" -o \n-iname \"*.h\" -o -iname \"*.hpp\"`; do\n     echo $i\n     echo wq | ed $i > /dev/null 2>&1\ndone\n\nAfterwards, I wanted so see a list of files that were actually affected, \nbut to my wonderment \"git diff --name-status\" did not list any files, \nalthough both \"git diff\" and \"gitk\" showed the diffs correctly.\n\nIs this a bug in \"--name-status\" that is does not detected changes if \nonly a final newline has been added, or am I missing something?\n\nThanks.\n\n-- \nSebastian Schuberth\n\n"},{"id":"70292","messageId":"7vablkkhac.fsf@gitster.siamese.dyndns.org","threadId":"12364","inReplyTo":"fq6hhi$cub$1@ger.gmane.org","subject":"Re: git diff --name-status does not always list changed files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-28T19:33:15Z","receivedAt":"2008-02-28T19:33:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Sebastian Schuberth <sschuberth@gmail.com> writes:\n\n> ...\n> so I decided to fix these files in my clean working tree with\n>\n> for i in `find . -iname \"*.c\" -o -iname \"*.cc\" -o -iname \"*.cpp\" -o\n> -iname \"*.h\" -o -iname \"*.hpp\"`; do\n>     echo $i\n>     echo wq | ed $i > /dev/null 2>&1\n> done\n>\n> Afterwards, I wanted so see a list of files that were actually\n> affected, but to my wonderment \"git diff --name-status\" did not list\n> any files, although both \"git diff\" and \"gitk\" showed the diffs\n> correctly.\n\nDoesn't reproduce for me.\n\n        $ rm -fr /var/tmp/j && mkdir -p /var/tmp/j && cd /var/tmp/j\n        $ git init\n        Initialized empty Git repository in .git/\n        $ echo -n hello > world\n        $ git add world\n        $ od -c world\n        0000000   h   e   l   l   o\n        0000005\n        $ echo wq | ed world\n        Newline appended\n        6\n        6\n        $ od -c world\n        0000000   h   e   l   l   o  \\n\n        0000006\n        $ git diff --name-status\n        M\tworld\n        $ git diff --raw\n        :100644 100644 b6fc4c6... 0000000... M\tworld\n        $ exit\n\n"},{"id":"70317","messageId":"bdca99240802281323x1ec904ddq914ac2c484e7c468@mail.gmail.com","threadId":"12364","inReplyTo":"7vablkkhac.fsf@gitster.siamese.dyndns.org","subject":"Re: git diff --name-status does not always list changed files","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2008-02-28T21:23:43Z","receivedAt":"2008-02-28T21:23:43Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":"Junio C Hamano wrote:\n\n> Doesn't reproduce for me.\n>\n>         $ rm -fr /var/tmp/j && mkdir -p /var/tmp/j && cd /var/tmp/j\n>         $ git init\n>         Initialized empty Git repository in .git/\n\nCan you reproduce it if you do\n\n$ git config core.pager \"less -F\"\n\nafter \"git init\"? The \"-F\" seems to be important, but I'm not sure why\nusing this switch causes no files to be displayed in this case.\n\n-- \nSebastian Schuberth\n"},{"id":"70318","messageId":"7vejawhi6a.fsf@gitster.siamese.dyndns.org","threadId":"12364","inReplyTo":"bdca99240802281323x1ec904ddq914ac2c484e7c468@mail.gmail.com","subject":"Re: git diff --name-status does not always list changed files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-28T21:42:21Z","receivedAt":"2008-02-28T21:42:21Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Sebastian Schuberth\" <sschuberth@gmail.com> writes:\n\n> Junio C Hamano wrote:\n>\n>> Doesn't reproduce for me.\n>>\n>>         $ rm -fr /var/tmp/j && mkdir -p /var/tmp/j && cd /var/tmp/j\n>>         $ git init\n>>         Initialized empty Git repository in .git/\n>\n> Can you reproduce it if you do\n>\n> $ git config core.pager \"less -F\"\n>\n> after \"git init\"? The \"-F\" seems to be important, but I'm not sure why\n> using this switch causes no files to be displayed in this case.\n\nThen isn't it what you are asking \"less\" to do?\n\nTry \"less -FX\".  FYI, by default, we use \"LESS=FRSX\" exported\nunless the user knows better than us and uses something of his\nown.\n"},{"id":"70325","messageId":"bdca99240802281419o3fcea2e8u277d8e5e48131b6d@mail.gmail.com","threadId":"12364","inReplyTo":"7vejawhi6a.fsf@gitster.siamese.dyndns.org","subject":"Re: git diff --name-status does not always list changed files","fromName":"Sebastian Schuberth","fromEmail":"sschuberth@gmail.com","sentAt":"2008-02-28T22:19:35Z","receivedAt":"2008-02-28T22:19:35Z","isPatch":false,"sender":{"key":"sschuberth@gmail.com","avatar":"https://avatars.githubusercontent.com/u/349154?v=4"},"body":">  > Junio C Hamano wrote:\n>  >\n>  >> Doesn't reproduce for me.\n>  >>\n>  >>         $ rm -fr /var/tmp/j && mkdir -p /var/tmp/j && cd /var/tmp/j\n>  >>         $ git init\n>  >>         Initialized empty Git repository in .git/\n>  >\n>  > Can you reproduce it if you do\n>  >\n>  > $ git config core.pager \"less -F\"\n>  >\n>  > after \"git init\"? The \"-F\" seems to be important, but I'm not sure why\n>  > using this switch causes no files to be displayed in this case.\n>\n>  Then isn't it what you are asking \"less\" to do?\n>\n>  Try \"less -FX\".  FYI, by default, we use \"LESS=FRSX\" exported\n>  unless the user knows better than us and uses something of his\n>  own.\n\nThanks, -FX works, though I do not understand why it did not with just\n-F. From what I understood, -F just makes \"less\" quit immediately\n(instead of waiting for the user to press \"q\") if the lines to display\nfit completely on screen. In no case it should display nothing if\nthere actually is something to display.\n\n-- \nSebastian Schuberth\n"},{"id":"70328","messageId":"7v63w8hezn.fsf@gitster.siamese.dyndns.org","threadId":"12364","inReplyTo":"bdca99240802281419o3fcea2e8u277d8e5e48131b6d@mail.gmail.com","subject":"Re: git diff --name-status does not always list changed files","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-02-28T22:51:08Z","receivedAt":"2008-02-28T22:51:08Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Sebastian Schuberth\" <sschuberth@gmail.com> writes:\n\n> Thanks, -FX works, though I do not understand why it did not with just\n> -F. From what I understood, -F just makes \"less\" quit immediately\n> (instead of waiting for the user to press \"q\") if the lines to display\n> fit completely on screen. In no case it should display nothing if\n> there actually is something to display.\n\nMy reading and understanding of less manual page, especially the\npart that talks about -X suggests that everything is working as\nit is meant to.\n\n\"git diff --name-status\" displays something, less shows it, and\nit quits immediately (because you asked it to with -F).  As part\nof its quitting, it clears the screen because you did not ask\nless not to do that by giving it an -X.\n\nI am tempted to call it a bug in less, but I am a very nice\nperson and I would not actually do so ;-).  But it certainly\nfeels like a misfeature between less and terminfo to me.\n\n"}]}