How to get diff to NOT follow symlinks? - diff

I'm using diff to compare two huge volumes, and it is actually comparing many symlinked files over and over.
Is there some way to stop this? I want it to just compare the link itself; not follow it.
Or is there an alternate app that has this option?

There is an argument --no-dereference which is not mentioned in the man page
but listed by diff --help.
diff -r --no-dereference dir1 dir2

Related

How to compare files between two svn revisions in VS code?

I know you can code --diff file1 file2 to use the compare tool in VS code, but is it possible to compare two different svn revisions of a file?
I'd like to be able to combine svn diff -r 111:222 file1 with code --diff ....
Now svn diff would only give me a diff file so it's not enough to compare the whole files in VS code.
I guess I could checkout both revisions of that file and code --diff those, but ideally I'd like to do this without the checkout since I'd do this frequently.
I believe that the following command will help:
svn diff -r1000:1001 https://demo-server.visualsvn.com/asf/ --diff-cmd code -x "--wait --diff"
You may need to adjust the command line to your needs. Note that the URL is unnecessary if you run svn diff in a working copy. See the following pages for more information:
SVNBook | svn diff
SVNBook | Using External Differencing and Merge Tools
I've just tried the above command and it opens SVN diff in VSCode.
PS I see the following warning in the command-line output, but I'm unsure of its meaning:
Warning: 'L' is not in the list of known options, but still passed to
Electron/Chromium.

ClearCase equivalent of git status

With git (and other revision control apps like mercurial), you have a "status" functionality for a repository, which lists the repo files which are Modified, Deleted, Moved, Added or Missing.
How do we achieve the same in ClearCase (relative to the non-checked-out version chosen by the configspec currently in effect)?
The best I have so far is listing the files with modifications using ct diff and grep'ping for ---'s.
Anything related to file status is usually managed by cleartool ls
cleartool ls -r -l -vis
You can also add --view-only to restricts the listing to objects that belong logically to the view: view-private files, view-private directories, and view-private links; checked-out versions; and all derived objects visible in the view.
But I suspect some kind of post-processing (grep/awk) will be needed to get exactly what you want.
You have an example in bmpenuelas/gfcc
gfcc status
clearcase actions: List all new or modified files.
cleartool ls -rec -view_only to get new files.
cleartool lsco -cview -a -s to get all the checked out files, then find those which have been actually modified with cleartool diff -predecessor.
So a better git status equivalent is, according to this project, a bit more involved.

In darcs, how to view only the names of changed files

The command $ darcs whatsnew lists unrecorded changes in the working tree. However, often the full list of changes is too cluttered to see in one screen which files have changed.
How can I list only the names of changed files?
In git I do this via $ git diff --name-only.
darcs whatsnew -ls should work I think

Perforce - How to get the list of files that have been modified locally?

I am looking for a perforce command to get the list of the files that have been modified locally and "not" checked-in to the repository.
I understand that I "should" get the list of modified files in Pending changelist, but there are scenarios when I don't get to see a modified file in that list. And then on "manually" checking out a file and doing a diff i realize the difference.
Is there any command that could check all the files in a given folder and provide me a list of files that are not same as there state in the repository?
I tried "p4 sync", but that did not work.
Thanks for your interest.
Try
p4 diff -f -sa
(see manual for further details)
I use "p4 revert -n ./..."
where
-n
List the files that would be reverted without actually performing the revert.
This lets you make sure the revert does what you think it does before actually reverting the files.
In the recent versions of Perforce, try "p4 reconcile -e"
see: http://www.perforce.com/perforce/r12.1/manuals/cmdref/reconcile.html
It certainly takes its time though (not very fast).
I think, the modified files are submitted locallay (Otherwise, p4 opened ./... will help to find)
If files are already submitted to local perforce and still want to know which all are modified..
p4 changes -m 5 ./... (Should give changes lists)
p4 integrate -n ./... //server/code/base/... (This should list the files to be integrated to mainline.

Cygwin diff won't exclude files if a directory is included in the pattern

I need to do a recursive diff using cygwin that needs do exclude all .xml files from certain directories, but not from other directories. According to the --help option I should be able to do this with with the --exclude=PAT option where PAT is a pattern describing the files I want to exclude from the diff.
If I do this:
diff -rw --exclude="classes/Services.xml"
the diff does not ignore the Services.xml file in the classes directory. If I do this
diff -rw --exclude="Services.xml"
the diff does ignore the Services.xml file in all directories.
I need to do something like this:
diff -rw --exclude="*/generated/resources/client/*.xml"
to ignore all .xml files in the directory */generated/resources/client/.
Whenever I add path information to the --exclude pattern cygwin does not ignore the file(s) I've specified in the pattern.
Is there some way to make cygwin diff recognize a pattern that identifies certain files in certain directories? It seems to not be able to handle any directory information at all.
I ended up having to write a Java utility that walks the directory tree, excluding certain directories, and calls diff on each level.
Use find with an approprite expression. Assuming your trees are in tree1/ and tree2/, then
$ find tree1 -type f ! -path '*classes/Services.xml' |
while read f; do diff -rw "$f" "tree2${f#tree1}"; done
Hmmm, as it stands this misses files in tree2/ that do not exist in tree1/.