5 static const char git_symbolic_ref_usage
[] =
6 "git-symbolic-ref [-q] name [ref]";
8 static void check_symref(const char *HEAD
, int quiet
)
10 unsigned char sha1
[20];
12 const char *refs_heads_master
= resolve_ref(HEAD
, sha1
, 0, &flag
);
14 if (!refs_heads_master
)
15 die("No such ref: %s", HEAD
);
16 else if (!(flag
& REF_ISSYMREF
)) {
18 die("ref %s is not a symbolic ref", HEAD
);
22 puts(refs_heads_master
);
25 int cmd_symbolic_ref(int argc
, const char **argv
, const char *prefix
)
29 git_config(git_default_config
);
32 const char *arg
= argv
[1];
35 else if (!strcmp("-q", arg
))
37 else if (!strcmp("--", arg
)) {
43 die("unknown option %s", arg
);
50 check_symref(argv
[1], quiet
);
53 create_symref(argv
[1], argv
[2]);
56 usage(git_symbolic_ref_usage
);