diff options
author | Jiang Xin <zhiyou.jx@alibaba-inc.com> | 2021-01-11 21:27:03 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-01-11 21:50:41 -0800 |
commit | 5bb0fd2cab5a18bc188c8154097857f51a0e9feb (patch) | |
tree | ac6801a1892609e2da0ab5d767d4af6225ba0210 /INSTALL | |
parent | bundle: lost objects when removing duplicate pendings (diff) | |
download | tgif-5bb0fd2cab5a18bc188c8154097857f51a0e9feb.tar.xz |
bundle: arguments can be read from stdin
In order to create an incremental bundle, we need to pass many arguments
to let git-bundle ignore some already packed commits. It will be more
convenient to pass args via stdin. But the current implementation does
not allow us to do this.
This is because args are parsed twice when creating bundle. The first
time for parsing args is in `compute_and_write_prerequisites()` by
running `git-rev-list` command to write prerequisites in bundle file,
and stdin is consumed in this step if "--stdin" option is provided for
`git-bundle`. Later nothing can be read from stdin when running
`setup_revisions()` in `create_bundle()`.
The solution is to parse args once by removing the entire function
`compute_and_write_prerequisites()` and then calling function
`setup_revisions()`. In order to write prerequisites for bundle, will
call `prepare_revision_walk()` and `traverse_commit_list()`. But after
calling `prepare_revision_walk()`, the object array `revs.pending` is
left empty, and the following steps could not work properly with the
empty object array (`revs.pending`). Therefore, make a copy of `revs`
to `revs_copy` for later use right after calling `setup_revisions()`.
The copy of `revs_copy` is not a deep copy, it shares the same objects
with `revs`. The object array of `revs` has been cleared, but objects
themselves are still kept. Flags of objects may change after calling
`prepare_revision_walk()`, we can use these changed flags without
calling the `git rev-list` command and parsing its output like the
former implementation.
Also add testcases for git bundle in t6020, which read args from stdin.
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'INSTALL')
0 files changed, 0 insertions, 0 deletions