Code

Bisect visualize: use "for-each-ref" to list all good refs.
[git.git] / refs.c
diff --git a/refs.c b/refs.c
index 0dc5678079b6e6d40a06f48d14a9f73465cb9243..ae532540cf2592aee2be7610ac811082c3a9b6be 100644 (file)
--- a/refs.c
+++ b/refs.c
@@ -580,18 +580,6 @@ int for_each_remote_ref(each_ref_fn fn, void *cb_data)
        return do_for_each_ref("refs/remotes/", fn, 13, cb_data);
 }
 
-/* NEEDSWORK: This is only used by ssh-upload and it should go; the
- * caller should do resolve_ref or read_ref like everybody else.  Or
- * maybe everybody else should use get_ref_sha1() instead of doing
- * read_ref().
- */
-int get_ref_sha1(const char *ref, unsigned char *sha1)
-{
-       if (check_ref_format(ref))
-               return -1;
-       return read_ref(mkpath("refs/%s", ref), sha1);
-}
-
 /*
  * Make sure "ref" is something reasonable to have under ".git/refs/";
  * We do not like it if:
@@ -1213,15 +1201,11 @@ int create_symref(const char *ref_target, const char *refs_heads_master,
 static char *ref_msg(const char *line, const char *endp)
 {
        const char *ep;
-       char *msg;
-
        line += 82;
-       for (ep = line; ep < endp && *ep != '\n'; ep++)
-               ;
-       msg = xmalloc(ep - line + 1);
-       memcpy(msg, line, ep - line);
-       msg[ep - line] = 0;
-       return msg;
+       ep = memchr(line, '\n', endp - line);
+       if (!ep)
+               ep = endp;
+       return xmemdupz(line, ep - line);
 }
 
 int read_ref_at(const char *ref, unsigned long at_time, int cnt, unsigned char *sha1, char **msg, unsigned long *cutoff_time, int *cutoff_tz, int *cutoff_cnt)