From: Brandon Casey Date: Fri, 22 Feb 2008 19:04:12 GMT Subject: [PATCH 3/4] git-reflog: add option --updateref to write the last reflog sha1 into the ref Message-ID: <47BF1CAC.5000009@nrlssc.navy.mil> In-Reply-To: <1203706541-21719-2-git-send-email-casey@nrlssc.navy.mil> Certain sanity checks on the reflog assume that the sha1 of the top reflog entry will be equal to the sha1 stored in the ref. When reflog entries are deleted, this assumption may not hold. This patch adds a new option to git-reflog which causes the subcommands "expire" and "delete" to update the ref with the sha1 of the top-most reflog entry. Signed-off-by: Brandon Casey --- This sucks in close_ref() and commit_ref() from refs.c. The changes to expire_reflog() implement some of what write_ref_sha1() does. I guess a new function in refs.c could have been made which instead of a logmsg takes an updated reflog filename, but that seemed too contrived. We're already modifying the reflog directly anyway, so maybe it's ok to modify the ref directly too. -brandon builtin-reflog.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/builtin-reflog.c b/builtin-reflog.c index f685d76..280e24e 100644 --- a/builtin-reflog.c +++ b/builtin-reflog.c @@ -15,7 +15,7 @@ static const char reflog_expire_usage[] = "git-reflog (show|expire) [--verbose] [--dry-run] [--stale-fix] [--expire=