Kristian H??gsberg <krh@xxxxxxxxxx> wrote: > A more or less straight port to C of the shell script version. [snip] > +static void create_reflog(struct ref_lock *lock) I'm attaching a patch to the reflog code which introduces a new force_log option. You can use set this after you lock the ref but before writing it, provided that the user supplied -l on the command line. This completely replaces the create_reflog function with common code. I apologize for taking so long to get around to this but I've been busy with other stuff lately. :-) -- 8> -- Add force_log flag to ref_lock to create logs when necessary. Callers of lock_ref_sha1 or lock_any_ref_for_update may now set lck->force_log = 1 if they want to create the associated reflog during write_ref_sha1 if the log is missing. If set this will override a false setting of the configuration parameter core.logAllRefUpdates and create a missing log, at which point future updates to the same ref would be logged as the log is present. Signed-off-by: Shawn O. Pearce <spearce@xxxxxxxxxxx> --- refs.c | 2 +- refs.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/refs.c b/refs.c index aab14fc..b29e2f4 100644 --- a/refs.c +++ b/refs.c @@ -361,7 +361,7 @@ static int log_ref_write(struct ref_lock char *logrec; const char *committer; - if (log_all_ref_updates) { + if (log_all_ref_updates || lock->force_log) { if (safe_create_leading_directories(lock->log_file) < 0) return error("unable to create directory for %s", lock->log_file); diff --git a/refs.h b/refs.h index 553155c..d4798c9 100644 --- a/refs.h +++ b/refs.h @@ -7,7 +7,8 @@ struct ref_lock { struct lock_file *lk; unsigned char old_sha1[20]; int lock_fd; - int force_write; + int force_write; /* force creating ref if not present */ + int force_log; /* force creating log if not present */ }; /* -- 1.4.2.ga2654 -- VGER BF report: U 0.5 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html