Move better_branch_name above get_ref in merge-recursive.
To permit the get_ref function to use the static better_branch_name function to generate a string on demand I'm moving it up earlier. The actual logic was not affected in this change. Signed-off-by: Shawn O. Pearce <spearce@spearce.org> Signed-off-by: Junio C Hamano <junkio@cox.net>
Shawn O. Pearce committed
Dec 28, 2006 at 02:35 UTC
7ba3c078c76cbda00f7ed2ac16a659d8f48631ba
1 file changed
+12
-12
merge-recursive.c
+12
-12
@@ -1248,6 +1248,18 @@ static int merge(struct commit *h1,
1248
return clean;
1249
}
1250
1251
+static const char *better_branch_name(const char *branch)
1252
+{
1253
+ static char githead_env[8 + 40 + 1];
1254
+ char *name;
1255
+
1256
+ if (strlen(branch) != 40)
1257
+ return branch;
1258
+ sprintf(githead_env, "GITHEAD_%s", branch);
1259
+ name = getenv(githead_env);
1260
+ return name ? name : branch;
1261
+}
1262
+
1263
static struct commit *get_ref(const char *ref)
1264
{
1265
unsigned char sha1[20];
@@ -1263,18 +1275,6 @@ static struct commit *get_ref(const char *ref)
1275
return (struct commit *)object;
1276
}
1277
1266
-static const char *better_branch_name(const char *branch)
1267
-{
1268
- static char githead_env[8 + 40 + 1];
1269
- char *name;
1270
-
1271
- if (strlen(branch) != 40)
1272
- return branch;
1273
- sprintf(githead_env, "GITHEAD_%s", branch);
1274
- name = getenv(githead_env);
1275
- return name ? name : branch;
1276
-}
1277
-
1278
int main(int argc, char *argv[])
1279
{
1280
static const char *bases[2];