- parent = 1;
- if (len > 2 && name[len-1] >= '1' && name[len-1] <= '9') {
- parent = name[len-1] - '0';
- len--;
- }
- if (len > 1 && name[len-1] == '^') {
- int ret;
- name[len-1] = 0;
- ret = get_parent(name, sha1, parent);
- name[len-1] = '^';
- if (!ret)
- return 0;
+ /* Hexadecimal string plus possibly a carret;
+ * this does not have to be quoted even under output_sq.
+ */
+ printf("%s%s%c", type == show_type ? "" : "^", sha1_to_hex(sha1),
+ output_sq ? ' ' : '\n');
+}
+
+static void show_rev_arg(char *rev)
+{
+ if (no_revs)
+ return;
+ show(rev);
+}
+
+static void show_norev(char *norev)
+{
+ if (flags_only)
+ return;
+ if (revs_only)
+ return;
+ show(norev);
+}
+
+static void show_arg(char *arg)
+{
+ if (no_flags)
+ return;
+ if (do_rev_argument && is_rev_argument(arg))
+ show_rev_arg(arg);
+ else
+ show_norev(arg);
+}
+
+static void show_default(void)
+{
+ char *s = def;
+
+ if (s) {
+ unsigned char sha1[20];
+
+ def = NULL;
+ if (!get_sha1(s, sha1)) {
+ show_rev(NORMAL, sha1);
+ return;
+ }
+ show_arg(s);