pack-objects: don't include missing preferred base objects
[gitweb.git] / sha1_name.c
index 491d2e7ebf19d5c582adbc5ece28d931b09b8a6d..41b680915d7348bf622397da8b1465d3769a361a 100644 (file)
@@ -273,7 +273,7 @@ int dwim_log(const char *str, int len, unsigned char *sha1, char **log)
                const char *ref, *it;
 
                strcpy(path, mkpath(*p, len, str));
-               ref = resolve_ref(path, hash, 0, NULL);
+               ref = resolve_ref(path, hash, 1, NULL);
                if (!ref)
                        continue;
                if (!stat(git_path("logs/%s", path), &st) &&
@@ -349,10 +349,16 @@ static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
                        else
                                nth = -1;
                }
-               if (0 <= nth)
+               if (100000000 <= nth) {
+                       at_time = nth;
+                       nth = -1;
+               } else if (0 <= nth)
                        at_time = 0;
-               else
-                       at_time = approxidate(str + at + 2);
+               else {
+                       char *tmp = xstrndup(str + at + 2, reflog_len);
+                       at_time = approxidate(tmp);
+                       free(tmp);
+               }
                if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
                                &co_time, &co_tz, &co_cnt)) {
                        if (at_time)