Merge branch 'js/maint-reflog-beyond-horizon'
authorJunio C Hamano <gitster@pobox.com>
Sat, 4 Sep 2010 05:24:29 +0000 (22:24 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sat, 4 Sep 2010 05:24:29 +0000 (22:24 -0700)
* js/maint-reflog-beyond-horizon:
t1503: fix broken test_must_fail calls
rev-parse: tests git rev-parse --verify master@{n}, for various n
sha1_name.c: use warning in preference to fprintf(stderr
rev-parse: exit with non-zero status if ref@{n} is not valid.

1  2 
sha1_name.c
diff --combined sha1_name.c
index 4af94fa59806c570c177a68139b54d46772d68a5,13209dc5b81c7de3cec109b9c9d17427893c066f..7b7e61719fa63e41917b41240061c68e3cbabf01
@@@ -342,7 -342,7 +342,7 @@@ static int get_sha1_1(const char *name
  
  static int get_sha1_basic(const char *str, int len, unsigned char *sha1)
  {
-       static const char *warning = "warning: refname '%.*s' is ambiguous.\n";
+       static const char *warn_msg = "refname '%.*s' is ambiguous.";
        char *real_ref = NULL;
        int refs_found = 0;
        int at, reflog_len;
                return -1;
  
        if (warn_ambiguous_refs && refs_found > 1)
-               fprintf(stderr, warning, len, str);
+               warning(warn_msg, len, str);
  
        if (reflog_len) {
                int nth, i;
                if (read_ref_at(real_ref, at_time, nth, sha1, NULL,
                                &co_time, &co_tz, &co_cnt)) {
                        if (at_time)
-                               fprintf(stderr,
-                                       "warning: Log for '%.*s' only goes "
-                                       "back to %s.\n", len, str,
+                               warning("Log for '%.*s' only goes "
+                                       "back to %s.", len, str,
                                        show_date(co_time, co_tz, DATE_RFC2822));
-                       else
-                               fprintf(stderr,
-                                       "warning: Log for '%.*s' only has "
-                                       "%d entries.\n", len, str, co_cnt);
+                       else {
+                               free(real_ref);
+                               die("Log for '%.*s' only has %d entries.",
+                                   len, str, co_cnt);
+                       }
                }
        }
  
@@@ -659,16 -659,6 +659,16 @@@ static int get_sha1_1(const char *name
        return get_short_sha1(name, len, sha1, 0);
  }
  
 +/*
 + * This interprets names like ':/Initial revision of "git"' by searching
 + * through history and returning the first commit whose message starts
 + * the given regular expression.
 + *
 + * For future extension, ':/!' is reserved. If you want to match a message
 + * beginning with a '!', you have to repeat the exclamation mark.
 + */
 +#define ONELINE_SEEN (1u<<20)
 +
  static int handle_one_ref(const char *path,
                const unsigned char *sha1, int flag, void *cb_data)
  {
        if (object->type != OBJ_COMMIT)
                return 0;
        insert_by_date((struct commit *)object, list);
 +      object->flags |= ONELINE_SEEN;
        return 0;
  }
  
 -/*
 - * This interprets names like ':/Initial revision of "git"' by searching
 - * through history and returning the first commit whose message matches
 - * the given regular expression.
 - *
 - * For future extension, ':/!' is reserved. If you want to match a message
 - * beginning with a '!', you have to repeat the exclamation mark.
 - */
 -
 -#define ONELINE_SEEN (1u<<20)
  static int get_sha1_oneline(const char *prefix, unsigned char *sha1)
  {
        struct commit_list *list = NULL, *backup = NULL, *l;