# cvs diff -l equivalent?

8 messages from 2008-07-30 to 2008-07-30. Participants: Stephen R. van den Berg, Johannes Schindelin, Thomas Rast, Mikael Magnusson, Linus Torvalds.
Thread: https://gitlist.dev/t/14754

## Stephen R. van den Berg, 2008-07-30 08:20

Subject: cvs diff -l equivalent?
Message-ID: <20080730082030.GA12555@cuci.nl>
URL: https://gitlist.dev/e/20080730082030.GA12555%40cuci.nl

```
Someone popped this question on me.  The closest I got was:

   git diff .

But that still recurses.  Any solutions without patching?
-- 
Sincerely,
           Stephen R. van den Berg.

How many weeks are there in a lightyear?

```

## Johannes Schindelin, 2008-07-30 13:53

Subject: Re: cvs diff -l equivalent?
Message-ID: <alpine.LSU.1.00.0807301553030.3486@wbgn129.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0807301553030.3486%40wbgn129.biozentrum.uni-wuerzburg.de
In-Reply-To: <20080730082030.GA12555@cuci.nl>

```
Hi,

On Wed, 30 Jul 2008, Stephen R. van den Berg wrote:

> Someone popped this question on me.

I do not know cvs that well anymore.  So I do not know what -l does.  Care 
to explain?

> How many weeks are there in a lightyear?

That is easy.  52 light ones.

Ciao,
Dscho

```

## Thomas Rast, 2008-07-30 14:00

Subject: Re: cvs diff -l equivalent?
Message-ID: <200807301600.44205.trast@student.ethz.ch>
URL: https://gitlist.dev/e/200807301600.44205.trast%40student.ethz.ch
In-Reply-To: <20080730082030.GA12555@cuci.nl>

```
Stephen R. van den Berg wrote:
> Someone popped this question on me.  The closest I got was:
> 
>    git diff .
> 
> But that still recurses.  Any solutions without patching?

Maybe a scripted version?  For just 'git diff .', this should work:

  git diff $(git ls-files . | grep -v /)

That will still do the wrong thing if you diff against an older commit
with a different list of files.  In that case you need the list of
files in the other side of the diff too:

  git diff HEAD^..  -- $(git ls-files . | grep -v /; git ls-tree HEAD^ | cut -f2)


- Thomas


```

## Stephen R. van den Berg, 2008-07-30 15:58

Subject: Re: cvs diff -l equivalent?
Message-ID: <20080730155853.GA27166@cuci.nl>
URL: https://gitlist.dev/e/20080730155853.GA27166%40cuci.nl
In-Reply-To: <alpine.LSU.1.00.0807301553030.3486@wbgn129.biozentrum.uni-wuerzburg.de>

```
Johannes Schindelin wrote:
>On Wed, 30 Jul 2008, Stephen R. van den Berg wrote:
>> Someone popped this question on me.

>I do not know cvs that well anymore.  So I do not know what -l does.  Care 
>to explain?

Usage: cvs diff [-lR] [-k kopt] [format_options]
    [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files...]
        -l      Local directory only, not recursive

It shows the diff for all files in the current directory, nothing
deeper, nothing higher.

>> How many weeks are there in a lightyear?
>That is easy.  52 light ones.

I presume you mean "lightweeks", and yes, that would probably fit the bill :-).
-- 
Sincerely,
           Stephen R. van den Berg.

```

## Stephen R. van den Berg, 2008-07-30 16:17

Subject: Re: cvs diff -l equivalent?
Message-ID: <20080730161714.GC27166@cuci.nl>
URL: https://gitlist.dev/e/20080730161714.GC27166%40cuci.nl
In-Reply-To: <200807301600.44205.trast@student.ethz.ch>

```
Thomas Rast wrote:
>Stephen R. van den Berg wrote:
>> Someone popped this question on me.  The closest I got was:

>>    git diff .

>> But that still recurses.  Any solutions without patching?

>Maybe a scripted version?  For just 'git diff .', this should work:

>  git diff $(git ls-files . | grep -v /)

git diff $(git ls-files --exclude-standard . | fgrep -v /)

comes the closest, so it seems.

>That will still do the wrong thing if you diff against an older commit
>with a different list of files.  In that case you need the list of
>files in the other side of the diff too:

>  git diff HEAD^..  -- $(git ls-files . | grep -v /; git ls-tree HEAD^ | cut -f2)

This doesn't seem to do the right thing, it messes up with which commit we
diff.
-- 
Sincerely,
           Stephen R. van den Berg.

How many weeks are there in a lightyear?

```

## Johannes Schindelin, 2008-07-30 18:18

Subject: Re: cvs diff -l equivalent?
Message-ID: <alpine.LSU.1.00.0807302016160.3486@wbgn129.biozentrum.uni-wuerzburg.de>
URL: https://gitlist.dev/e/alpine.LSU.1.00.0807302016160.3486%40wbgn129.biozentrum.uni-wuerzburg.de
In-Reply-To: <20080730155853.GA27166@cuci.nl>

```
Hi,

On Wed, 30 Jul 2008, Stephen R. van den Berg wrote:

> Johannes Schindelin wrote:
> >On Wed, 30 Jul 2008, Stephen R. van den Berg wrote:
> >> Someone popped this question on me.
> 
> >I do not know cvs that well anymore.  So I do not know what -l does.  Care 
> >to explain?
> 
> Usage: cvs diff [-lR] [-k kopt] [format_options]
>     [[-r rev1 | -D date1] [-r rev2 | -D date2]] [files...]
>         -l      Local directory only, not recursive
> 
> It shows the diff for all files in the current directory, nothing
> deeper, nothing higher.

Okay.  This is my version of a solution:

	$ find . -maxdepth 1 -type f -print0 | xargs -0 git diff

And no, there is not an easier way.  Probably since Git has a snapshot 
based idea of the contents, i.e. it does not think that the files in a 
revision are decoupled.  Not even the ones in different directories.

Ciao,
Dscho

```

## Mikael Magnusson, 2008-07-30 20:57

Subject: Re: cvs diff -l equivalent?
Message-ID: <237967ef0807301357l60dfb5b7y63a357c4b5c2c23@mail.gmail.com>
URL: https://gitlist.dev/e/237967ef0807301357l60dfb5b7y63a357c4b5c2c23%40mail.gmail.com
In-Reply-To: <20080730082030.GA12555@cuci.nl>

```
2008/7/30 Stephen R. van den Berg <srb@cuci.nl>:
> Someone popped this question on me.  The closest I got was:
>
>   git diff .
>
> But that still recurses.  Any solutions without patching?

Another option than the ones suggested:
git diff|filterdiff -x '*/*/*'

filterdiff is available from the "patchutils" package.

-- 
Mikael Magnusson

```

## Linus Torvalds, 2008-07-30 21:25

Subject: Re: cvs diff -l equivalent?
Message-ID: <alpine.LFD.1.10.0807301424271.3277@nehalem.linux-foundation.org>
URL: https://gitlist.dev/e/alpine.LFD.1.10.0807301424271.3277%40nehalem.linux-foundation.org
In-Reply-To: <20080730082030.GA12555@cuci.nl>

```


On Wed, 30 Jul 2008, Stephen R. van den Berg wrote:

> Someone popped this question on me.  The closest I got was:
> 
>    git diff .
> 
> But that still recurses.  Any solutions without patching?

Not without patching, no. When generating a patch, git diff always 
recurses.

I suspect adding some kind of "-l" flag would be about five lines of code, 
though, so if you really need it... Hint, hint.

		Linus

```
