info-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: How to format source code on commit


From: Matt Doar
Subject: RE: How to format source code on commit
Date: Tue, 9 Nov 2004 08:47:07 -0800

This works for me with indent on C source. It is a little disturbing to
commit a file and then have emacs tell you the file has changed, because
it was reindented.

CVSROOT/commitinfo:
# Automatic indentation of C source files, only .c and .h
# 
^module1/* /home/cvs/CVSROOT/indenter

CVSROOT/indenter (and chmod +x):
#!/bin/bash

# Control how indent is run
flags='-nbad
-bap
-nbc
-bbo
-bl
-bli0
-bls
-ncdb
-nce
-cli4
-cp1
-cs
-di2
-ndj
-nfc1
-nfca
-hnl
-i4
-ip4
-lp
-pcs
-nprs
-psl
-saf
-sai
-saw
-nsc
-nsob
-ts4
-nut'

VERSION_CONTROL=none
export VERSION_CONTROL

for f in $*; do
        case "$f" in
        *.c|*.h) 
                echo "Indenting $f..." 
                indent -npro $flags "$f" || exit 1
                ;;
        esac
done

CVSROOT/checkoutlist:
indenter

~Matt

> -----Original Message-----
> From: address@hidden 
> [mailto:address@hidden 
> On Behalf Of NewsBirdie
> Sent: Tuesday, November 09, 2004 7:05 AM
> To: address@hidden
> Subject: How to format source code on commit
> 
> Our merges aren't working because of source code formatting issues and
> I'd like to set up CVS to format the source before all commits.  We
> currently use an open source java tool (available via command line)
> called Jalopy.  Can anyone point me to some documentation and/or
> examples of how to perform a command with each commit?
> 
> Thanks,
> Michael
> _______________________________________________
> Info-cvs mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/info-cvs
> 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]