Merge branch 'nd/resolve-ref'
* nd/resolve-ref: Rename resolve_ref() to resolve_ref_unsafe() Convert resolve_ref+xstrdup to new resolve_refdup function revert: convert resolve_ref() to read_ref_full()
This commit is contained in:
@ -1100,6 +1100,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
struct commit_list *common = NULL;
|
||||
const char *best_strategy = NULL, *wt_strategy = NULL;
|
||||
struct commit_list **remotes = &remoteheads;
|
||||
void *branch_to_free;
|
||||
|
||||
if (argc == 2 && !strcmp(argv[1], "-h"))
|
||||
usage_with_options(builtin_merge_usage, builtin_merge_options);
|
||||
@ -1108,12 +1109,9 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
* Check if we are _not_ on a detached HEAD, i.e. if there is a
|
||||
* current branch.
|
||||
*/
|
||||
branch = resolve_ref("HEAD", head_sha1, 0, &flag);
|
||||
if (branch) {
|
||||
if (!prefixcmp(branch, "refs/heads/"))
|
||||
branch += 11;
|
||||
branch = xstrdup(branch);
|
||||
}
|
||||
branch = branch_to_free = resolve_refdup("HEAD", head_sha1, 0, &flag);
|
||||
if (branch && !prefixcmp(branch, "refs/heads/"))
|
||||
branch += 11;
|
||||
if (!branch || is_null_sha1(head_sha1))
|
||||
head_commit = NULL;
|
||||
else
|
||||
@ -1524,6 +1522,6 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
|
||||
ret = suggest_conflicts(option_renormalize);
|
||||
|
||||
done:
|
||||
free((char *)branch);
|
||||
free(branch_to_free);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user