Bug 12940 - rsync: -C/--cvs-exclude does not ignore SCM ignore files (patch)
rsync: -C/--cvs-exclude does not ignore SCM ignore files (patch)
Status: NEW
Product: rsync
Classification: Unclassified
Component: core
3.1.3
All All
: P5 minor
: ---
Assigned To: Wayne Davison
Rsync QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-07-28 16:55 UTC by Austin English
Modified: 2017-07-28 16:55 UTC (History)
0 users

See Also:


Attachments
add gitignore to cvs_excludes (1.43 KB, patch)
2017-07-28 16:55 UTC, Austin English
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Austin English 2017-07-28 16:55:56 UTC
Created attachment 13436 [details]
add gitignore to cvs_excludes

Howdy,

First, thanks for the excellent rsync tool. It's been invaluable over the years!

I was recently working on a project where I wanted to rsync a copy of a git repo, and exclude SCM files. I used rsync -C, but noticed that while .git was removed, .gitignore remained.

I've written a small patch to also exclude .bzrignore, .hgignore, and .gitignore, so that bazaar, git and mercurial SCMs also have their ignore files, ignored (as they are practically useless without the other SCM files, e.g., for a tarball release).

Before:

austin@austin2:~/src/rsync$ rsync -CavPz /home/austin/src/foobar $(mktemp -d)
sending incremental file list
foobar/
foobar/.gitignore
              6 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=3/5)
foobar/README.md
             63 100%   61.52kB/s    0:00:00 (xfr#2, to-chk=2/5)
foobar/setup-flash-drive.sh
          8,119 100%    7.74MB/s    0:00:00 (xfr#3, to-chk=1/5)
foobar/setup-kit.sh
            613 100%  598.63kB/s    0:00:00 (xfr#4, to-chk=0/5)

sent 3,849 bytes  received 96 bytes  7,890.00 bytes/sec
total size is 8,801  speedup is 2.23

After:

austin@austin2:~/src/rsync$ ./rsync -CavPz /home/austin/src/foobar $(mktemp -d)
sending incremental file list
foobar/
foobar/README.md
             63 100%    0.00kB/s    0:00:00 (xfr#1, to-chk=2/4)
foobar/setup-flash-drive.sh
          8,119 100%    7.74MB/s    0:00:00 (xfr#2, to-chk=1/4)
foobar/setup-kit.sh
            613 100%  598.63kB/s    0:00:00 (xfr#3, to-chk=0/4)

sent 3,778 bytes  received 77 bytes  7,710.00 bytes/sec
total size is 8,795  speedup is 2.28

Note: I searched bugzilla and found a few other bugs that reference .gitignore, but I believe none are the same:
bug 5418/bug 10995: .gitignore is casually mentioned in a list of files in the rsync command, unrelated
bug 6120: is about a .rsyncignore file (default --exclude-from location), roughly equivalent to .gitignore
bug 9744: is about parsing git/svn/hg/bzr ignore lists and having rsync ignore THOSE files