diff options
author | Malfurious <m@lfurio.us> | 2023-11-17 04:35:54 -0500 |
---|---|---|
committer | Malfurious <m@lfurio.us> | 2023-11-17 06:11:07 -0500 |
commit | 8c9abfb419f32aae0008683cb04b918039512951 (patch) | |
tree | 7c39c76dfec9e8f28c510a5321fc420b18bce1ed /acid | |
parent | 1a2a598f2c43d5fffeb40efae80a8130e33a441d (diff) | |
download | cychedelic-8c9abfb419f32aae0008683cb04b918039512951.tar.gz cychedelic-8c9abfb419f32aae0008683cb04b918039512951.zip |
acid: source: Only record commit hashes
Previously, the object hash computed by `git for-each-ref` was the value
we cached in the 'previous_hash' file. If the matching ref was an
annotated tag, then this was the tag's hash, not the commit hash it
pointed to.
Now, always dereference tags to their commit object, and store this
value instead. This consistency will improve the web UX in my opinion.
Signed-off-by: Malfurious <m@lfurio.us>
Diffstat (limited to 'acid')
-rwxr-xr-x | acid/acid-source | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/acid/acid-source b/acid/acid-source index 8242452..d03076f 100755 --- a/acid/acid-source +++ b/acid/acid-source @@ -6,21 +6,22 @@ # <name> doesn't exist. If updates are found, we attempt to checkout the newest # version according to <ref-pattern> (see <pattern> from git-for-each-ref(1)). # -# On a successful run, the new object hash is printed to stdout (or the previous -# hash, if no update occurred). This may be a commit hash. However, if -# <ref-pattern> matches an annotated tag, then the hash refers to the tag object. -# The caller should cache this hash value upon successful deployment. +# On a successful run, the new commit hash is printed to stdout (or the previous +# hash, if no update occurred). The caller should cache this hash value upon +# successful deployment. # # If a new version of the file tree is checked out, this file exits with code 1, # otherwise a stale success exits with 0. On any error, the null hash is # printed, and we exit with 2. gethash() { - git for-each-ref \ + obj=$(git for-each-ref \ --count=1 \ --format='%(objectname)' \ --sort='-creatordate' \ - "$1" # pattern + "$1") # pattern + + git rev-parse --quiet --verify "$obj^{commit}" } fail() { |