From 1c00e4233347159f207151e76c4f48db962678a2 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Sat, 23 Nov 2013 12:09:05 +0100 Subject: git-log-describe.awk: allow limiting to cache The `--contains` option (default, enabled via `-vfast=0`) does not show a result if there is no tag following a commit. The `-vcache_only` option prevents execution of `git describe` and thereby speeds up post-processing. --- git-log-describe.awk | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'git-log-describe.awk') diff --git a/git-log-describe.awk b/git-log-describe.awk index a491e13..74d8e42 100755 --- a/git-log-describe.awk +++ b/git-log-describe.awk @@ -10,6 +10,8 @@ # -vcache_dir=DIR Use DIR to store cached git-describe results. DIR will # be created if non-existent. Implies -vcache=1. # -vcache_ro={0|1} Set to 1 to prevent creating new files in cache. +# -vcache_only={0|1} Set to 1 to use only cache entries, do not execute +# git-describe for missing entries. Implies -vcache_ro=1. # -vfast={0|1} If 0 (default), then --contains will be used which # relates to the first tag containing this commit. # Otherwise, --first-parent will be used which relates to @@ -42,6 +44,9 @@ BEGIN { if (cache_dir) cache_dir = cache_dir "/contains"; } + # If git-describe is disabled, then the cache is effectively read-only. + if (cache_only) cache_ro = 1; + if (cache_dir) { # Skip cache directory if non-existent and read only or if the # directory cannot be created. @@ -120,7 +125,7 @@ function git_describe(hash) { } # cache entry was unavailable, get a description now. - if (!desc) { + if (!desc && !cache_only) { cmd = "git describe " opts " " hash " 2>/dev/null"; cmd | getline desc; close(cmd); -- cgit v1.2.1