Learn more about these different git repos.
Other Git URLs
git_dir_pack needs to produce the same content no matter if the work tree is clean or dirty.
git_dir_pack
From fedora-buildys IRC channel:
+lsm5 | some further info, looks like it succeeds when I trigger it locally with `rpkg copr-build..` https://copr.fedorainfracloud.org/coprs/rhcontainerbot/podman-next/build/3194584/ +lsm5 | if nothing else, I guess I'll just wait for the next PR merge +lsm5 | clime: thanks in advance! clime | praiskup: i think, in copr it is still rpkg 2? praiskup | clime, yes, for another week or two praiskup | (we struggle with the F35 migration) clime | lsm5: ok, well, in rpkg 3, actually git archive is underlyingly used for Source0 creation, which includes .gitignore files in the archive as well. In version 2, tar is used which excludes the vendor/syn/tests/.gitignore file which then causes | the build failure. clime | so because you used f35 for your srpm build with rpkg 3.0, you got a correct archive +lsm5 | i see +lsm5 | that's helpful +lsm5 | thanks clime | np, that being said you probably also discovered a bug in version 3, because if you made you directory dirty, then tar would be used for git_dir_pack (instead of git archive which is used for clean trees) and it seems also in rpkg version 3, | it would exclude the .gitignore file, so that's something i will need to look at :)
So probably the best solution here is not to use tar but instead do commit_id=$(git stash create) and then git archive the resulting commit_id. This also means we no longer need to use pack_sources script. and construct exclude list for it.
commit_id=$(git stash create)
pack_sources
The git stash create command is available in git 1.8 but it has one disadvantage that it requires at least one existing commit to work. It also creates a dangling commit in repo so maybe we should advise user to run git gc occassionally for that?
git stash create
git gc
I tested git stash create on another project and there is a problem that sometimes it returns non-zero status without giving a reason: subprocess.CalledProcessError: Command '['git', 'stash', 'create']' returned non-zero exit status 1.
subprocess.CalledProcessError: Command '['git', 'stash', 'create']' returned non-zero exit status 1.
Also when .git/index.lock exists, it doesn't proceed with error: fatal: Unable to create '.git/index.lock': File exists.
.git/index.lock
fatal: Unable to create '.git/index.lock': File exists.
So more investigation into this should be done.
Regarding spurious git stash create errors: https://public-inbox.org/git/CAGqZTUuLNoZR7L9r1unR75S4Gte83DGSV2QUnGG2PqQOPBigAg@mail.gmail.com/ (no answer yet).
It seems the best would be to keep using tar, hard-exclude .git and additionally use git check-attr to find out what should be excluded by .gitattributes.
.git
git check-attr
.gitattributes
Login to comment on this ticket.