Message ID | 20161117055923.18975-1-zajec5@gmail.com |
---|---|
State | Rejected |
Headers | show |
Hi Rafal, do you happen to know whether rev-list --count is available in all Git versions? ~ Jo
On 17 November 2016 at 09:57, Jo-Philipp Wich <jo@mein.io> wrote: > do you happen to know whether rev-list --count is available in all Git > versions? I found it mentioned in various posts from 2012 so it should be well settled.
On 17 November 2016 at 10:05, Rafał Miłecki <zajec5@gmail.com> wrote: > On 17 November 2016 at 09:57, Jo-Philipp Wich <jo@mein.io> wrote: >> do you happen to know whether rev-list --count is available in all Git >> versions? > > I found it mentioned in various posts from 2012 so it should be well settled. More reliable source: it's first documented in 1.8.0: https://git-scm.com/docs/git-rev-list/1.8.0 which was released in 2012.
Hi, On 17 November 2016 at 10:10, Rafał Miłecki <zajec5@gmail.com> wrote: > On 17 November 2016 at 10:05, Rafał Miłecki <zajec5@gmail.com> wrote: >> On 17 November 2016 at 09:57, Jo-Philipp Wich <jo@mein.io> wrote: >>> do you happen to know whether rev-list --count is available in all Git >>> versions? >> >> I found it mentioned in various posts from 2012 so it should be well settled. > > More reliable source: it's first documented in 1.8.0: > https://git-scm.com/docs/git-rev-list/1.8.0 > which was released in 2012. We currently only require 1.7[1], and some of the buildbots still use that. --count was actually used in the first version, and removed because it broke the build on some buildbots / LTS distributions [2]. Regards Jonas [1] https://github.com/lede-project/source/blob/master/include/prereq-build.mk#L161 [2] https://git.lede-project.org/f1765277bacbea47a45ed913ca8fa043e9f71393
On 17 November 2016 at 10:56, Jonas Gorski <jonas.gorski@gmail.com> wrote: > On 17 November 2016 at 10:10, Rafał Miłecki <zajec5@gmail.com> wrote: >> On 17 November 2016 at 10:05, Rafał Miłecki <zajec5@gmail.com> wrote: >>> On 17 November 2016 at 09:57, Jo-Philipp Wich <jo@mein.io> wrote: >>>> do you happen to know whether rev-list --count is available in all Git >>>> versions? >>> >>> I found it mentioned in various posts from 2012 so it should be well settled. >> >> More reliable source: it's first documented in 1.8.0: >> https://git-scm.com/docs/git-rev-list/1.8.0 >> which was released in 2012. > > We currently only require 1.7[1], and some of the buildbots still use > that. --count was actually used in the first version, and removed > because it broke the build on some buildbots / LTS distributions [2]. OK, thanks for catching this. I guess it's not that important for LEDE with its small commits: > time git rev-list HEAD~30000..HEAD | wc -l 30000 real 0m0.352s user 0m0.325s sys 0m0.052s
diff --git a/scripts/getver.sh b/scripts/getver.sh index e718485..9b84602 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -20,18 +20,18 @@ try_git() { case "$GET_REV" in r*) GET_REV="$(echo $GET_REV | tr -d 'r')" - BASE_REV="$(git rev-list ${REBOOT}..HEAD | wc -l | awk '{print $1}')" + BASE_REV="$(git rev-list --count ${REBOOT}..HEAD)" REV="$(git rev-parse HEAD~$((BASE_REV - GET_REV)))" ;; *) BRANCH="$(git rev-parse --abbrev-ref HEAD)" ORIGIN="$(git rev-parse --verify --symbolic-full-name ${BRANCH}@{u} 2>/dev/null)" [ -n "$ORIGIN" ] || ORIGIN="$(git rev-parse --verify --symbolic-full-name master@{u} 2>/dev/null)" - REV="$(git rev-list ${REBOOT}..$GET_REV | wc -l | awk '{print $1}')" + REV="$(git rev-list --count ${REBOOT}..$GET_REV)" if [ -n "$ORIGIN" ]; then UPSTREAM_BASE="$(git merge-base $GET_REV $ORIGIN)" - UPSTREAM_REV="$(git rev-list ${REBOOT}..$UPSTREAM_BASE | wc -l | awk '{print $1}')" + UPSTREAM_REV="$(git rev-list --count ${REBOOT}..$UPSTREAM_BASE)" else UPSTREAM_REV=$REV fi