Commit 05dd95a2 authored by Rémy Coutable's avatar Rémy Coutable

Merge branch '1861-squash-commits-fails-with-older-branches' into 'master'

Resolve "Squash commits fails for branches named HEAD"

Closes #1861

See merge request !1391
parents 69930be4 56b0df19
...@@ -41,7 +41,7 @@ module MergeRequests ...@@ -41,7 +41,7 @@ module MergeRequests
) )
run_git_command( run_git_command(
%W(commit --no-verify -m #{merge_request.title}), %W(commit --no-verify --message #{merge_request.title}),
tree_path, tree_path,
git_env.merge('GIT_COMMITTER_NAME' => current_user.name, git_env.merge('GIT_COMMITTER_NAME' => current_user.name,
'GIT_COMMITTER_EMAIL' => current_user.email, 'GIT_COMMITTER_EMAIL' => current_user.email,
...@@ -50,8 +50,12 @@ module MergeRequests ...@@ -50,8 +50,12 @@ module MergeRequests
'commit squashed changes' 'commit squashed changes'
) )
# May print a warning for ambiguous refs, but we can ignore that with
# `--quiet` and just take the SHA, if present. HEAD here always refers to
# the current HEAD commit, even if there is another ref called HEAD.
#
squash_sha = run_git_command( squash_sha = run_git_command(
%w(rev-parse HEAD), %w(rev-parse --quiet --verify HEAD),
tree_path, tree_path,
git_env, git_env,
'get SHA of squashed commit' 'get SHA of squashed commit'
......
---
title: Fix squashing MRs when the repository contains a ref named HEAD
merge_request:
author:
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment