You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@mesos.apache.org by Michael Park <mp...@apache.org> on 2016/04/05 21:50:57 UTC

Review Request 45768: Fixed commit message hook to skip over the commented lines.

-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45768/
-----------------------------------------------------------

Review request for mesos, Joerg Schad and Vinod Kone.


Bugs: MESOS-5126
    https://issues.apache.org/jira/browse/MESOS-5126


Repository: mesos


Description
-------

See summary.


Diffs
-----

  support/hooks/commit-msg d3d5415bf6a243def05cf79f4af2b136b9866d68 

Diff: https://reviews.apache.org/r/45768/diff/


Testing
-------

Was able to commit a patch where there were lines longer than 72 characters in the commented section.


Thanks,

Michael Park


Re: Review Request 45768: Fixed commit message hook to skip over the commented lines.

Posted by Kevin Klues <kl...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45768/#review127467
-----------------------------------------------------------


Ship it!




Ship It!

- Kevin Klues


On April 6, 2016, 9:30 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45768/
> -----------------------------------------------------------
> 
> (Updated April 6, 2016, 9:30 p.m.)
> 
> 
> Review request for mesos, Joerg Schad and Vinod Kone.
> 
> 
> Bugs: MESOS-5126
>     https://issues.apache.org/jira/browse/MESOS-5126
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Fixed commit message hook to skip over the commented lines.
> 
> 
> Diffs
> -----
> 
>   support/hooks/commit-msg d3d5415bf6a243def05cf79f4af2b136b9866d68 
> 
> Diff: https://reviews.apache.org/r/45768/diff/
> 
> 
> Testing
> -------
> 
> Was able to commit a patch where there were lines longer than 72 characters in the commented section.
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 45768: Fixed commit message hook to skip over the commented lines.

Posted by Michael Park <mp...@apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45768/
-----------------------------------------------------------

(Updated April 6, 2016, 9:30 p.m.)


Review request for mesos, Joerg Schad and Vinod Kone.


Bugs: MESOS-5126
    https://issues.apache.org/jira/browse/MESOS-5126


Repository: mesos


Description (updated)
-------

Fixed commit message hook to skip over the commented lines.


Diffs (updated)
-----

  support/hooks/commit-msg d3d5415bf6a243def05cf79f4af2b136b9866d68 

Diff: https://reviews.apache.org/r/45768/diff/


Testing
-------

Was able to commit a patch where there were lines longer than 72 characters in the commented section.


Thanks,

Michael Park


Re: Review Request 45768: Fixed commit message hook to skip over the commented lines.

Posted by haosdent huang <ha...@gmail.com>.

