Re: [PATCH] t7406: fix breakage on OSX
Stefan Beller writes: > On Wed, Aug 10, 2016 at 11:27 AM, Junio C Hamano wrote: >> Stefan Beller writes: >> >>> On OSX `wc` prefixes the output of numbers with whitespace, such that >>> the `commit_count` would be "SP ". When using that in >>> >>> git submodule update --init --depth=$commit_count >>> >>> the depth would be empty and the number is interpreted as the pathspec. >>> Fix this by not using `wc` and rather instruct rev-list to count. >>> >>> Another way to fix this is to remove the `=` sign after the `--depth` >>> argument as then we are allowed to have more than just one whitespace >>> between `--depth` and the actual number. Prefer the solution of rev-list >>> counting as that is expected to be slightly faster and more self-sustained >>> within Git. >> >> You meant self-contained, I would guess. > > Yes. Mind to fix that locally, or waiting for a resend? Fixed it up while queuing. >> There are a couple of "log --oneline | wc -l" remaining that are >> currently safe but they may be a time-bomb waiting to go off. > ... > All of the occurrences are not white space sensitive AFAICT, > they are just bad examples, which may inspire others to follow > that pattern. Yup, I agree(d). -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] t7406: fix breakage on OSX
> On 10 Aug 2016, at 19:56, Stefan Beller wrote: > > On OSX `wc` prefixes the output of numbers with whitespace, such that > the `commit_count` would be "SP ". When using that in > >git submodule update --init --depth=$commit_count > > the depth would be empty and the number is interpreted as the pathspec. > Fix this by not using `wc` and rather instruct rev-list to count. > > Another way to fix this is to remove the `=` sign after the `--depth` > argument as then we are allowed to have more than just one whitespace > between `--depth` and the actual number. Prefer the solution of rev-list > counting as that is expected to be slightly faster and more self-sustained > within Git. > > Reported-by: Lars Schneider > Helped-by: Junio C Hamano , > Signed-off-by: Stefan Beller > --- > > origin/sb/submodule-update-dot-branch > > t/t7406-submodule-update.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/t/t7406-submodule-update.sh b/t/t7406-submodule-update.sh > index d7983cf..64f322c 100755 > --- a/t/t7406-submodule-update.sh > +++ b/t/t7406-submodule-update.sh > @@ -877,7 +877,7 @@ test_expect_success 'submodule update clone shallow > submodule' ' > test_when_finished "rm -rf super3" && > first=$(git -C cloned submodule status submodule |cut -c2-41) && > second=$(git -C submodule rev-parse HEAD) && > - commit_count=$(git -C submodule rev-list $first^..$second | wc -l) && > + commit_count=$(git -C submodule rev-list --count $first^..$second) && > git clone cloned super3 && > pwd=$(pwd) && > ( > -- > 2.9.2.665.gdb8bb2f > Ack. - Lars -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] t7406: fix breakage on OSX
On Wed, Aug 10, 2016 at 11:27 AM, Junio C Hamano wrote: > Stefan Beller writes: > >> On OSX `wc` prefixes the output of numbers with whitespace, such that >> the `commit_count` would be "SP ". When using that in >> >> git submodule update --init --depth=$commit_count >> >> the depth would be empty and the number is interpreted as the pathspec. >> Fix this by not using `wc` and rather instruct rev-list to count. >> >> Another way to fix this is to remove the `=` sign after the `--depth` >> argument as then we are allowed to have more than just one whitespace >> between `--depth` and the actual number. Prefer the solution of rev-list >> counting as that is expected to be slightly faster and more self-sustained >> within Git. > > You meant self-contained, I would guess. Yes. Mind to fix that locally, or waiting for a resend? > > There are a couple of "log --oneline | wc -l" remaining that are > currently safe but they may be a time-bomb waiting to go off. $ grep -r "log --oneline | wc -l" t6050-replace.sh: test $(git log --oneline | wc -l) = 7 && t6050-replace.sh: test $(git log --oneline | wc -l) = 3 && t7406-submodule-update.sh: test 1 = $(git -C submodule log --oneline | wc -l) t7406-submodule-update.sh: test 1 = $(git -C submodule log --oneline | wc -l) t7400-submodule-basic.sh: test 1 = $(git log --oneline | wc -l) All of the occurrences are not white space sensitive AFAICT, they are just bad examples, which may inspire others to follow that pattern. Thanks, Stefan -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH] t7406: fix breakage on OSX
Stefan Beller writes: > On OSX `wc` prefixes the output of numbers with whitespace, such that > the `commit_count` would be "SP ". When using that in > > git submodule update --init --depth=$commit_count > > the depth would be empty and the number is interpreted as the pathspec. > Fix this by not using `wc` and rather instruct rev-list to count. > > Another way to fix this is to remove the `=` sign after the `--depth` > argument as then we are allowed to have more than just one whitespace > between `--depth` and the actual number. Prefer the solution of rev-list > counting as that is expected to be slightly faster and more self-sustained > within Git. You meant self-contained, I would guess. There are a couple of "log --oneline | wc -l" remaining that are currently safe but they may be a time-bomb waiting to go off. Thanks. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html