From a8e3af5999bfc3b68f320bcda1a098923be2130d Mon Sep 17 00:00:00 2001
From: Douwe Maan <douwe@selenight.nl>
Date: Mon, 7 Dec 2015 12:17:21 +0100
Subject: [PATCH] Tweak archive filename

---
 CHANGELOG                    | 4 ++++
 lib/gitlab_git/repository.rb | 9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/CHANGELOG b/CHANGELOG
index b65cddb..347bb38 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,3 +1,7 @@
+v 7.2.21 (unreleased)
+  - Don't include commit ID in archive of tag
+  - Don't include commit ID twice in archive of specific commit
+
 v 7.2.20
   - Switch back to GitHub Linguist and bump rugged and other gem versions
   - Add method on repository to create branch
diff --git a/lib/gitlab_git/repository.rb b/lib/gitlab_git/repository.rb
index 1d81a7c..0d6b2b7 100644
--- a/lib/gitlab_git/repository.rb
+++ b/lib/gitlab_git/repository.rb
@@ -144,7 +144,14 @@ module Gitlab
         return {} if commit.nil?
 
         project_name = self.name.chomp('.git')
-        prefix = "#{project_name}-#{ref}-#{commit.id}"
+        prefix =
+          if tag_names.include?(ref)
+            "#{project_name}-#{ref}"
+          elsif branch_names.include?(ref)
+            "#{project_name}-#{ref}-#{commit.id}"
+          else
+            "#{project_name}-#{commit.id}"
+          end
 
         {
           'RepoPath' => path,
-- 
GitLab