@@ -162,11 +162,11 @@ static void setup_tracking(const char *new_ref, const char *orig_ref,
free(tracking.src);
}
-int read_branch_desc(struct strbuf *buf, const char *branch_name)
+static int read_branch_config(struct strbuf *buf, const char *branch_name, const char *key)
{
char *v = NULL;
struct strbuf name = STRBUF_INIT;
- strbuf_addf(&name, "branch.%s.description", branch_name);
+ strbuf_addf(&name, "branch.%s.%s", branch_name, key);
if (git_config_get_string(name.buf, &v)) {
strbuf_release(&name);
return -1;
@@ -177,6 +177,11 @@ int read_branch_desc(struct strbuf *buf, const char *branch_name)
return 0;
}
+int read_branch_desc(struct strbuf *buf, const char *branch_name)
+{
+ return read_branch_config(buf, branch_name, "description");
+}
+
/*
* Check if 'name' can be a valid name for a branch; die otherwise.
* Return 1 if the named branch already exists; return 0 otherwise.
In the future, we'll need to use `read_branch_config` as a generic base for other branch-config reading functions. Extract it from `read_branch_desc` so that it can be reused later. Signed-off-by: Denton Liu <liu.denton@gmail.com> --- branch.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)