On Sep 22, 2011, at 12:59 PM, Tong Li wrote:

Hi,

> What is really the cause of the whitespace issue? How can I avoid? I followed 
> the instructions from teambox, and only send the patch to my other email 
> account, but not seeing any differences, Please shed some lights. thanks.

I use this hook to strip all whitespace before commit:

firefly ~/code/core/server $ cat ../.git/hooks/pre-commit
#!/bin/sh

if git-rev-parse --verify HEAD >/dev/null 2>&1 ; then
   against=HEAD
else
   # Initial commit: diff against an empty tree object
   against=34364693cb6d4f0f90e12dae82f48330ac74246d
fi

# Find files with trailing whitespace
for FILE in `exec git diff-index --check --cached $against -- | sed '/^[+-]/d' 
| sed -E 's/:[0-9]+:.*//' | uniq` ; do
    sed -i '' -E 's/[[:space:]]*$//' "$FILE"
    git add "$FILE"
done

I believe this strip all trailing whitespace from my code. Also I think David 
have some similar
hook for git. You can also use UNIX 'sed' to strip out all whitespaces:

sed -i '' -E 's/[[:space:]]*$//' your_path.patch

  -- Michal

> 
> Tong Li
> Emerging Technologies & Standards
> B062/K317
> [email protected]
> 
> David Lutterkort ---09/21/2011 07:32:08 PM---On Wed, 2011-09-21 at 23:29 
> +0200, Francesco Vollero wrote: > please send in a proper format the pat
> 
> From: David Lutterkort <[email protected]>
> To:   [email protected]
> Date: 09/21/2011 07:32 PM
> Subject:      Re: [PATCH] dmtf reference implementation initial checkin
> 
> 
> 
> On Wed, 2011-09-21 at 23:29 +0200, Francesco Vollero wrote:
> > please send in a proper format the patch, since seems it's a mess, in
> > this way for me is NACK.
> 
> The patch applied for me ok (there were a lot of whitespace errors, but
> that's a different issue)
> 
> David
> 
> 
> 

Reply via email to