Skip to content

Commit 7ba3c07

Browse files
spearceJunio C Hamano
authored andcommitted
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>
1 parent eff7375 commit 7ba3c07

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

merge-recursive.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1248,6 +1248,18 @@ static int merge(struct commit *h1,
12481248
return clean;
12491249
}
12501250

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+
12511263
static struct commit *get_ref(const char *ref)
12521264
{
12531265
unsigned char sha1[20];
@@ -1263,18 +1275,6 @@ static struct commit *get_ref(const char *ref)
12631275
return (struct commit *)object;
12641276
}
12651277

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-
12781278
int main(int argc, char *argv[])
12791279
{
12801280
static const char *bases[2];

0 commit comments

Comments
 (0)