summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDavid Turner <dturner@twosigma.com>2016-12-01 23:06:41 -0500
committerDavid Turner <dturner@twosigma.com>2016-12-01 23:11:57 -0500
commit4db1fc7e5ead5c29ffb6594b229b84f4392b40f1 (patch)
treeddfe1a8b7b1b95f19224d5a3c9e64bf2b7504c84 /src
parentae5838f118a4819e608990a815bf8fc482be5772 (diff)
downloadlibgit2-4db1fc7e5ead5c29ffb6594b229b84f4392b40f1.tar.gz
git_rebase_init: correctly handle detached HEAD
git_rebase_finish relies on head_detached being set, but rebase_init_merge was only setting it when branch->ref_name was unset. But branch->ref_name would be set to "HEAD" in the case of detached HEAD being either implicitly (NULL) or explicitly passed to git_rebase_init.
Diffstat (limited to 'src')
-rw-r--r--src/rebase.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rebase.c b/src/rebase.c
index e86312e7e..0af2b3cf4 100644
--- a/src/rebase.c
+++ b/src/rebase.c
@@ -630,7 +630,7 @@ static int rebase_init_merge(
rebase->state_path = git_buf_detach(&state_path);
GITERR_CHECK_ALLOC(rebase->state_path);
- if (branch->ref_name) {
+ if (branch->ref_name && strcmp(branch->ref_name, "HEAD")) {
rebase->orig_head_name = git__strdup(branch->ref_name);
GITERR_CHECK_ALLOC(rebase->orig_head_name);
} else {