return 0;
}
-static int head_atom_parser(struct ref_format *format, struct used_atom *atom,
+ static int ahead_behind_atom_parser(struct ref_format *format, struct used_atom *atom,
+ const char *arg, struct strbuf *err)
+ {
+ struct string_list_item *item;
+
+ if (!arg)
+ return strbuf_addf_ret(err, -1, _("expected format: %%(ahead-behind:<committish>)"));
+
+ item = string_list_append(&format->bases, arg);
+ item->util = lookup_commit_reference_by_name(arg);
+ if (!item->util)
+ die("failed to find '%s'", arg);
+
+ return 0;
+ }
+
+static int head_atom_parser(struct ref_format *format UNUSED,
+ struct used_atom *atom,
const char *arg, struct strbuf *err)
{
if (arg)
#include "oid-array.h"
#include "refs.h"
#include "commit.h"
-#include "parse-options.h"
+ #include "string-list.h"
/* Quoting styles */
#define QUOTE_NONE 0
struct atom_value;
struct ref_sorting;
+ struct ahead_behind_count;
+struct option;
enum ref_sorting_order {
REF_SORTING_REVERSE = 1<<0,