Skip to contentSkip to conversation

perf tool: simplify a git command in PERF-VERSION-GEN

PATCH In review Ramkumar Ramachandra 2 participants 2 messages Oct 2, 2013 perf events

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf tool: simplify a git command in PERF-VERSION-GEN

Replace a complex git log invocation with a simpler git rev-parse invocation.

Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/util/PERF-VERSION-GEN | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/PERF-VERSION-GEN +1 -1
index 15a77b7..b23d11b 100755
@@ -18,7 +18,7 @@ TAG=
 if test -d ../../.git -o -f ../../.git
 then
 	TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null )
-	CID=$(git log -1 --abbrev=4 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID"
+	CID=$(git rev-parse --short HEAD 2>/dev/null) && CID="-g$CID"
 fi
 if test -z "$TAG"
 then
Signature · 1 line
1.8.4.477.g5d89aa9
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Ramkumar Ramachandra

Replace a complex git log invocation with a simpler git rev-parse invocation.

Cc Ingo Molnar <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Arnaldo Carvalho de Melo <[email protected]>
---
 tools/perf/util/PERF-VERSION-GEN | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/perf/util/PERF-VERSION-GEN +0 -0
index 15a77b7..b23d11b 100755

tools/perf/util/PERF-VERSION-GEN TAG= · line 21

Quoted 5 lines
tools/perf/util/PERF-VERSION-GEN +1 -1
@@ -18,7 +18,7 @@ TAG=
 if test -d ../../.git -o -f ../../.git
 then
 	TAG=$(git describe --abbrev=0 --match "v[0-9].[0-9]*" 2>/dev/null )
-	CID=$(git log -1 --abbrev=4 --pretty=format:"%h" 2>/dev/null) && CID="-g$CID"
+	CID=$(git rev-parse --short HEAD 2>/dev/null) && CID="-g$CID"

This shaves 4 milliseconds off the build time as well.

Thanks,

Ingo