Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: git/git
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1041d58b4d9c587b2b6c76c3dfb14fbe78ccf196
Choose a base ref
...
head repository: git/git
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5cb28270a1ff94a0a23e67b479bbbec3bc993518
Choose a head ref
  • 6 commits
  • 8 files changed
  • 2 contributors

Commits on Mar 23, 2022

  1. list-objects-filter: remove CL_ARG__FILTER

    We have established the command-line interface for the --[no-]filter
    options for a while now, so we do not need a helper to make this
    editable in the future.
    
    Signed-off-by: Derrick Stolee <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    derrickstolee authored and gitster committed Mar 23, 2022
    Configuration menu
    Copy the full SHA
    cc91044 View commit details
    Browse the repository at this point in the history
  2. pack-objects: move revs out of get_object_list()

    We intend to parse the --filter option directly into revs.filter, but we
    first need to move the 'revs' variable out of get_object_list() and pass
    it as a pointer instead. This change only deals with the issues of
    making that work.
    
    Signed-off-by: Derrick Stolee <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    derrickstolee authored and gitster committed Mar 23, 2022
    Configuration menu
    Copy the full SHA
    80f6de4 View commit details
    Browse the repository at this point in the history
  3. pack-objects: parse --filter directly into revs.filter

    The previous change moved the 'revs' variable into cmd_pack_objects()
    and now we can remove the global filter_options in favor of revs.filter.
    
    Signed-off-by: Derrick Stolee <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    derrickstolee authored and gitster committed Mar 23, 2022
    Configuration menu
    Copy the full SHA
    831ee25 View commit details
    Browse the repository at this point in the history
  4. bundle: move capabilities to end of 'verify'

    The 'filter' capability was added in 105c6f1 (bundle: parse filter
    capability, 2022-03-09), but was added in a strange place in the 'git
    bundle verify' output.
    
    The tests for this show output like the following:
    
    	The bundle contains these 2 refs:
    	<COMMIT1> <REF1>
    	<COMMIT2> <REF2>
    	The bundle uses this filter: blob:none
    	The bundle records a complete history.
    
    This looks very odd if we have a thin bundle that contains boundary
    commits instead of a complete history:
    
    	The bundle contains these 2 refs:
    	<COMMIT1> <REF1>
    	<COMMIT2> <REF2>
    	The bundle uses this filter: blob:none
    	The bundle requires these 2 refs:
    	<COMMIT3>
    	<COMMIT4>
    
    This separation between tip refs and boundary refs is unfortunate. Move
    the filter capability output to the end of the output. Update the
    documentation to match.
    
    Signed-off-by: Derrick Stolee <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    derrickstolee authored and gitster committed Mar 23, 2022
    Configuration menu
    Copy the full SHA
    017303e View commit details
    Browse the repository at this point in the history
  5. bundle: output hash information in 'verify'

    The previous change moved the 'filter' capability to the end of the 'git
    bundle verify' output. Now, add the 'object-format' capability to the
    output, when it exists.
    
    This change makes 'git bundle verify' output the hash used in all cases,
    even if the capability is not in the bundle. This means that v2 bundles
    will always output that they use "sha1". This might look noisy to some
    users, but it does simplify the implementation and the test strategy for
    this feature.
    
    Since 'verify' ends early when a prerequisite commit is missing, we need
    to insert this hash message carefully into our expected test output
    throughout t6020.
    
    Signed-off-by: Derrick Stolee <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    derrickstolee authored and gitster committed Mar 23, 2022
    Configuration menu
    Copy the full SHA
    8ba221e View commit details
    Browse the repository at this point in the history

