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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Mar 2, 2017 at 03:21 UTC
e322b60d65a14578995839caa5f48f5426236fdf
2 files changed
+21
-21
cache.h
+21
@@ -1292,6 +1292,27 @@ extern char *oid_to_hex_r(char *out, const struct object_id *oid);
1292
extern char *sha1_to_hex(const unsigned char *sha1); /* static buffer result! */
1293
extern char *oid_to_hex(const struct object_id *oid); /* same static buffer as sha1_to_hex */
1294
1295
+/*
1296
+ * This reads short-hand syntax that not only evaluates to a commit
1297
+ * object name, but also can act as if the end user spelled the name
1298
+ * of the branch from the command line.
1299
+ *
1300
+ * - "@{-N}" finds the name of the Nth previous branch we were on, and
1301
+ * places the name of the branch in the given buf and returns the
1302
+ * number of characters parsed if successful.
1303
+ *
1304
+ * - "<branch>@{upstream}" finds the name of the other ref that
1305
+ * <branch> is configured to merge with (missing <branch> defaults
1306
+ * to the current branch), and places the name of the branch in the
1307
+ * given buf and returns the number of characters parsed if
1308
+ * successful.
1309
+ *
1310
+ * If the input is not of the accepted format, it returns a negative
1311
+ * number to signal an error.
1312
+ *
1313
+ * If the input was ok but there are not N branch switches in the
1314
+ * reflog, it returns 0.
1315
+ */
1316
extern int interpret_branch_name(const char *str, int len, struct strbuf *);
1317
extern int get_oid_mb(const char *str, struct object_id *oid);
1318
sha1_name.c
-21
@@ -1238,27 +1238,6 @@ static int interpret_branch_mark(const char *name, int namelen,
1238
return len + at;
1239
}
1240
1241
-/*
1242
- * This reads short-hand syntax that not only evaluates to a commit
1243
- * object name, but also can act as if the end user spelled the name
1244
- * of the branch from the command line.
1245
- *
1246
- * - "@{-N}" finds the name of the Nth previous branch we were on, and
1247
- * places the name of the branch in the given buf and returns the
1248
- * number of characters parsed if successful.
1249
- *
1250
- * - "<branch>@{upstream}" finds the name of the other ref that
1251
- * <branch> is configured to merge with (missing <branch> defaults
1252
- * to the current branch), and places the name of the branch in the
1253
- * given buf and returns the number of characters parsed if
1254
- * successful.
1255
- *
1256
- * If the input is not of the accepted format, it returns a negative
1257
- * number to signal an error.
1258
- *
1259
- * If the input was ok but there are not N branch switches in the
1260
- * reflog, it returns 0.
1261
- */
1241
int interpret_branch_name(const char *name, int namelen, struct strbuf *buf)
1242
{
1243
char *at;