git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* git diff --name-status does not always list changed files
@ 2008-02-28 14:47 Sebastian Schuberth
  2008-02-28 19:33 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Schuberth @ 2008-02-28 14:47 UTC (permalink / raw)
  To: git

Hi,

I was getting a lot of "no newline at end of file" warnings with GCC, so 
I decided to fix these files in my clean working tree with

for i in `find . -iname "*.c" -o -iname "*.cc" -o -iname "*.cpp" -o 
-iname "*.h" -o -iname "*.hpp"`; do
     echo $i
     echo wq | ed $i > /dev/null 2>&1
done

Afterwards, I wanted so see a list of files that were actually affected, 
but to my wonderment "git diff --name-status" did not list any files, 
although both "git diff" and "gitk" showed the diffs correctly.

Is this a bug in "--name-status" that is does not detected changes if 
only a final newline has been added, or am I missing something?

Thanks.

-- 
Sebastian Schuberth


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git diff --name-status does not always list changed files
  2008-02-28 14:47 git diff --name-status does not always list changed files Sebastian Schuberth
@ 2008-02-28 19:33 ` Junio C Hamano
  2008-02-28 21:23   ` Sebastian Schuberth
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-02-28 19:33 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: git

Sebastian Schuberth <sschuberth@gmail.com> writes:

> ...
> so I decided to fix these files in my clean working tree with
>
> for i in `find . -iname "*.c" -o -iname "*.cc" -o -iname "*.cpp" -o
> -iname "*.h" -o -iname "*.hpp"`; do
>     echo $i
>     echo wq | ed $i > /dev/null 2>&1
> done
>
> Afterwards, I wanted so see a list of files that were actually
> affected, but to my wonderment "git diff --name-status" did not list
> any files, although both "git diff" and "gitk" showed the diffs
> correctly.

Doesn't reproduce for me.

        $ rm -fr /var/tmp/j && mkdir -p /var/tmp/j && cd /var/tmp/j
        $ git init
        Initialized empty Git repository in .git/
        $ echo -n hello > world
        $ git add world
        $ od -c world
        0000000   h   e   l   l   o
        0000005
        $ echo wq | ed world
        Newline appended
        6
        6
        $ od -c world
        0000000   h   e   l   l   o  \n
        0000006
        $ git diff --name-status
        M	world
        $ git diff --raw
        :100644 100644 b6fc4c6... 0000000... M	world
        $ exit


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git diff --name-status does not always list changed files
  2008-02-28 19:33 ` Junio C Hamano
@ 2008-02-28 21:23   ` Sebastian Schuberth
  2008-02-28 21:42     ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Schuberth @ 2008-02-28 21:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Junio C Hamano wrote:

> Doesn't reproduce for me.
>
>         $ rm -fr /var/tmp/j && mkdir -p /var/tmp/j && cd /var/tmp/j
>         $ git init
>         Initialized empty Git repository in .git/

Can you reproduce it if you do

$ git config core.pager "less -F"

after "git init"? The "-F" seems to be important, but I'm not sure why
using this switch causes no files to be displayed in this case.

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git diff --name-status does not always list changed files
  2008-02-28 21:23   ` Sebastian Schuberth
@ 2008-02-28 21:42     ` Junio C Hamano
  2008-02-28 22:19       ` Sebastian Schuberth
  0 siblings, 1 reply; 6+ messages in thread
From: Junio C Hamano @ 2008-02-28 21:42 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: git

"Sebastian Schuberth" <sschuberth@gmail.com> writes:

> Junio C Hamano wrote:
>
>> Doesn't reproduce for me.
>>
>>         $ rm -fr /var/tmp/j && mkdir -p /var/tmp/j && cd /var/tmp/j
>>         $ git init
>>         Initialized empty Git repository in .git/
>
> Can you reproduce it if you do
>
> $ git config core.pager "less -F"
>
> after "git init"? The "-F" seems to be important, but I'm not sure why
> using this switch causes no files to be displayed in this case.

Then isn't it what you are asking "less" to do?

Try "less -FX".  FYI, by default, we use "LESS=FRSX" exported
unless the user knows better than us and uses something of his
own.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git diff --name-status does not always list changed files
  2008-02-28 21:42     ` Junio C Hamano
@ 2008-02-28 22:19       ` Sebastian Schuberth
  2008-02-28 22:51         ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Sebastian Schuberth @ 2008-02-28 22:19 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

>  > Junio C Hamano wrote:
>  >
>  >> Doesn't reproduce for me.
>  >>
>  >>         $ rm -fr /var/tmp/j && mkdir -p /var/tmp/j && cd /var/tmp/j
>  >>         $ git init
>  >>         Initialized empty Git repository in .git/
>  >
>  > Can you reproduce it if you do
>  >
>  > $ git config core.pager "less -F"
>  >
>  > after "git init"? The "-F" seems to be important, but I'm not sure why
>  > using this switch causes no files to be displayed in this case.
>
>  Then isn't it what you are asking "less" to do?
>
>  Try "less -FX".  FYI, by default, we use "LESS=FRSX" exported
>  unless the user knows better than us and uses something of his
>  own.

Thanks, -FX works, though I do not understand why it did not with just
-F. From what I understood, -F just makes "less" quit immediately
(instead of waiting for the user to press "q") if the lines to display
fit completely on screen. In no case it should display nothing if
there actually is something to display.

-- 
Sebastian Schuberth

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: git diff --name-status does not always list changed files
  2008-02-28 22:19       ` Sebastian Schuberth
@ 2008-02-28 22:51         ` Junio C Hamano
  0 siblings, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2008-02-28 22:51 UTC (permalink / raw)
  To: Sebastian Schuberth; +Cc: git

"Sebastian Schuberth" <sschuberth@gmail.com> writes:

> Thanks, -FX works, though I do not understand why it did not with just
> -F. From what I understood, -F just makes "less" quit immediately
> (instead of waiting for the user to press "q") if the lines to display
> fit completely on screen. In no case it should display nothing if
> there actually is something to display.

My reading and understanding of less manual page, especially the
part that talks about -X suggests that everything is working as
it is meant to.

"git diff --name-status" displays something, less shows it, and
it quits immediately (because you asked it to with -F).  As part
of its quitting, it clears the screen because you did not ask
less not to do that by giving it an -X.

I am tempted to call it a bug in less, but I am a very nice
person and I would not actually do so ;-).  But it certainly
feels like a misfeature between less and terminfo to me.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-02-28 22:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-28 14:47 git diff --name-status does not always list changed files Sebastian Schuberth
2008-02-28 19:33 ` Junio C Hamano
2008-02-28 21:23   ` Sebastian Schuberth
2008-02-28 21:42     ` Junio C Hamano
2008-02-28 22:19       ` Sebastian Schuberth
2008-02-28 22:51         ` Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).