diff --git a/git_deploy.module b/git_deploy.module index 91284a0..c72745d 100644 --- a/git_deploy.module +++ b/git_deploy.module @@ -105,10 +105,19 @@ function git_deploy_system_info_alter(array &$info, Extension $file, $type) { $last_difference = $difference; $last_branch = $branch; } - $info['version'] = "$branch-dev"; // Find most recent common commit between local and remote // branch. - $last_tag = exec("$git merge-base HEAD origin/$branch"); + $base = exec("$git merge-base HEAD origin/$branch"); + if ($base == $last_tag_hash) { + // Our commits are based on a tag. + $last_tag = $matches[1]; + $info['version'] = $last_tag; + } + else { + // Our commits are based on a branch. + $last_tag = $base; + $info['version'] = "$branch-dev"; + } } else { $info['version'] = $matches[1] . '+' . $matches[3] . 'dev';