range-diff: indent the diffs just like tbdiff
[gitweb.git] / refs.c
diff --git a/refs.c b/refs.c
index 0eb379f9312fd9f167fea2e0f148c85c47cd2ff0..457fb78057a9375eb2b2cda44214a1705a28fc1e 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -9,6 +9,7 @@
 #include "iterator.h"
 #include "refs.h"
 #include "refs/refs-internal.h"
+#include "object-store.h"
 #include "object.h"
 #include "tag.h"
 #include "submodule.h"
@@ -304,7 +305,7 @@ enum peel_status peel_object(const struct object_id *name, struct object_id *oid
 
        if (o->type == OBJ_NONE) {
                int type = oid_object_info(the_repository, name, NULL);
-               if (type < 0 || !object_as_type(o, type, 0))
+               if (type < 0 || !object_as_type(the_repository, o, type, 0))
                        return PEEL_INVALID;
        }
 
@@ -786,25 +787,21 @@ int delete_ref(const char *msg, const char *refname,
                               old_oid, flags);
 }
 
-int copy_reflog_msg(char *buf, const char *msg)
+void copy_reflog_msg(struct strbuf *sb, const char *msg)
 {
-       char *cp = buf;
        char c;
        int wasspace = 1;
 
-       *cp++ = '\t';
+       strbuf_addch(sb, '\t');
        while ((c = *msg++)) {
                if (wasspace && isspace(c))
                        continue;
                wasspace = isspace(c);
                if (wasspace)
                        c = ' ';
-               *cp++ = c;
+               strbuf_addch(sb, c);
        }
-       while (buf < cp && isspace(cp[-1]))
-               cp--;
-       *cp++ = '\n';
-       return cp - buf;
+       strbuf_rtrim(sb);
 }
 
 int should_autocreate_reflog(const char *refname)