[PATCH v2 17/44] ruby: request-pull: use native git_config()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Felipe Contreras <felipe.contreras@xxxxxxxxx>
---
 git-request-pull.rb | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/git-request-pull.rb b/git-request-pull.rb
index 416f880..0f85024 100755
--- a/git-request-pull.rb
+++ b/git-request-pull.rb
@@ -14,6 +14,13 @@ EOF
   exit 1
 end
 
+def read_branch_desc(name)
+  git_config() do |key, value|
+    return value if key == "branch.#{name}.description"
+  end
+  return nil
+end
+
 def abbr(ref)
   if (ref =~ %r{^refs/heads/(.*)} || ref =~ %r{^refs/(tags/.*)})
     return $1
@@ -70,8 +77,8 @@ _, _, headref = dwim_ref(head)
 
 if headref.start_with?('refs/heads')
   branch_name = headref[11..-1]
-  branch_desc = `git config "branch.#{branch_name}.description"`.chomp
-  branch_name = nil if branch_desc.empty?
+  branch_desc = read_branch_desc(branch_name)
+  branch_name = nil if not branch_desc
 end
 
 tag_name = `git describe --exact "#{head}^0" 2>/dev/null`.chomp
-- 
1.8.4-fc

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]