Skip to content

Commit

Permalink
Move better_branch_name above get_ref in merge-recursive.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Shawn O. Pearce authored and Junio C Hamano committed Dec 29, 2006
1 parent eff7375 commit 7ba3c07
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions merge-recursive.c
Original file line number Diff line number Diff line change
Expand Up @@ -1248,6 +1248,18 @@ static int merge(struct commit *h1,
return clean;
}

static const char *better_branch_name(const char *branch)
{
static char githead_env[8 + 40 + 1];
char *name;

if (strlen(branch) != 40)
return branch;
sprintf(githead_env, "GITHEAD_%s", branch);
name = getenv(githead_env);
return name ? name : branch;
}

static struct commit *get_ref(const char *ref)
{
unsigned char sha1[20];
Expand All @@ -1263,18 +1275,6 @@ static struct commit *get_ref(const char *ref)
return (struct commit *)object;
}

static const char *better_branch_name(const char *branch)
{
static char githead_env[8 + 40 + 1];
char *name;

if (strlen(branch) != 40)
return branch;
sprintf(githead_env, "GITHEAD_%s", branch);
name = getenv(githead_env);
return name ? name : branch;
}

int main(int argc, char *argv[])
{
static const char *bases[2];
Expand Down

0 comments on commit 7ba3c07

Please sign in to comment.