summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--refs.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/refs.c b/refs.c
index 4684ffe..05a4be0 100644
--- a/refs.c
+++ b/refs.c
@@ -4081,10 +4081,13 @@ int reflog_expire(const char *refname, const unsigned char *sha1,
/*
* It doesn't make sense to adjust a reference pointed
* to by a symbolic ref based on expiring entries in
- * the symbolic reference's reflog.
+ * the symbolic reference's reflog. Nor can we update
+ * a reference if there are no remaining reflog
+ * entries.
*/
int update = (flags & EXPIRE_REFLOGS_UPDATE_REF) &&
- !(type & REF_ISSYMREF);
+ !(type & REF_ISSYMREF) &&
+ !is_null_sha1(cb.last_kept_sha1);
if (close_lock_file(&reflog_lock)) {
status |= error("couldn't write %s: %s", log_file,