Commits on Mar 28, 2022

  1. pack-objects: lazily set up "struct rev_info", don't leak

    In the preceding [1] (pack-objects: move revs out of
    get_object_list(), 2022-03-22) the "repo_init_revisions()" was moved
    to cmd_pack_objects() so that it unconditionally took place for all
    invocations of "git pack-objects".
    
    We'd thus start leaking memory, which is easily reproduced in
    e.g. git.git by feeding e83c516 (Initial revision of "git", the
    information manager from hell, 2005-04-07) to "git pack-objects";
    
        $ echo e83c516 | ./git pack-objects initial
        [...]
    	==19130==ERROR: LeakSanitizer: detected memory leaks
    
    	Direct leak of 7120 byte(s) in 1 object(s) allocated from:
    	    #0 0x455308 in __interceptor_malloc (/home/avar/g/git/git+0x455308)
    	    #1 0x75b399 in do_xmalloc /home/avar/g/git/wrapper.c:41:8
    	    #2 0x75b356 in xmalloc /home/avar/g/git/wrapper.c:62:9
    	    #3 0x5d7609 in prep_parse_options /home/avar/g/git/diff.c:5647:2
    	    #4 0x5d415a in repo_diff_setup /home/avar/g/git/diff.c:4621:2
    	    #5 0x6dffbb in repo_init_revisions /home/avar/g/git/revision.c:1853:2
    	    #6 0x4f599d in cmd_pack_objects /home/avar/g/git/builtin/pack-objects.c:3980:2
    	    #7 0x4592ca in run_builtin /home/avar/g/git/git.c:465:11
    	    #8 0x457d81 in handle_builtin /home/avar/g/git/git.c:718:3
    	    #9 0x458ca5 in run_argv /home/avar/g/git/git.c:785:4
    	    #10 0x457b40 in cmd_main /home/avar/g/git/git.c:916:19
    	    #11 0x562259 in main /home/avar/g/git/common-main.c:56:11
    	    #12 0x7fce792ac7ec in __libc_start_main csu/../csu/libc-start.c:332:16
    	    #13 0x4300f9 in _start (/home/avar/g/git/git+0x4300f9)
    
    	SUMMARY: LeakSanitizer: 7120 byte(s) leaked in 1 allocation(s).
    	Aborted
    
    Narrowly fixing that commit would have been easy, just add call
    repo_init_revisions() right before get_object_list(), which is
    effectively what was done before that commit.
    
    But an unstated constraint when setting it up early is that it was
    needed for the subsequent [2] (pack-objects: parse --filter directly
    into revs.filter, 2022-03-22), i.e. we might have a --filter
    command-line option, and need to either have the "struct rev_info"
    setup when we encounter that option, or later.
    
    Let's just change the control flow so that we'll instead set up the
    "struct rev_info" only when we need it. Doing so leads to a bit more
    verbosity, but it's a lot clearer what we're doing and why.
    
    An earlier version of this commit[3] went behind
    opt_parse_list_objects_filter()'s back by faking up a "struct option"
    before calling it. Let's avoid that and instead create a blessed API
    for this pattern.
    
    We could furthermore combine the two get_object_list() invocations
    here by having repo_init_revisions() invoked on &pfd.revs, but I think
    clearly separating the two makes the flow clearer. Likewise
    redundantly but explicitly (i.e. redundant v.s. a "{ 0 }") "0" to
    "have_revs" early in cmd_pack_objects().
    
    While we're at it add parentheses around the arguments to the OPT_*
    macros in in list-objects-filter-options.h, as we need to change those
    lines anyway. It doesn't matter in this case, but is good general
    practice.
    
    1. https://lore.kernel.org/git/619b757d98465dbc4995bdc11a5282fbfcbd3daa.1647970119.git.gitgitgadget@gmail.com
    2. https://lore.kernel.org/git/97de926904988b89b5663bd4c59c011a1723a8f5.1647970119.git.gitgitgadget@gmail.com
    3. https://lore.kernel.org/git/[email protected]/
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <[email protected]>
    Signed-off-by: Junio C Hamano <[email protected]>
    avar authored and gitster committed Mar 28, 2022
    Configuration menu
    Copy the full SHA
    5cb2827 View commit details
    Browse the repository at this point in the history
Loading