[git-users] Re: Bash completion bug

2015-10-28 Thread Dmitry Kuzmenko
Another quick fix that looks working: added __git_refs variant which looks 
for refs only, not directory structure. Call it for git pull.

$ diff -u /usr/share/bash-completion/completions/git ~/tmp/git 
--- /usr/share/bash-completion/completions/git  2015-10-22 01:54:
32.0 +0300
+++ /home/dimm/tmp/git  2015-10-28 16:16:57.315415364 +0300
@@ -399,6 +399,28 @@
done   


  
 } 


  



 
+__git_refs_no_dir ()
+{
+   local i hash dir="$(__gitdir "${1-}")" track="${2-}"
+   local format refs
+   case "$cur" in
+   refs|refs/*)
+   git ls-remote "$dir" "$cur*" 2>/dev/null | \
+   while read -r hash i; do
+   case "$i" in
+   *^{}) ;;
+   *) echo "$i" ;;
+   esac
+   done
+   ;;
+   *)
+   echo "HEAD"
+   git for-each-ref --format="%(refname:short)" -- \
+   "refs/remotes/$dir/" 2>/dev/null | sed -e 
"s#^$dir/##"
+   ;;
+   esac
+}
+
 # __git_refs_remotes requires 1 argument (to pass to ls-remote)
 __git_refs_remotes ()
 {
@@ -586,7 +608,7 @@
;;
pull|remote)
if [ $lhs = 1 ]; then
-   __gitcomp_nl "$(__git_refs "$remote")" "$pfx" 
"$cur_"
+   __gitcomp_nl "$(__git_refs_no_dir "$remote")" 
"$pfx" "$cur_"
else
__gitcomp_nl "$(__git_refs)" "$pfx" "$cur_"
fi

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[git-users] Re: Bash completion bug

2015-10-28 Thread Dmitry Kuzmenko
Just found the fix doesn't work. It should be fixed somewhere deeper in the 
logic

-- 
You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.