receive-pack.c: shorten the execute_commands loop over all commands
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index bf152aab32d2fee0fc51335850a71a93f207b0d8..14e52caea5aadb44a9b1b84f25019437159dd460 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -6,6 +6,15 @@
 #include "dir.h"
 #include "string-list.h"
 
+struct ref_lock {
+       char *ref_name;
+       char *orig_ref_name;
+       struct lock_file *lk;
+       unsigned char old_sha1[20];
+       int lock_fd;
+       int force_write;
+};
+
 /*
  * How to handle various characters in refnames:
  * 0: An acceptable character for refs
@@ -2346,13 +2355,6 @@ static struct ref_lock *lock_ref_sha1_basic(const char *refname,
        return NULL;
 }
 
-struct ref_lock *lock_any_ref_for_update(const char *refname,
-                                        const unsigned char *old_sha1,
-                                        int flags, int *type_p)
-{
-       return lock_ref_sha1_basic(refname, old_sha1, NULL, flags, type_p);
-}
-
 /*
  * Write an entry to the packed-refs file for the specified refname.
  * If peeled is non-NULL, write it as the entry's peeled value.
@@ -3970,12 +3972,9 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
                        printf("prune %s", message);
        } else {
                if (cb->newlog) {
-                       char sign = (tz < 0) ? '-' : '+';
-                       int zone = (tz < 0) ? (-tz) : tz;
-                       fprintf(cb->newlog, "%s %s %s %lu %c%04d\t%s",
+                       fprintf(cb->newlog, "%s %s %s %lu %+05d\t%s",
                                sha1_to_hex(osha1), sha1_to_hex(nsha1),
-                               email, timestamp, sign, zone,
-                               message);
+                               email, timestamp, tz, message);
                        hashcpy(cb->last_kept_sha1, nsha1);
                }
                if (cb->flags & EXPIRE_REFLOGS_VERBOSE)
@@ -4007,7 +4006,7 @@ int reflog_expire(const char *refname, const unsigned char *sha1,
         * reference itself, plus we might need to update the
         * reference if --updateref was specified:
         */
-       lock = lock_any_ref_for_update(refname, sha1, 0, NULL);
+       lock = lock_ref_sha1_basic(refname, sha1, NULL, 0, NULL);
        if (!lock)
                return error("cannot lock ref '%s'", refname);
        if (!reflog_exists(refname)) {