Skip to contentSkip to conversation

cvs diff -l equivalent?

DISCUSSION Stephen R. van den Berg 5 participants 8 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

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

git diff .

But that still recurses. Any solutions without patching?

Signature · 4 lines
Sincerely,
           Stephen R. van den Berg.

How many weeks are there in a lightyear?
#1 lore raw
Quoted 5 lines · Stephen R. van den Berg

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

#2 lore raw
Quoted 10 lines · Thomas Rast
Quoted 5 lines · Stephen R. van den Berg

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.

Quoted 5 lines

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.

Signature · 4 lines
Sincerely,
           Stephen R. van den Berg.

How many weeks are there in a lightyear?
#3 lore raw
In reply to Stephen R. van den Berg

Hi,

Quoted 1 line · Stephen R. van den Berg

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?

Quoted 1 line

How many weeks are there in a lightyear?

That is easy. 52 light ones.

Ciao,
Dscho

#4 lore raw
Quoted 5 lines · Johannes Schindelin
Quoted 1 line · Stephen R. van den Berg

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.

Quoted 2 lines
Quoted 1 line

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 :-).

Signature · 2 lines
Sincerely,
           Stephen R. van den Berg.
#5 lore raw

Hi,

Quoted 7 lines · Stephen R. van den Berg
Quoted 5 lines · Johannes Schindelin
Quoted 1 line · Stephen R. van den Berg

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?

Quoted 6 lines

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

#6 lore raw
In reply to Stephen R. van den Berg

2008/7/30 Stephen R. van den Berg <[email protected]>:

Quoted 5 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.

Signature · 1 line
Mikael Magnusson
#7 lore raw
In reply to Stephen R. van den Berg
Quoted 5 lines · Stephen R. van den Berg

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