Russ Allbery <r...@debian.org> writes:
> YABUKI Yukiharu <yab...@netfort.gr.jp> writes:

>> I use yadm with bash. I use yadm command frequency. Once a day, yadm
>> works fine with bash. But nowadays, yadm does not do completions with
>> bash. I just switch in zsh. It look yadm completion is fine.

> This works for me on one system and not on another, both with the same
> version of yadm, so I think something changed in bash.  On the working
> system, I have bash 5.1~rc2-1, and on the broken system, I have bash
> 5.1-2.  Both have the same version of bash-completion.

> I haven't yet tracked down what the change was.

I found the problem, and I think it's a change in Git.  The yadm
completion rules delegate some of the work to the Git completion rules,
but the Git completion rules were restructured to remove an old
compatibility function that yadm was relying on.

The following diff seems to fix the problem.  I'm not sure if there's a
better solution.  This is upstream issue
https://github.com/TheLocehiliosan/yadm/issues/318 (although the symptoms
there are different).

--- yadm.bash.orig      2021-01-31 12:49:38.002713695 -0800
+++ yadm.bash   2021-01-31 12:46:10.194337545 -0800
@@ -1,10 +1,10 @@
 # test if git completion is missing, but loader exists, attempt to load
-if ! declare -F _git > /dev/null && declare -F _completion_loader > /dev/null; 
then
+if ! declare -F _git > /dev/null && ! declare -F __git > /dev/null && declare 
-F _completion_loader > /dev/null; then
   _completion_loader git
 fi
 
 # only operate if git completion is present
-if declare -F _git > /dev/null; then
+if declare -F _git > /dev/null || declare -F __git > /dev/null; then
 
   _yadm() {
 
@@ -66,7 +66,11 @@
     if [[ " ${yadm_switches[*]} " != *" $penultimate "* ]]; then
       # TODO: somehow solve the problem with [--yadm-xxx option] being
       #       incompatible with what git expects, namely [--arg=option]
-      _git
+      if declare -F _git > /dev/null; then
+        _git
+      else
+        __git_wrap__git_main
+      fi
     fi
     if [[ "$current" =~ ^- ]]; then
       local matching

-- 
Russ Allbery (r...@debian.org)              <https://www.eyrie.org/~eagle/>

Reply via email to