> On April 5, 2016, 8:01 p.m., Kevin Klues wrote:
> > support/hooks/commit-msg, line 20
> > <https://reviews.apache.org/r/45768/diff/1/?file=1326651#file1326651line20>
> >
> >     You should probably quote the $LINE variable here. You should also use a single "=", not "==". The double equals will not work on all versions of sh (most notably on mac os).
> >     I would also just check the first character to equal "#" instead of comaping the whole line.
> >     
> >     Also, when you hit a line with a comment, you probably shouldn't break. Instead you should continue (in case there is more text to include in the commit message later on).
> >     
> >     The new loop would look like:
> >     
> >     ```
> >     while read LINE
> >     do
> >         if [[ "${LINE:0:1}" == "#" ]]; then continue; fi
> >         LENGTH=$(echo $LINE | wc -c)
> >         if [ "$LENGTH" -gt "73" ]; then
> >             echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
> >             exit 1
> >         fi
> >     ```
> 
> Kevin Klues wrote:
>     Whoops, I meant the following (this actually has the single "=" and uses single "[" "]"'s around the if instead of "[[", which is also non-portable.
>     
>     ```
>     while read LINE
>     do
>         if [ "${LINE:0:1}" = "#" ]; then continue; fi
>         LENGTH=$(echo $LINE | wc -c)
>         if [ "$LENGTH" -gt "73" ]; then
>             echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
>             exit 1
>         fi
>     done
>     ```
> 
> haosdent huang wrote:
>     I suggset use `test "x$LINE" != "x#"`. Refer to http://stackoverflow.com/questions/174119/why-do-shell-script-comparisons-often-use-xvar-xyes
>     And I think `LENGTH=$(echo $LINE | wc -c)` also could replace by `LENGTH=${#LINE}`.
> 
> Michael Park wrote:
>     Decided to go with `"$(echo -n $LINE | head -c 1)" = "#"` to stay consistent with an existing use of `FIRST_CHAR=$(echo -n $FIRST_LINE | head -c 1)` above. I think at least for now it makes sense to keep `LENGTH=$(echo $LINE | wc -c)` for consistency as well.

Got it, thanks for explanation.


- haosdent


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45768/#review127198
-----------------------------------------------------------


On April 6, 2016, 9:30 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45768/
> -----------------------------------------------------------
> 
> (Updated April 6, 2016, 9:30 p.m.)
> 
> 
> Review request for mesos, Joerg Schad and Vinod Kone.
> 
> 
> Bugs: MESOS-5126
>     https://issues.apache.org/jira/browse/MESOS-5126
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Fixed commit message hook to skip over the commented lines.
> 
> 
> Diffs
> -----
> 
>   support/hooks/commit-msg d3d5415bf6a243def05cf79f4af2b136b9866d68 
> 
> Diff: https://reviews.apache.org/r/45768/diff/
> 
> 
> Testing
> -------
> 
> Was able to commit a patch where there were lines longer than 72 characters in the commented section.
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 45768: Fixed commit message hook to skip over the commented lines.

Posted by Kevin Klues <kl...@gmail.com>.

> On April 5, 2016, 8:01 p.m., Kevin Klues wrote:
> > support/hooks/commit-msg, line 20
> > <https://reviews.apache.org/r/45768/diff/1/?file=1326651#file1326651line20>
> >
> >     You should probably quote the $LINE variable here. You should also use a single "=", not "==". The double equals will not work on all versions of sh (most notably on mac os).
> >     I would also just check the first character to equal "#" instead of comaping the whole line.
> >     
> >     Also, when you hit a line with a comment, you probably shouldn't break. Instead you should continue (in case there is more text to include in the commit message later on).
> >     
> >     The new loop would look like:
> >     
> >     ```
> >     while read LINE
> >     do
> >         if [[ "${LINE:0:1}" == "#" ]]; then continue; fi
> >         LENGTH=$(echo $LINE | wc -c)
> >         if [ "$LENGTH" -gt "73" ]; then
> >             echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
> >             exit 1
> >         fi
> >     ```

Whoops, I meant the following (this actually has the single "=" and uses single "[" "]"'s around the if instead of "[[", which is also non-portable.

```
while read LINE
do
    if [ "${LINE:0:1}" = "#" ]; then continue; fi
    LENGTH=$(echo $LINE | wc -c)
    if [ "$LENGTH" -gt "73" ]; then
        echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
        exit 1
    fi
done
```


- Kevin


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45768/#review127198
-----------------------------------------------------------


On April 5, 2016, 7:50 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45768/
> -----------------------------------------------------------
> 
> (Updated April 5, 2016, 7:50 p.m.)
> 
> 
> Review request for mesos, Joerg Schad and Vinod Kone.
> 
> 
> Bugs: MESOS-5126
>     https://issues.apache.org/jira/browse/MESOS-5126
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> See summary.
> 
> 
> Diffs
> -----
> 
>   support/hooks/commit-msg d3d5415bf6a243def05cf79f4af2b136b9866d68 
> 
> Diff: https://reviews.apache.org/r/45768/diff/
> 
> 
> Testing
> -------
> 
> Was able to commit a patch where there were lines longer than 72 characters in the commented section.
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 45768: Fixed commit message hook to skip over the commented lines.

Posted by haosdent huang <ha...@gmail.com>.

> On April 5, 2016, 8:01 p.m., Kevin Klues wrote:
> > support/hooks/commit-msg, line 20
> > <https://reviews.apache.org/r/45768/diff/1/?file=1326651#file1326651line20>
> >
> >     You should probably quote the $LINE variable here. You should also use a single "=", not "==". The double equals will not work on all versions of sh (most notably on mac os).
> >     I would also just check the first character to equal "#" instead of comaping the whole line.
> >     
> >     Also, when you hit a line with a comment, you probably shouldn't break. Instead you should continue (in case there is more text to include in the commit message later on).
> >     
> >     The new loop would look like:
> >     
> >     ```
> >     while read LINE
> >     do
> >         if [[ "${LINE:0:1}" == "#" ]]; then continue; fi
> >         LENGTH=$(echo $LINE | wc -c)
> >         if [ "$LENGTH" -gt "73" ]; then
> >             echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
> >             exit 1
> >         fi
> >     ```
> 
> Kevin Klues wrote:
>     Whoops, I meant the following (this actually has the single "=" and uses single "[" "]"'s around the if instead of "[[", which is also non-portable.
>     
>     ```
>     while read LINE
>     do
>         if [ "${LINE:0:1}" = "#" ]; then continue; fi
>         LENGTH=$(echo $LINE | wc -c)
>         if [ "$LENGTH" -gt "73" ]; then
>             echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
>             exit 1
>         fi
>     done
>     ```

I suggset use `test "x$LINE" != "x#"`. Refer to http://stackoverflow.com/questions/174119/why-do-shell-script-comparisons-often-use-xvar-xyes
And I think `LENGTH=$(echo $LINE | wc -c)` also could replace by `LENGTH=${#LINE}`.


- haosdent


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45768/#review127198
-----------------------------------------------------------


On April 5, 2016, 7:50 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45768/
> -----------------------------------------------------------
> 
> (Updated April 5, 2016, 7:50 p.m.)
> 
> 
> Review request for mesos, Joerg Schad and Vinod Kone.
> 
> 
> Bugs: MESOS-5126
>     https://issues.apache.org/jira/browse/MESOS-5126
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> See summary.
> 
> 
> Diffs
> -----
> 
>   support/hooks/commit-msg d3d5415bf6a243def05cf79f4af2b136b9866d68 
> 
> Diff: https://reviews.apache.org/r/45768/diff/
> 
> 
> Testing
> -------
> 
> Was able to commit a patch where there were lines longer than 72 characters in the commented section.
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 45768: Fixed commit message hook to skip over the commented lines.

Posted by Michael Park <mp...@apache.org>.

> On April 5, 2016, 8:01 p.m., Kevin Klues wrote:
> > support/hooks/commit-msg, line 20
> > <https://reviews.apache.org/r/45768/diff/1/?file=1326651#file1326651line20>
> >
> >     You should probably quote the $LINE variable here. You should also use a single "=", not "==". The double equals will not work on all versions of sh (most notably on mac os).
> >     I would also just check the first character to equal "#" instead of comaping the whole line.
> >     
> >     Also, when you hit a line with a comment, you probably shouldn't break. Instead you should continue (in case there is more text to include in the commit message later on).
> >     
> >     The new loop would look like:
> >     
> >     ```
> >     while read LINE
> >     do
> >         if [[ "${LINE:0:1}" == "#" ]]; then continue; fi
> >         LENGTH=$(echo $LINE | wc -c)
> >         if [ "$LENGTH" -gt "73" ]; then
> >             echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
> >             exit 1
> >         fi
> >     ```
> 
> Kevin Klues wrote:
>     Whoops, I meant the following (this actually has the single "=" and uses single "[" "]"'s around the if instead of "[[", which is also non-portable.
>     
>     ```
>     while read LINE
>     do
>         if [ "${LINE:0:1}" = "#" ]; then continue; fi
>         LENGTH=$(echo $LINE | wc -c)
>         if [ "$LENGTH" -gt "73" ]; then
>             echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
>             exit 1
>         fi
>     done
>     ```
> 
> haosdent huang wrote:
>     I suggset use `test "x$LINE" != "x#"`. Refer to http://stackoverflow.com/questions/174119/why-do-shell-script-comparisons-often-use-xvar-xyes
>     And I think `LENGTH=$(echo $LINE | wc -c)` also could replace by `LENGTH=${#LINE}`.

Decided to go with `"$(echo -n $LINE | head -c 1)" = "#"` to stay consistent with an existing use of `FIRST_CHAR=$(echo -n $FIRST_LINE | head -c 1)` above. I think at least for now it makes sense to keep `LENGTH=$(echo $LINE | wc -c)` for consistency as well.


- Michael


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45768/#review127198
-----------------------------------------------------------


On April 6, 2016, 9:30 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45768/
> -----------------------------------------------------------
> 
> (Updated April 6, 2016, 9:30 p.m.)
> 
> 
> Review request for mesos, Joerg Schad and Vinod Kone.
> 
> 
> Bugs: MESOS-5126
>     https://issues.apache.org/jira/browse/MESOS-5126
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> Fixed commit message hook to skip over the commented lines.
> 
> 
> Diffs
> -----
> 
>   support/hooks/commit-msg d3d5415bf6a243def05cf79f4af2b136b9866d68 
> 
> Diff: https://reviews.apache.org/r/45768/diff/
> 
> 
> Testing
> -------
> 
> Was able to commit a patch where there were lines longer than 72 characters in the commented section.
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 45768: Fixed commit message hook to skip over the commented lines.

Posted by Kevin Klues <kl...@gmail.com>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45768/#review127198
-----------------------------------------------------------




support/hooks/commit-msg (line 20)
<https://reviews.apache.org/r/45768/#comment190371>

    You should probably quote the $LINE variable here. You should also use a single "=", not "==". The double equals will not work on all versions of sh (most notably on mac os).
    I would also just check the first character to equal "#" instead of comaping the whole line.
    
    Also, when you hit a line with a comment, you probably shouldn't break. Instead you should continue (in case there is more text to include in the commit message later on).
    
    The new loop would look like:
    
    ```
    while read LINE
    do
        if [[ "${LINE:0:1}" == "#" ]]; then continue; fi
        LENGTH=$(echo $LINE | wc -c)
        if [ "$LENGTH" -gt "73" ]; then
            echo >&2 "Error: No line in the commit message summary may exceed 72 characters."
            exit 1
        fi
    ```


- Kevin Klues


On April 5, 2016, 7:50 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45768/
> -----------------------------------------------------------
> 
> (Updated April 5, 2016, 7:50 p.m.)
> 
> 
> Review request for mesos, Joerg Schad and Vinod Kone.
> 
> 
> Bugs: MESOS-5126
>     https://issues.apache.org/jira/browse/MESOS-5126
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> See summary.
> 
> 
> Diffs
> -----
> 
>   support/hooks/commit-msg d3d5415bf6a243def05cf79f4af2b136b9866d68 
> 
> Diff: https://reviews.apache.org/r/45768/diff/
> 
> 
> Testing
> -------
> 
> Was able to commit a patch where there were lines longer than 72 characters in the commented section.
> 
> 
> Thanks,
> 
> Michael Park
> 
>


Re: Review Request 45768: Fixed commit message hook to skip over the commented lines.

Posted by Mesos ReviewBot <re...@mesos.apache.org>.
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/45768/#review127228
-----------------------------------------------------------



Patch looks great!

Reviews applied: [45767, 45768]

Passed command: export OS='ubuntu:14.04' CONFIGURATION='--verbose' COMPILER='gcc' ENVIRONMENT='GLOG_v=1 MESOS_VERBOSE=1'; ./support/docker_build.sh

- Mesos ReviewBot


On April 5, 2016, 7:50 p.m., Michael Park wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/45768/
> -----------------------------------------------------------
> 
> (Updated April 5, 2016, 7:50 p.m.)
> 
> 
> Review request for mesos, Joerg Schad and Vinod Kone.
> 
> 
> Bugs: MESOS-5126
>     https://issues.apache.org/jira/browse/MESOS-5126
> 
> 
> Repository: mesos
> 
> 
> Description
> -------
> 
> See summary.
> 
> 
> Diffs
> -----
> 
>   support/hooks/commit-msg d3d5415bf6a243def05cf79f4af2b136b9866d68 
> 
> Diff: https://reviews.apache.org/r/45768/diff/
> 
> 
> Testing
> -------
> 
> Was able to commit a patch where there were lines longer than 72 characters in the commented section.
> 
> 
> Thanks,
> 
> Michael Park
> 
>