Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bundle URIs Part 1: Preparation patches #17

Closed
wants to merge 8 commits into from

Commits on May 3, 2022

  1. connect.c: refactor sending of agent & object-format

    Refactor the sending of the "agent" and "object-format" capabilities
    into a function.
    
    This was added in its current form in ab67235 (connect: parse v2
    refs with correct hash algorithm, 2020-05-25). When we connect to a v2
    server we need to know about its object-format, and it needs to know
    about ours. Since most things in connect.c and transport.c piggy-back
    on the eager getting of remote refs via the handshake() those commands
    can make use of the just-sent-over object-format by ls-refs.
    
    But I'm about to add a command that may come after ls-refs, and may
    not, but we need the server to know about our user-agent and
    object-format. So let's split this into a function.
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    avar authored and derrickstolee committed May 3, 2022
    Configuration menu
    Copy the full SHA
    bd592eb View commit details
    Browse the repository at this point in the history
  2. dir API: add a generalized path_match_flags() function

    Add a path_match_flags() function and have the two sets of
    starts_with_dot_{,dot_}slash() functions added in
    63e95be (submodule: port resolve_relative_url from shell to C,
    2016-04-15) and a2b26ff (fsck: convert gitmodules url to URL
    passed to curl, 2020-04-18) be thin wrappers for it.
    
    As the latter of those notes the fsck version was copied from the
    initial builtin/submodule--helper.c version.
    
    Since the code added in a2b26ff was doing really doing the same as
    win32_is_dir_sep() added in 1cadad6 (git clone <url>
    C:\cygwin\home\USER\repo' is working (again), 2018-12-15) let's move
    the latter to git-compat-util.h is a is_xplatform_dir_sep(). We can
    then call either it or the platform-specific is_dir_sep() from this
    new function.
    
    Let's likewise change code in various other places that was hardcoding
    checks for "'/' || '\\'" with the new is_xplatform_dir_sep(). As can
    be seen in those callers some of them still concern themselves with
    ':' (Mac OS classic?), but let's leave the question of whether that
    should be consolidated for some other time.
    
    As we expect to make wider use of the "native" case in the future,
    define and use two starts_with_dot_{,dot_}slash_native() convenience
    wrappers. This makes the diff in builtin/submodule--helper.c much
    smaller.
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    avar authored and derrickstolee committed May 3, 2022
    Configuration menu
    Copy the full SHA
    61eb82f View commit details
    Browse the repository at this point in the history
  3. fetch-pack: add a deref_without_lazy_fetch_extended()

    Add a version of the deref_without_lazy_fetch function which can be
    called with custom oi_flags and to grab information about the
    "object_type". This will be used for the bundle-uri client in a
    subsequent commit.
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    avar authored and derrickstolee committed May 3, 2022
    Configuration menu
    Copy the full SHA
    2a563b5 View commit details
    Browse the repository at this point in the history
  4. fetch-pack: move --keep=* option filling to a function

    Move the populating of the --keep=* option argument to "index-pack" to
    a static function, a subsequent commit will make use of it in another
    function.
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    avar authored and derrickstolee committed May 3, 2022
    Configuration menu
    Copy the full SHA
    dd7eb99 View commit details
    Browse the repository at this point in the history
  5. http: make http_get_file() external

    This method will be used in an upcoming extension of git-remote-curl to
    download a single file over HTTP(S) by request.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed May 3, 2022
    Configuration menu
    Copy the full SHA
    47ecf80 View commit details
    Browse the repository at this point in the history
  6. remote: move relative_url()

    This method was initially written in 63e95be (submodule: port
    resolve_relative_url from shell to C, 2016-05-15). As we will need
    similar functionality in the bundle URI feature, extract this to be
    available in remote.h.
    
    The code is almost exactly the same, except for the following trivial
    differences:
    
     * Fix whitespace and wrapping issues with the prototype and argument
       lists.
    
     * Let's call starts_with_dot_{,dot_}slash_native() instead of the
       functionally identical "starts_with_dot_{,dot_}slash()" wrappers
       "builtin/submodule--helper.c".
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed May 3, 2022
    Configuration menu
    Copy the full SHA
    de94c47 View commit details
    Browse the repository at this point in the history
  7. remote: allow relative_url() to return an absolute url

    When the 'url' parameter was absolute, the previous implementation would
    concatenate 'remote_url' with 'url'. Instead, we want to return 'url' in
    this case.
    
    The documentation now discusses what happens when supplying two
    absolute URLs.
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed May 3, 2022
    Configuration menu
    Copy the full SHA
    d73b578 View commit details
    Browse the repository at this point in the history
  8. bundle.h: make "fd" version of read_bundle_header() public

    Change the parse_bundle_header() function to be non-static, and rename
    it to parse_bundle_header_fd(). The parse_bundle_header() function is
    already public, and it's a thin wrapper around this function. This
    will be used by code that wants to pass a fd to the bundle API.
    
    Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    avar authored and derrickstolee committed May 3, 2022
    Configuration menu
    Copy the full SHA
    c35f35d View commit details
    Browse the repository at this point in the history