“倾倒”;git日志--注释;去壳管?

“倾倒”;git日志--注释;去壳管?,git,bash,pipeline,Git,Bash,Pipeline,我似乎无法使用git log为机器消费生成注释 git log将打开less,显示寻呼机和注释 git--无寻呼机日志[--notes |--show notes]不会显示注释 git——无寻呼机日志——notes | less将显示notes git——没有寻呼机日志——notes | less | cat不会 git-log--notes>gitlog.txt有效,但我试图避免管理文件 cat&1 | cat 1>&2 | cat不工作 我很困惑,是什么黑魔法导致了我想要的部分数据被删除,

我似乎无法使用
git log
为机器消费生成注释

git log
将打开
less
,显示寻呼机和注释

git--无寻呼机日志[--notes |--show notes]
不会显示注释

git——无寻呼机日志——notes | less
将显示notes

git——没有寻呼机日志——notes | less | cat
不会

git-log--notes>gitlog.txt
有效,但我试图避免管理文件

cat&1 | cat 1>&2 | cat
不工作


我很困惑,是什么黑魔法导致了我想要的部分数据被删除,但显然只有在显示时才被删除


另外,如果你对所有无用的cats使用感到不安,想象一下perl/sed/grep/awk过滤器,最终我会尝试去掉一些换行符,这样便笺的值会附加到
git日志--oneline
格式的行中。

对于git 2.12.2,我完全无法重现这种行为(关于:未打印便笺)如问题所述


也就是说,以下命令执行请求的操作,并且不会创建临时文件(在任何系统上,bash可以在编译时检测到
/dev/fd
/proc/self/fd
支持),并生成一行输出,每行都附加注释:

#!/bin/bash

in_note=0
notes=
last_line=

while IFS= read -r line; do
  if (( in_note == 0 )) && [[ $line = "Notes:" ]]; then  ## at the start of a note
    in_note=1; continue
  fi
  if (( in_note == 0 )); then                            ## outside any note
    [[ $last_line ]] && printf '%s\n' "$last_line"
    last_line=$line
    continue
  fi
  if [[ $line = "" ]]; then                              ## at the end of a note
    in_note=0
    printf '%s|%s\n' "$last_line" "$notes"
    last_line=
    continue
  fi
  # all notes are prefixed by four spaces, so the below doesn't need extra spacing
  notes+="$line"                                         ## inside of a note
done < <(git log --oneline --notes)
[[ $last_line ]] && printf '%s\n' "$last_line"
#/bin/bash
in_note=0
注释=
最后一行=
而IFS=读取-r行;做
如果((in_note==0))&&[$line=“Notes:”];然后在一个音符的开头
注中=1;持续
fi
如果((in_note==0));然后,在任何音符之外
[[$last\u line]]&&printf'%s\n'$last\u line'
最后一行=$line
持续
fi
如果[[$line=”“];然后在一个音符的结尾
in_note=0
printf“%s”|%s\n“$last_line”“$notes”
最后一行=
持续
fi
#所有注释的前缀都有四个空格,因此下面的注释不需要额外的空格
便笺+=“$line”##便笺内

完成
git-notes
单独查找了吗?奇怪的是,这个命令对我有效:
git--no-pager-log--notes
。另外,我相信默认情况下,
--notes
是存在的,那么命令
git--no pager log
,是否有效?如果没有,那么如何
GIT\u PAGER=cat GIT log--notes
BTW,
cat