Browse files

Properly count the number of commits

The "git log --pretty=format:" command eats up the line feed for the
last commit, and thus "wc -l" counts one commit less than there are.
This is easy to demonstrate with:

$ git log '2.95.3^..2.95.3' --oneline
e84de34 config/version: set version to 2.95.3 (OpenELEC-3.0 Beta 3)

$ git log '2.95.3^..2.95.3' --pretty=format: | wc -l

Even though this is a minor discrepancy, "git rev-list" and "git
rev-parse" are simpler and more accurate tools for this task (their
output format is not going to change).
  • Loading branch information...
1 parent 32483de commit 5265597861b5ae6472710c75941aeda564ce95f9 @chutzimir chutzimir committed Nov 19, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 scripts/image
4 scripts/image
@@ -35,8 +35,8 @@ export INSTALL=$BUILD/image/system
BUILD_DATE=`date +%Y%m%d%H%M%S`
if [ "$OPENELEC_VERSION" = devel -o "$OPENELEC_VERSION" = debug ]; then
- GIT_BUILD=`git log --pretty=format:'' | wc -l`
- GIT_HASH=`git log -n1 --format=%H`
+ GIT_BUILD=`git rev-list HEAD | wc -l`
+ GIT_HASH=`git rev-parse HEAD`

0 comments on commit 5265597

Please sign in to comment.