[vtk-developers] New to Gitlab - pre-commit hook failure when trying to commit new files

Jon Garner thehappydog84 at gmail.com
Thu Jan 12 00:31:21 EST 2017


Ahhh...  I should have emailed this last night, I don't think I would have
figured that out.  This is my first time doing really anything with any
type of project (open source or otherwise), so thank you very much.

On Thu, Jan 12, 2017 at 12:16 AM, David Gobbi <david.gobbi at gmail.com> wrote:

> Hi Jon,
>
> Welcome to git (and VTK).  When the commit hook says "tab in indent," it
> is disallowing the commit because your code contains tab characters.  In
> other words, you tried to commit, but it refused.
>
> The "no tabs" rule is part of the basic "no changes should be invisible"
> guideline for code revision control.  Let's say that you edited a file that
> was already in the repository, converted some of the 4-space indents to tab
> characters, and then pushed it back to the repository.  To you, the code
> would look exactly the same, that is, the changes would be invisible to
> you.  But the git revision log would show that a change had occurred.
> Also, to other developers who had their editor set to a 2-space (or
> 8-space) tabstop, the code would look very different.
>
> Your editor (assuming that it is a code editor and not a simple text
> editor) will have an option to convert tabs to spaces when you save the
> file.
>
> "Traling whitespace" or extra spaces at the end of a line are also
> forbidden, because they are generally invisible to the person who is
> editing the code, but they show up in the git revision logs.  A good editor
> will either have an option to highlight this trailing whitespace so that
> you can remove it, or an option to automatically remove it when the the
> file is saved.
>
> In summary: you'll have to adjust your editor settings so that it writes
> files that conform to the pre-commit hook.
>
>  - David
>
>
> On Wed, Jan 11, 2017 at 9:12 PM, Jon Garner <thehappydog84 at gmail.com>
> wrote:
>
>> So I'm new around here and I've written a new class that I'd like to get
>> onto Gitlab. (I'm also new to Git) If anyone could help me I'd greatly
>> appreciate it. Here goes...
>>
>> 1.) I've gone through the process laid out here https://gitlab.kitware.co
>> m/vtk/vtk/blob/master/Documentation/dev/git/develop.md.
>> 2.) I've created a local clone of VTK
>> 3.) Everything checks out when I run ./Utilities/SetupForDevelopment.sh.
>>
>> 4.) I have forked VTk into my Namespace on gitlab
>> 5.) I've created a new topic/branch
>> 6.) I added my .cxx and my .h file into the appropriate folder (then add
>> using $git add)
>> 7.) I also modify the CMakelists.txt file (I add it too)
>> 7.) when I run $git commit I get the following
>>
>> Jon at Arnie MINGW64 ~/VTK (Implement_vtkInteractorStyleDrawPolygonType2)
>> $ git commit
>> pre-commit hook failure
>> -----------------------
>>
>> Interaction/Style/vtkInteractorStyleDrawPolygonType2.cxx:66: trailing
>> whitespace.
>> +
>> Interaction/Style/vtkInteractorStyleDrawPolygonType2.cxx:75: tab in
>> indent.
>> +       //draw a circle at nodes
>> Interaction/Style/vtkInteractorStyleDrawPolygonType2.cxx:76: tab in
>> indent.
>> +       for(int j = 1; j < 30; j += 1)
>> Interaction/Style/vtkInteractorStyleDrawPolygonType2.cxx:77: tab in
>> indent.
>> +       {
>> Interaction/Style/vtkInteractorStyleDrawPolygonType2.cxx:78: tab in
>> indent.
>> +               for (int dotRad = 0; dotRad <= 3; dotRad += 1)
>> Interaction/Style/vtkInteractorStyleDrawPolygonType2.cxx:79: tab in
>> indent.
>> .
>> .
>> .
>>
>> until it reaches the end of the .cxx and the .h file then it just ends no
>> mention of the .txt file.
>>
>> I tried pushing it and it sends the branch but the new files aren't
>> there.  I'm assuming it has something to do with the pre-commit hook
>> failure.
>>
>> running $git status I get the following
>>
>> Jon at Arnie MINGW64 ~/VTK (Implement_vtkInteractorStyleDrawPolygonType2)
>> $ git status
>> On branch Implement_vtkInteractorStyleDrawPolygonType2
>> Changes to be committed:
>>   (use "git reset HEAD <file>..." to unstage)
>>
>>         new file:   Interaction/Style/vtkInteracto
>> rStyleDrawPolygonType2.cxx
>>         new file:   Interaction/Style/vtkInteracto
>> rStyleDrawPolygonType2.h
>>
>> Changes not staged for commit:
>>   (use "git add <file>..." to update what will be committed)
>>   (use "git checkout -- <file>..." to discard changes in working
>> directory)
>>
>>         modified:   Interaction/Style/CMakeLists.txt
>>  .
>> .
>> .
>>
>> running $git prepush it just returns no information is given.
>>
>> The next thing I intend to do is restore the CMakelist.txt change and see
>> if that fixes the problem.
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20170112/2e355d7b/attachment.html>


More information about the vtk-developers mailing list