diff options
author | Peter Wu <lekensteyn@gmail.com> | 2013-11-23 12:09:05 +0100 |
---|---|---|
committer | Peter Wu <lekensteyn@gmail.com> | 2013-11-23 12:09:05 +0100 |
commit | 1c00e4233347159f207151e76c4f48db962678a2 (patch) | |
tree | d4ebc2cf7fbe8ecee3e71817f7148769f969ca66 | |
parent | a165268ec8c6867216ee40744501c1867aaa6ddf (diff) | |
download | scripts-1c00e4233347159f207151e76c4f48db962678a2.tar.gz |
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.
-rwxr-xr-x | git-log-describe.awk | 7 |
1 files changed, 6 insertions, 1 deletions
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); |