[cmake-developers] git doesn't let me push: bad whitespace at end of line

Eric Noulard eric.noulard at gmail.com
Sat May 1 10:49:01 EDT 2010


2010/5/1 Alexander Neundorf <neundorf at kde.org>:
> Hi,
>
> I tried to push a commit to master, but this failed because git complained
> that the patch adds a trailing whitespace in one line.
> So I removed this whitespace and committed this.
> But git still doesn't push, I guess because the commit which adds the
> whitespace is still there:

I did have that trouble once.

What I did was:
     1) save a diff between offending commit and the current tree.
         git diff <commitid-ok> HEAD > put-aside.patch

     2) reset the clone to commit-ok
         git reset --hard commitid-ok

     3) apply the put aside patch

     4) fix the offending space

     5) commit

     6) push

This may not be the most easiest way to do it but it worked for.
I would be glad to know 'the definitive right way to do it'...


>
> hammer:~/src/CMake/CMake-git$ git push
> Counting objects: 21, done.
> Delta compression using up to 4 threads.
> Compressing objects: 100% (14/14), done.
> Writing objects: 100% (14/14), 18.13 KiB, done.
> Total 14 (delta 11), reused 0 (delta 0)
> ------------------------------------------------------------------------------
> commit 7ba853c4 adds bad whitespace:
> Source/cmLocalGenerator.cxx:1273: trailing whitespace.
> +    if(this->Makefile->IsOn("APPLE")
>
> ------------------------------------------------------------------------------
> error: hook declined to update refs/heads/master
> To git at cmake.org:cmake.git
>  ! [remote rejected] master -> master (hook declined)
> error: failed to push some refs to 'git at cmake.org:cmake.git'
> hammer:~/src/CMake/CMake-git$
>
>
> What should I do ?
> Get a fresh clone, apply the patch, remove the trailing whitespace, commit,
> then push ?
> (would be quite a lot of work for removing one space...)
>
> Alex
> _______________________________________________
> cmake-developers mailing list
> cmake-developers at cmake.org
> http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
>



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org



More information about the cmake-developers mailing list