Public bug reported:

If diff is aliased to colordiff as suggested, then:

$ diff -aur | grep -v "^Only" > file.diff

produces a broken patch.

colordiff should be as smart as "git diff", that is, if the output is a
tty, then use a pager and color, if not, then don't use color.

The attached patch does this.

Several improvements are possible:

1) Use "less -r" by default and if that fails just warn and keep STDOUT as-is.
2) Add an option like in grep:

    --color[=WHEN],
      --colour[=WHEN]       use markers to highlight the matching strings;
                            WHEN is `always', `never', or `auto'
(the default is 'auto')

3) Integrate colordiff in GNU diff re-using the code used in grep.

ProblemType: Bug
DistroRelease: Ubuntu 12.04
Package: colordiff 1.0.9-1 [modified: usr/bin/colordiff]
ProcVersionSignature: Ubuntu 3.2.0-39.62-generic-pae 3.2.39
Uname: Linux 3.2.0-39-generic-pae i686
NonfreeKernelModules: fglrx
ApportVersion: 2.0.1-0ubuntu17.1
Architecture: i386
Date: Fri Mar 29 11:54:01 2013
EcryptfsInUse: Yes
InstallationMedia: Kubuntu 12.04 LTS "Precise Pangolin" - Release i386 
(20120423)
MarkForUpload: True
PackageArchitecture: all
SourcePackage: colordiff
UpgradeStatus: No upgrade log present (probably fresh install)

** Affects: colordiff (Ubuntu)
     Importance: Undecided
         Status: New

** Affects: colordiff (Debian)
     Importance: Undecided
         Status: New


** Tags: apport-bug i386 precise

** Patch added: "patch for smarter enable/disable of color and use of pager"
   
https://bugs.launchpad.net/bugs/1161826/+attachment/3606034/+files/smartcolordiff.diff

** Also affects: colordiff (Debian)
   Importance: Undecided
       Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1161826

Title:
  smarter handling of redirections

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/colordiff/+bug/1161826/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to