From 06feb3c44231ab3fb8ac26c00d606587ac90a11c Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Fri, 22 Nov 2013 12:41:55 +0200 Subject: [PATCH] Cleanup parsed refs for git over HTTP --- lib/gitlab/backend/grack_auth.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/gitlab/backend/grack_auth.rb b/lib/gitlab/backend/grack_auth.rb index 39ffb5f..b1f99be 100644 --- a/lib/gitlab/backend/grack_auth.rb +++ b/lib/gitlab/backend/grack_auth.rb @@ -125,7 +125,15 @@ module Grack # Need to reset seek point @request.body.rewind - input.force_encoding('ascii-8bit').scan(/refs\/heads\/([\/\w\.-]+)/n).flatten.compact + + # Parse refs + refs = input.force_encoding('ascii-8bit').scan(/refs\/heads\/([\/\w\.-]+)/n).flatten.compact + + # Cleanup grabare from refs + # if push to multiple branches + refs.map do |ref| + ref.gsub(/0000PACK.*/, "") + end end end end -- libgit2 0.21.2