From: Shawn Pearce <spearce@spearce.org>
To: krh@redhat.com, Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] Rewrite branch in C and make it a builtin.
Date: Fri, 1 Sep 2006 21:08:06 -0400 [thread overview]
Message-ID: <20060902010806.GA24234@spearce.org> (raw)
In-Reply-To: <1156562127979-git-send-email-krh@redhat.com>
Kristian H??gsberg <krh@redhat.com> 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@spearce.org>
---
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
next prev parent reply other threads:[~2006-09-02 1:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-08-26 3:15 [PATCH] Rewrite branch in C and make it a builtin Kristian Høgsberg
2006-09-02 1:08 ` Shawn Pearce [this message]
2006-09-02 17:39 ` Kristian Høgsberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060902010806.GA24234@spearce.org \
--to=spearce@spearce.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
--cc=krh@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.