threads / discuss / 14754

cvs diff -l equivalent?

Subject: cvs diff -l equivalent?

## tl;dr

8 messages between Jul 30, 2008 and Jul 30, 2008.

replies: 7people: 5as markdown or json

Stephen R. van den Berg· Jul 30, 2008, 08:20 UTC · lore
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· Jul 30, 2008, 13:53 UTC · re: Stephen R. van den Berg · lore

Re: cvs diff -l equivalent?

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

Stephen R. van den Berg· Jul 30, 2008, 15:58 UTC · re: Johannes Schindelin · lore

Re: cvs diff -l equivalent?

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.
Johannes Schindelin· Jul 30, 2008, 18:18 UTC · re: Stephen R. van den Berg · lore

Re: cvs diff -l equivalent?

Hi,
On Wed, 30 Jul 2008, Stephen R. van den Berg wrote:
Show 13 quoted lines
> 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

Thomas Rast· Jul 30, 2008, 14:00 UTC · re: Stephen R. van den Berg · lore

Re: cvs diff -l equivalent?

Stephen R. van den Berg wrote:
Show 5 quoted lines
> 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· Jul 30, 2008, 16:17 UTC · re: Thomas Rast · lore

Re: cvs diff -l equivalent?

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?
Mikael Magnusson· Jul 30, 2008, 20:57 UTC · re: Stephen R. van den Berg · lore

Re: cvs diff -l equivalent?

2008/7/30 Stephen R. van den Berg <srb@cuci.nl>:
Show 5 quoted lines
> 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· Jul 30, 2008, 21:25 UTC · re: Stephen R. van den Berg · lore

Re: cvs diff -l equivalent?

On Wed, 30 Jul 2008, Stephen R. van den Berg wrote:
Show 5 quoted lines
> 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

← back to recent threads