xargs: git : 错误的文件号 [英] xargs: git : Bad file number

查看:34
本文介绍了xargs: git : 错误的文件号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人知道是什么导致了这个错误吗?

Anyone know what could cause this error?

我正在尝试使用以下命令在 git 上创建一个包:

I am trying to create a package on git using this command:

git diff -z --name-only --diff-filter=MAR 5e2a4b4 5261fe1 | xargs -s1000000 -0 git archive develop -o 'package.zip'

推荐答案

除了在 ssh 上出现错误(您已经排除)之外,还可能是 git archive 可以处理命令上的有限数量的参数线.

Apart from getting the error on ssh, which you've already ruled out, it could also be that git archive can handle a limited number of argument on the command line.

您已经(可疑地)使用 -s 限制了参数的总运行长度,并且您表示您的命令适用于某些提交,但不适用于其他提交.您可以通过设置 GIT_TRACE=1 来进一步调查差异.

You are already (suspiciously) limiting the total running length of the arguments with -s, and you indicated your command is working for some commits but not the others. You could investigate the difference further by setting GIT_TRACE=1.

通常,除了 -s 之外,还可以使用 xargs -n 来限制参数的数量,但要注意,这会多次执行传递给 xargs 的命令,当参数数量超过 -n 阈值,并且 git archive 不支持附加到存档时.您将不得不调用一个脚本,该脚本可以增加 zip 存档后缀的运行编号,以某种可接受的方式旋转 zip 文件名,或者将输出 zip 文件显式合并到主 zip 文件中.

Generally it is common to limit the number of arguments with xargs -n in addition to -s but beware as this will execute the command passed to xargs multiple times, when the number of arguments exceeds the -n threshold, and git archive doesn’t support appending to an archive. You will have to call a script instead, that can increment a running number for the zip archive suffix, rotate the zip filenames in some acceptable fashion, or explicitly merge the output zip files into a master zip file.

如果您在 cygwin 上运行,EBADF 还可能暗示对要存档的文件之一的权限被底层操作系统拒绝.

And if you are running on cygwin, EBADF can also imply that the permission to one of the files to be archived was denied by the underlying OS.

这篇关于xargs: git : 错误的文件号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