From e322b60d65a14578995839caa5f48f5426236fdf Mon Sep 17 00:00:00 2001 From: Jeff King Date: Thu, 2 Mar 2017 03:21:23 -0500 Subject: [PATCH] interpret_branch_name: move docstring to header file We generally put docstrings with function declarations, because it's the callers who need to know how the function works. Let's do so for interpret_branch_name(). Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- cache.h | 21 +++++++++++++++++++++ sha1_name.c | 21 --------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/cache.h b/cache.h index 5c035dae57..81c59d4af4 100644 --- a/cache.h +++ b/cache.h @@ -1292,6 +1292,27 @@ extern char *oid_to_hex_r(char *out, const struct object_id *oid); extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */ extern char *oid_to_hex(const struct object_id *oid); /* same static buffer as sha1_to_hex */ +/* + * This reads short-hand syntax that not only evaluates to a commit + * object name, but also can act as if the end user spelled the name + * of the branch from the command line. + * + * - "@{-N}" finds the name of the Nth previous branch we were on, and + * places the name of the branch in the given buf and returns the + * number of characters parsed if successful. + * + * - "@{upstream}" finds the name of the other ref that + * is configured to merge with (missing defaults + * to the current branch), and places the name of the branch in the + * given buf and returns the number of characters parsed if + * successful. + * + * If the input is not of the accepted format, it returns a negative + * number to signal an error. + * + * If the input was ok but there are not N branch switches in the + * reflog, it returns 0. + */ extern int interpret_branch_name(const char *str, int len, struct strbuf *); extern int get_oid_mb(const char *str, struct object_id *oid); diff --git a/sha1_name.c b/sha1_name.c index 9b5d14b4bf..28865b3a1f 100644 --- a/sha1_name.c +++ b/sha1_name.c @@ -1238,27 +1238,6 @@ static int interpret_branch_mark(const char *name, int namelen, return len + at; } -/* - * This reads short-hand syntax that not only evaluates to a commit - * object name, but also can act as if the end user spelled the name - * of the branch from the command line. - * - * - "@{-N}" finds the name of the Nth previous branch we were on, and - * places the name of the branch in the given buf and returns the - * number of characters parsed if successful. - * - * - "@{upstream}" finds the name of the other ref that - * is configured to merge with (missing defaults - * to the current branch), and places the name of the branch in the - * given buf and returns the number of characters parsed if - * successful. - * - * If the input is not of the accepted format, it returns a negative - * number to signal an error. - * - * If the input was ok but there are not N branch switches in the - * reflog, it returns 0. - */ int interpret_branch_name(const char *name, int namelen, struct strbuf *buf) { char *at; -- 2.11.4.GIT