[Possible Bug] --cruft option not work with git gc --prune=now

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am trying to use the --cruft feature of git gc, and everything works
well, but when I combine it with --prune=now, I notice that no cruft
package is generated, which is very strange. So I turned on trace and
checked: instead of executing `git repack --cruft`, it executed `git
repack -d -l -a`. Is this normal? If `git gc --cruft --prune=now`
doesn't work as expected, it won't be safe to further execute `git gc
--cruft --expire-to=<dir> --prune=now`(in my another patch).


I checked the code, and it appears that add_repack_all_option() first
processes `--prune=now` before handling `--cruft` option.

If this is a bug, I am willing to propose a patch to fix it.

```shell
GIT_TRACE=1 git gc --prune=now --cruft
19:56:54.132263 git.c:479               trace: built-in: git gc
--prune=now --cruft
19:56:54.137004 run-command.c:666       trace: run_command: git
pack-refs --all --prune
19:56:54.137087 run-command.c:758       trace: start_command:
/Users/adl/libexec/git-core/git pack-refs --all --prune
19:56:54.152233 git.c:479               trace: built-in: git pack-refs
--all --prune
19:56:54.166598 run-command.c:666       trace: run_command: git reflog
expire --all
19:56:54.166705 run-command.c:758       trace: start_command:
/Users/adl/libexec/git-core/git reflog expire --all
19:56:54.181965 git.c:479               trace: built-in: git reflog expire --all
19:56:54.184495 run-command.c:666       trace: run_command: git repack -d -l -a
19:56:54.184571 run-command.c:758       trace: start_command:
/Users/adl/libexec/git-core/git repack -d -l -a
19:56:54.196211 git.c:479               trace: built-in: git repack -d -l -a
19:56:54.198260 run-command.c:666       trace: run_command: git
pack-objects --local --delta-base-offset objects/pack/.tmp-59391-pack
--keep-true-parents --honor-pack-keep --non-empty --all --reflog
--indexed-objects --write-bitmap-index-quiet
19:56:54.198304 run-command.c:758       trace: start_command:
/Users/adl/libexec/git-core/git pack-objects --local
--delta-base-offset objects/pack/.tmp-59391-pack --keep-true-parents
--honor-pack-keep --non-empty --all --reflog --indexed-objects
--write-bitmap-index-quiet
19:56:54.209384 git.c:479               trace: built-in: git
pack-objects --local --delta-base-offset objects/pack/.tmp-59391-pack
--keep-true-parents --honor-pack-keep --non-empty --all --reflog
--indexed-objects --write-bitmap-index-quiet
Enumerating objects: 512819, done.
Counting objects: 100% (512819/512819), done.
Delta compression using up to 12 threads
Compressing objects: 100% (237575/237575), done.
Writing objects: 100% (512819/512819), done.
Selecting bitmap commits: 23999, done.
Building bitmaps: 100% (309/309), done.
Total 512819 (delta 116078), reused 512819 (delta 116078), pack-reused
0 (from 0)
19:57:12.783287 run-command.c:666       trace: run_command: git prune
--expire now
19:57:12.783887 run-command.c:758       trace: start_command:
/Users/adl/libexec/git-core/git prune --expire now
19:57:12.799337 git.c:479               trace: built-in: git prune --expire now
19:57:12.802050 run-command.c:666       trace: run_command: git
worktree prune --expire 3.months.ago
19:57:12.802115 run-command.c:758       trace: start_command:
/Users/adl/libexec/git-core/git worktree prune --expire 3.months.ago
19:57:12.812977 git.c:479               trace: built-in: git worktree
prune --expire 3.months.ago
19:57:12.814412 run-command.c:666       trace: run_command: git rerere gc
19:57:12.814476 run-command.c:758       trace: start_command:
/Users/adl/libexec/git-core/git rerere gc
19:57:12.825732 git.c:479               trace: built-in: git rerere gc
```

--
ZheNing Hu




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux