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

[DO NOT MERGE BUT PUSH INSTEAD] Rebase to v2.42.0 #596

Merged
merged 206 commits into from
Aug 23, 2023

Commits on Aug 21, 2023

  1. reset --stdin: trim carriage return from the paths

    While using the reset --stdin feature on windows path added may have a
    \r at the end of the path that wasn't getting removed so didn't match
    the path in the index and wasn't reset.
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    beb3ce9 View commit details
    Browse the repository at this point in the history
  2. gvfs: start by adding the -gvfs suffix to the version

    Signed-off-by: Saeed Noursalehi <sanoursa@microsoft.com>
    sanoursa authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    83d4652 View commit details
    Browse the repository at this point in the history
  3. gvfs: ensure that the version is based on a GVFS tag

    Since we really want to be based on a `.vfs.*` tag, let's make sure that
    there was a new-enough one, i.e. one that agrees with the first three
    version numbers of the recorded default version.
    
    This prevents e.g. v2.22.0.vfs.0.<some-huge-number>.<commit> from being
    used when the current release train was not yet tagged.
    
    It is important to get the first three numbers of the version right
    because e.g. Scalar makes decisions depending on those (such as assuming
    that the `git maintenance` built-in is not available, even though it
    actually _is_ available).
    
    Signed-off-by: Johannes Schindelin <johasc@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    6963153 View commit details
    Browse the repository at this point in the history
  4. gvfs: add a GVFS-specific header file

    This header file will accumulate GVFS-specific definitions.
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    7fa2270 View commit details
    Browse the repository at this point in the history
  5. gvfs: add the core.gvfs config setting

    This does not do anything yet. The next patches will add various values
    for that config setting that correspond to the various features
    offered/required by GVFS.
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b9b41d5 View commit details
    Browse the repository at this point in the history
  6. gvfs: add the feature to skip writing the index' SHA-1

    This takes a substantial amount of time, and if the user is reasonably
    sure that the files' integrity is not compromised, that time can be saved.
    
    Git no longer verifies the SHA-1 by default, anyway.
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    
    Update for 2023-02-27: This feature was upstreamed as the index.skipHash
    config option. This resulted in some changes to the struct and some of
    the setup code. In particular, the config reading was moved to
    prepare_repo_settings(), so the core.gvfs bit check was moved there,
    too.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    85c245d View commit details
    Browse the repository at this point in the history
  7. gvfs: add the feature that blobs may be missing

    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b75bb69 View commit details
    Browse the repository at this point in the history
  8. gvfs: prevent files to be deleted outside the sparse checkout

    Prevent the sparse checkout to delete files that were marked with
    skip-worktree bit and are not in the sparse-checkout file.
    
    This is because everything with the skip-worktree bit turned on is being
    virtualized and will be removed with the change of HEAD.
    
    There was only one failing test when running with these changes that was
    checking to make sure the worktree narrows on checkout which was
    expected since we would no longer be narrowing the worktree.
    
    Update 2022-04-05: temporarily set 'sparse.expectfilesoutsideofpatterns' in
    test (until we start disabling the "remove present-despite-SKIP_WORKTREE"
    behavior with 'core.virtualfilesystem' in a later commit).
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    5defb61 View commit details
    Browse the repository at this point in the history
  9. gvfs: optionally skip reachability checks/upload pack during fetch

    While performing a fetch with a virtual file system we know that there
    will be missing objects and we don't want to download them just because
    of the reachability of the commits.  We also don't want to download a
    pack file with commits, trees, and blobs since these will be downloaded
    on demand.
    
    This flag will skip the first connectivity check and by returning zero
    will skip the upload pack. It will also skip the second connectivity
    check but continue to update the branches to the latest commit ids.
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    2989380 View commit details
    Browse the repository at this point in the history
  10. gvfs: add global command pre and post hook procs

    This adds hard-coded call to GVFS.hooks.exe before and after each Git
    command runs.
    
    To make sure that this is only called on repositories cloned with GVFS, we
    test for the tell-tale .gvfs.
    
    2021-10-30: Recent movement of find_hook() to hook.c required moving these
    changes out of run-command.c to hook.c.
    
    Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
    Ben Peart authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    7027220 View commit details
    Browse the repository at this point in the history
  11. gvfs: ensure all filters and EOL conversions are blocked

    Ensure all filters and EOL conversions are blocked when running under
    GVFS so that our projected file sizes will match the actual file size
    when it is hydrated on the local machine.
    
    Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
    Ben Peart authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    fd78c60 View commit details
    Browse the repository at this point in the history
  12. t0400: verify that the hook is called correctly from a subdirectory

    Suggested by Ben Peart.
    
    Signed-off-by: Johannes Schindelin <johasc@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    a04260e View commit details
    Browse the repository at this point in the history
  13. gvfs: allow "virtualizing" objects

    The idea is to allow blob objects to be missing from the local repository,
    and to load them lazily on demand.
    
    After discussing this idea on the mailing list, we will rename the feature
    to "lazy clone" and work more on this.
    
    Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
    Ben Peart authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    6be8f17 View commit details
    Browse the repository at this point in the history
  14. Pass PID of git process to hooks.

    Signed-off-by: Alejandro Pauly <alpauly@microsoft.com>
    alepauly authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    1a14559 View commit details
    Browse the repository at this point in the history
  15. Hydrate missing loose objects in check_and_freshen()

    Hydrate missing loose objects in check_and_freshen() when running
    virtualized. Add test cases to verify read-object hook works when
    running virtualized.
    
    This hook is called in check_and_freshen() rather than
    check_and_freshen_local() to make the hook work also with alternates.
    
    Helped-by: Kevin Willford <kewillf@microsoft.com>
    Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
    Ben Peart authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    ba8ff26 View commit details
    Browse the repository at this point in the history
  16. pre-command: always respect core.hooksPath

    We need to respect that config setting even if we already know that we
    have a repository, but have not yet read the config.
    
    The regression test was written by Alejandro Pauly.
    
    2021-10-30: Recent movement of find_hook() into hook.c required moving this
    change from run-command.c.
    
    Signed-off-by: Johannes Schindelin <johasc@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    638cebd View commit details
    Browse the repository at this point in the history
  17. sha1_file: when writing objects, skip the read_object_hook

    If we are going to write an object there is no use in calling
    the read object hook to get an object from a potentially remote
    source.  We would rather just write out the object and avoid the
    potential round trip for an object that doesn't exist.
    
    This change adds a flag to the check_and_freshen() and
    freshen_loose_object() functions' signatures so that the hook
    is bypassed when the functions are called before writing loose
    objects. The check for a local object is still performed so we
    don't overwrite something that has already been written to one
    of the objects directories.
    
    Based on a patch by Kevin Willford.
    
    Signed-off-by: Johannes Schindelin <johasc@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    a05336f View commit details
    Browse the repository at this point in the history
  18. sparse-checkout: update files with a modify/delete conflict

    When using the sparse-checkout feature, the file might not be on disk
    because the skip-worktree bit is on.
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    ab7419d View commit details
    Browse the repository at this point in the history
  19. sparse-checkout: avoid writing entries with the skip-worktree bit

    When using the sparse-checkout feature git should not write to the working
    directory for files with the skip-worktree bit on.  With the skip-worktree
    bit on the file may or may not be in the working directory and if it is
    not we don't want or need to create it by calling checkout_entry.
    
    There are two callers of checkout_target.  Both of which check that the
    file does not exist before calling checkout_target.  load_current which
    make a call to lstat right before calling checkout_target and
    check_preimage which will only run checkout_taret it stat_ret is less than
    zero.  It sets stat_ret to zero and only if !stat->cached will it lstat
    the file and set stat_ret to something other than zero.
    
    This patch checks if skip-worktree bit is on in checkout_target and just
    returns so that the entry doesn't not end up in the working directory.
    This is so that apply will not create a file in the working directory,
    then update the index but not keep the working directory up to date with
    the changes that happened in the index.
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    fc24c98 View commit details
    Browse the repository at this point in the history
  20. Do not remove files outside the sparse-checkout

    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    99f8539 View commit details
    Browse the repository at this point in the history
  21. gvfs: refactor loading the core.gvfs config value

    This code change makes sure that the config value for core_gvfs
    is always loaded before checking it.
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b1e77b3 View commit details
    Browse the repository at this point in the history
  22. send-pack: do not check for sha1 file when GVFS_MISSING_OK set

    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    789bfe2 View commit details
    Browse the repository at this point in the history
  23. cache-tree: remove use of strbuf_addf in update_one

    String formatting can be a performance issue when there are
    hundreds of thousands of trees.
    
    Change to stop using the strbuf_addf and just add the strings
    or characters individually.
    
    There are a limited number of modes so added a switch for the
    known ones and a default case if something comes through that
    are not a known one for git.
    
    In one scenario regarding a huge worktree, this reduces the
    time required for a `git checkout <branch>` from 44 seconds
    to 38 seconds, i.e. it is a non-negligible performance
    improvement.
    
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    7abe226 View commit details
    Browse the repository at this point in the history
  24. gvfs: block unsupported commands when running in a GVFS repo

    The following commands and options are not currently supported when working
    in a GVFS repo.  Add code to detect and block these commands from executing.
    
    1) fsck
    2) gc
    4) prune
    5) repack
    6) submodule
    8) update-index --split-index
    9) update-index --index-version (other than 4)
    10) update-index --[no-]skip-worktree
    11) worktree
    
    Signed-off-by: Ben Peart <benpeart@microsoft.com>
    benpeart authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    f4489d5 View commit details
    Browse the repository at this point in the history
  25. worktree: allow in Scalar repositories

    The 'git worktree' command was marked as BLOCK_ON_GVFS_REPO because it
    does not interact well with the virtual filesystem of VFS for Git. When
    a Scalar clone uses the GVFS protocol, it enables the
    GVFS_BLOCK_COMMANDS flag, since commands like 'git gc' do not work well
    with the GVFS protocol.
    
    However, 'git worktree' works just fine with the GVFS protocol since it
    isn't doing anything special. It copies the sparse-checkout from the
    current worktree, so it does not have performance issues.
    
    This is a highly requested option.
    
    The solution is to stop using the BLOCK_ON_GVFS_REPO option and instead
    add a special-case check in cmd_worktree() specifically for a particular
    bit of the 'core_gvfs' global variable (loaded by very early config
    reading) that corresponds to the virtual filesystem. The bit that most
    closely resembled this behavior was non-obviously named, but does
    provide a signal that we are in a Scalar clone and not a VFS for Git
    clone. The error message is copied from git.c, so it will have the same
    output as before if a user runs this in a VFS for Git clone.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b2db477 View commit details
    Browse the repository at this point in the history
  26. gvfs: allow overriding core.gvfs

    We found a user who had set "core.gvfs = false" in their global
    config. This should not have been necessary, but it also should not
    have caused a problem. However, it did.
    
    The reason is that gvfs_load_config_value() is called from config.c
    when reading config key/value pairs from all the config files. The
    local config should override the global config, and this is done by
    config.c reading the global config first then reading the local
    config. However, our logic only allowed writing the core_gvfs
    variable once.
    
    Put the guards against multiple assignments of core_gvfs into
    gvfs_config_is_set() instead, because that will fix the problem
    _and_ keep multiple calls to gvfs_config_is_set() from slowing down.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    6045bcc View commit details
    Browse the repository at this point in the history
  27. Add virtual file system settings and hook proc

    On index load, clear/set the skip worktree bits based on the virtual
    file system data. Use virtual file system data to update skip-worktree
    bit in unpack-trees. Use virtual file system data to exclude files and
    folders not explicitly requested.
    
    Update 2022-04-05: disable the "present-despite-SKIP_WORKTREE" file removal
    behavior when 'core.virtualfilesystem' is enabled.
    
    Signed-off-by: Ben Peart <benpeart@microsoft.com>
    benpeart authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    6745c45 View commit details
    Browse the repository at this point in the history
  28. virtualfilesystem: don't run the virtual file system hook if the inde…

    …x has been redirected
    
    Fixes #13
    
    Some git commands spawn helpers and redirect the index to a different
    location.  These include "difftool -d" and the sequencer
    (i.e. `git rebase -i`, `git cherry-pick` and `git revert`) and others.
    In those instances we don't want to update their temporary index with
    our virtualization data.
    
    Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
    benpeart authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    523c9ca View commit details
    Browse the repository at this point in the history
  29. virtualfilesystem: check if directory is included

    Add check to see if a directory is included in the virtualfilesystem
    before checking the directory hashmap.  This allows a directory entry
    like foo/ to find all untracked files in subdirectories.
    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    8e89267 View commit details
    Browse the repository at this point in the history
  30. backwards-compatibility: support the post-indexchanged hook

    When our patches to support that hook were upstreamed, the hook's name
    was eliciting some reviewer suggestions, and it was renamed to
    `post-index-change`. These patches (with the new name) made it into
    v2.22.0.
    
    However, VFSforGit users may very well have checkouts with that hook
    installed under the original name.
    
    To support this, let's just introduce a hack where we look a bit more
    closely when we just failed to find the `post-index-change` hook, and
    allow any `post-indexchanged` hook to run instead (if it exists).
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d4980f2 View commit details
    Browse the repository at this point in the history
  31. BRANCHES.md: Add explanation of branches and using forks

    Kevin Willford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    6918eec View commit details
    Browse the repository at this point in the history
  32. gvfs: verify that the built-in FSMonitor is disabled

    When using a virtual file system layer, the FSMonitor does not make
    sense.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d00c4ca View commit details
    Browse the repository at this point in the history
  33. status: add status serialization mechanism

    Teach STATUS to optionally serialize the results of a
    status computation to a file.
    
    Teach STATUS to optionally read an existing serialization
    file and simply print the results, rather than actually
    scanning.
    
    This is intended for immediate status results on extremely
    large repos and assumes the use of a service/daemon to
    maintain a fresh current status snapshot.
    
    2021-10-30: packet_read() changed its prototype in ec9a37d (pkt-line.[ch]:
    remove unused packet_read_line_buf(), 2021-10-14).
    
    2021-10-30: sscanf() now does an extra check that "%d" goes into an "int"
    and complains about "uint32_t". Replacing with "%u" fixes the compile-time
    error.
    
    2021-10-30: string_list_init() was removed by abf897b (string-list.[ch]:
    remove string_list_init() compatibility function, 2021-09-28), so we need to
    initialize manually.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    9c27a8e View commit details
    Browse the repository at this point in the history
  34. Configuration menu
    Copy the full SHA
    01f92dc View commit details
    Browse the repository at this point in the history
  35. status: serialize to path

    Teach status serialization to take an optional pathname on
    the command line to direct that cache data be written there
    rather than to stdout.  When used this way, normal status
    results will still be written to stdout.
    
    When no path is given, only binary serialization data is
    written to stdout.
    
    Usage:
        git status --serialize[=<path>]
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    7256d4f View commit details
    Browse the repository at this point in the history
  36. status: reject deserialize in V2 and conflicts

    Teach status deserialize code to reject status cache
    when printing in porcelain V2 and there are unresolved
    conflicts in the cache file.  A follow-on task might
    extend the cache format to include this additiona data.
    
    See code for longer explanation.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    22e9744 View commit details
    Browse the repository at this point in the history
  37. serialize-status: serialize global and repo-local exclude file metadata

    Changes to the global or repo-local excludes files can change the
    results returned by "git status" for untracked files.  Therefore,
    it is important that the exclude-file values used during serialization
    are still current at the time of deserialization.
    
    Teach "git status --serialize" to report metadata on the user's global
    exclude file (which defaults to "$XDG_HOME/git/ignore") and for the
    repo-local excludes file (which is in ".git/info/excludes").  Serialize
    will record the pathnames and mtimes for these files in the serialization
    header (next to the mtime data for the .git/index file).
    
    Teach "git status --deserialize" to validate this new metadata.  If either
    exclude file has changed since the serialization-cache-file was written,
    then deserialize will reject the cache file and force a full/normal status
    run.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    af61fbc View commit details
    Browse the repository at this point in the history
  38. status: deserialization wait

    Teach `git status --deserialize` to either wait indefintely
    or immediately fail if the status serialization cache file
    is stale.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    52eb244 View commit details
    Browse the repository at this point in the history
  39. merge-recursive: avoid confusing logic in was_dirty()

    It took this developer more than a moment to verify that was_dirty()
    really returns 0 (i.e. "false") if the file was not even tracked. In
    other words, the `dirty` variable that was initialized to 1 (i.e.
    "true") and then negated to be returned was not helping readability.
    
    The same holds for the final return: rather than assigning the value to
    return to `dirty` and then *immediately* returning that, we can simplify
    it to a single statement.
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    f51c96d View commit details
    Browse the repository at this point in the history
  40. merge-recursive: add some defensive coding to was_dirty()

    It took this developer quite a good while to understand why the current
    code cannot get a `NULL` returned by `index_file_exists()`. To
    un-confuse readers (and future-proof the code), let's just be safe and
    check before we dereference the returned pointer.
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    28388fb View commit details
    Browse the repository at this point in the history
  41. merge-recursive: teach was_dirty() about the virtualfilesystem

    The idea of the virtual file system really is to tell Git to avoid
    accessing certain paths. This fixes the case where a given path is not
    yet included in the virtual file system and we are about to write a
    conflicted version of it.
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    5f499d9 View commit details
    Browse the repository at this point in the history
  42. status: deserialize with -uno does not print correct hint

    With the "--untracked-files=complete" option status computes a
    superset of the untracked files.  We use this when writing the
    status cache.  If subsequent deserialize commands ask for either
    the complete set or one of the "no", "normal", or "all" subsets,
    it can still use the cache file because of filtering in the
    deserialize parser.
    
    When running status with the "-uno" option, the long format
    status would print a "(use -u to show untracked files)" hint.
    
    When deserializing with the "-uno" option and using a cache computed
    with "-ucomplete", the "nothing to commit, working tree clean" message
    would be printed instead of the hint.
    
    It was easy to miss because the correct hint message was printed
    if the cache was rejected for any reason (and status did the full
    fallback).
    
    The "struct wt_status des" structure was initialized with the
    content of the status cache (and thus defaulted to "complete").
    This change sets "des.show_untracked_files" to the requested
    subset from the command-line or config.  This allows the long
    format to print the hint.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    09f8e30 View commit details
    Browse the repository at this point in the history
  43. fsmonitor: check CE_FSMONITOR_VALID in ce_uptodate

    When using fsmonitor the CE_FSMONITOR_VALID flag should be checked when
    wanting to know if the entry has been updated. If the flag is set the
    entry should be considered up to date and the same as if the CE_UPTODATE
    is set.
    
    In order to trust the CE_FSMONITOR_VALID flag, the fsmonitor data needs to
    be refreshed when the fsmonitor bitmap is applied to the index in
    tweak_fsmonitor. Since the fsmonitor data is kept up to date for every
    command, some tests needed to be updated to take that into account.
    
    istate->untracked->use_fsmonitor was set in tweak_fsmonitor when the
    fsmonitor bitmap data was loaded and is now in refresh_fsmonitor since
    that is being called in tweak_fsmonitor. refresh_fsmonitor will only be
    called once and any other callers should be setting it when refreshing
    the fsmonitor data so that code can use the fsmonitor data when checking
    untracked files.
    
    When writing the index, fsmonitor_last_update is used to determine if
    the fsmonitor bitmap should be created and the extension data written to
    the index. When running through unpack-trees this is not copied to the
    result index. This makes the next time a git command is ran do all the
    work of lstating all files to determine what is clean since all entries
    in the index are marked as dirty since there wasn't any fsmonitor data
    saved in the index extension.
    
    Copying the fsmonitor_last_update to the result index will cause the
    extension data for fsmonitor to be in the index for the next git command
    to use.
    
    Signed-off-by: Kevin Willford <Kevin.Willford@microsoft.com>
    kewillford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    82ad4b7 View commit details
    Browse the repository at this point in the history
  44. gvfs:trace2:data: add trace2 tracing around read_object_process

    Add trace2 region around read_object_process to collect
    time spent waiting for missing objects to be dynamically
    fetched.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    35e920a View commit details
    Browse the repository at this point in the history
  45. fsmonitor: add script for debugging and update script for tests

    The fsmonitor script that can be used for running all the git tests
    using watchman was causing some of the tests to fail because it wrote
    to stderr and created some files for debugging purposes.
    
    Add a new debug script to use with debugging and modify the other script
    to remove the code that would cause tests to fail.
    
    Signed-off-by: Kevin Willford <Kevin.Willford@microsoft.com>
    kewillford authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    0e205d7 View commit details
    Browse the repository at this point in the history
  46. gvfs:trace2:data: status deserialization information

    Add trace2 region and data events describing attempts to deserialize
    status data using a status cache.
    
    A category:status, label:deserialize region is pushed around the
    deserialize code.
    
    Deserialization results when reading from a file are:
        category:status, path   = <path>
        category:status, polled = <number_of_attempts>
        category:status, result = "ok" | "reject"
    
    When reading from STDIN are:
        category:status, path   = "STDIN"
        category:status, result = "ok" | "reject"
    
    Status will fallback and run a normal status scan when a "reject"
    is reported (unless "--deserialize-wait=fail").
    
    If "ok" is reported, status was able to use the status cache and
    avoid scanning the workdir.
    
    Additionally, a cmd_mode is emitted for each step: collection,
    deserialization, and serialization.  For example, if deserialization
    is attempted and fails and status falls back to actually computing
    the status, a cmd_mode message containing "deserialize" is issued
    and then a cmd_mode for "collect" is issued.
    
    Also, if deserialization fails, a data message containing the
    rejection reason is emitted.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    7d872c3 View commit details
    Browse the repository at this point in the history
  47. status: disable deserialize when verbose output requested.

    Disable deserialization when verbose output requested.
    
    Verbose mode causes Git to print diffs for modified files.
    This requires the index to be loaded to have the currently
    staged OID values.  Without loading the index, verbose output
    make it look like everything was deleted.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    991de58 View commit details
    Browse the repository at this point in the history
  48. gvfs:trace2:data: status serialization

    Add trace information around status serialization.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    680a5dd View commit details
    Browse the repository at this point in the history
  49. t7524: add test for verbose status deserialzation

    Verify that `git status --deserialize=x -v` does not crash and
    generates the same output as a normal (scanning) status command.
    
    These issues are described in the previous 2 commits.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    e0f79ba View commit details
    Browse the repository at this point in the history
  50. gvfs:trace2:data: add vfs stats

    Report virtual filesystem summary data.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    56b57b4 View commit details
    Browse the repository at this point in the history
  51. deserialize-status: silently fallback if we cannot read cache file

    Teach Git to not throw a fatal error when an explicitly-specified
    status-cache file (`git status --deserialize=<foo>`) could not be
    found or opened for reading and silently fallback to a traditional
    scan.
    
    This matches the behavior when the status-cache file is implicitly
    given via a config setting.
    
    Note: the current version causes a test to start failing. Mark this as
    an expected result for now.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    14452b7 View commit details
    Browse the repository at this point in the history
  52. trace2: refactor setting process starting time

    Create trace2_initialize_clock() and call from main() to capture
    process start time in isolation and before other sub-systems are
    ready.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    3b94725 View commit details
    Browse the repository at this point in the history
  53. trace2:gvfs:experiment: clear_ce_flags_1

    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    f01198a View commit details
    Browse the repository at this point in the history
  54. trace2:gvfs:experiment: report_tracking

    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d5ab32c View commit details
    Browse the repository at this point in the history
  55. trace2:gvfs:experiment: read_cache: annotate thread usage in read-cache

    Add trace2_thread_start() and trace2_thread_exit() events to the worker
    threads used to read the index.  This gives per-thread perf data.
    
    These workers were introduced in:
    abb4bb8 read-cache: load cache extensions on a worker thread
    77ff112 read-cache: load cache entries on worker threads
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    7384393 View commit details
    Browse the repository at this point in the history
  56. trace2:gvfs:experiment: read-cache: time read/write of cache-tree ext…

    …ension
    
    Add regions around code to read and write the cache-tree extension
    when the index is read or written.
    
    This is an experiment and may be dropped in future releases if
    we don't need it anymore.
    
    This experiment demonstrates that it takes more time to parse and
    deserialize the cache-tree extension than it does to read the
    cache-entries.
    
    Commits [1] and [2] spreads cache-entry reading across N-1 cores
    and dedicates a single core to simultaneously read the index extensions.
    
    Local testing (on my machine) shows that reading the cache-tree extension
    takes ~0.28 seconds.  The 11 cache-entry threads take ~0.08 seconds.
    The main thread is blocked for 0.15 to 0.20 seconds waiting for the
    extension thread to finish.
    
    Let's use this commit to gather some telemetry and confirm this.
    
    My point is that improvements, such as index V5 which makes the
    cache entries smaller, may improve performance, but the gains may
    be limited because of this extension.  And that we may need to
    look inside the cache-tree extension to truly improve do_read_index()
    performance.
    
    [1] abb4bb8 read-cache: load cache extensions on a worker thread
    [2] 77ff112 read-cache: load cache entries on worker threads
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    091f2bf View commit details
    Browse the repository at this point in the history
  57. trace2:gvfs:experiment: add region to apply_virtualfilesystem()

    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    2ba30a8 View commit details
    Browse the repository at this point in the history
  58. trace2:gvfs:experiment: add region around unpack_trees()

    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    dbe4182 View commit details
    Browse the repository at this point in the history
  59. trace2:gvfs:experiment: add region to cache_tree_fully_valid()

    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    3dead05 View commit details
    Browse the repository at this point in the history
  60. trace2:gvfs:experiment: add unpack_entry() counter to unpack_trees() …

    …and report_tracking()
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d746e1d View commit details
    Browse the repository at this point in the history
  61. Configuration menu
    Copy the full SHA
    fce6f11 View commit details
    Browse the repository at this point in the history
  62. credential: set trace2_child_class for credential manager children

    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    a617e62 View commit details
    Browse the repository at this point in the history
  63. sub-process: do not borrow cmd pointer from caller

    Teach subprocess_start() to use a copy of the passed `cmd` string
    rather than borrowing the buffer from the caller.
    
    Some callers of subprocess_start() pass the value returned from
    find_hook() which points to a static buffer and therefore is only
    good until the next call to find_hook().  This could cause problems
    for the long-running background processes managed by sub-process.c
    where later calls to subprocess_find_entry() to get an existing
    process will fail.  This could cause more than 1 long-running
    process to be created.
    
    TODO Need to confirm, but if only read_object_hook() uses
    TODO subprocess_start() in this manner, we could drop this
    TODO commit when we drop support for read_object_hook().
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    dcf48b2 View commit details
    Browse the repository at this point in the history
  64. sub-process: add subprocess_start_argv()

    Add function to start a subprocess with an argv.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    cbc202b View commit details
    Browse the repository at this point in the history
  65. sha1-file: add function to update existing loose object cache

    Create a function to add a new object to the loose object cache
    after the existing odb/xx/ directory was scanned.
    
    This will be used in a later commit to keep the loose object
    cache fresh after dynamically fetching an individual object
    and without requiring the odb/xx/ directory to be rescanned.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    f872f9d View commit details
    Browse the repository at this point in the history
  66. packfile: add install_packed_git_and_mru()

    Create a function to install a new packfile into the packed-git
    list and add it to the head of the MRU list.
    
    This function will be used in a later commit to install packfiles
    created by dynamic object fetching.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    434847c View commit details
    Browse the repository at this point in the history
  67. trace2:gvfs:experiment: add data for check_updates() in unpack_trees()

    Add data for the number of files created/overwritten and deleted during the checkout.
    
    Give proper category name to all events in unpack-trees.c and eliminate "exp".
    
    This is modified slightly from the original version due to interactions with 26f924d
    (unpack-trees: exit check_updates() early if updates are not wanted, 2020-01-07).
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    e460ad4 View commit details
    Browse the repository at this point in the history
  68. index-pack: avoid immediate object fetch while parsing packfile

    Prevent packfile parsing from accidentally dynamically fetching
    each individual object found in the packfile.
    
    When index-pack parses the input packfile, it does a lookup in the
    ODB to test for conflicts/collisions.  This can accidentally cause
    the object to be individually fetched when gvfs-helper (or
    read-object-hook or partial-clone) is enabled.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b360b32 View commit details
    Browse the repository at this point in the history
  69. Trace2:gvfs:experiment: capture more 'tracking' details

    Update tracing around report_tracking() to use 'tracking' category
    rather than 'exp' category.
    
    Add ahead/behind results from stat_tracking_info().
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    68d7101 View commit details
    Browse the repository at this point in the history
  70. gvfs-helper: create tool to fetch objects using the GVFS Protocol

    Create gvfs-helper.  This is a helper tool to use the GVFS Protocol
    REST API to fetch objects and configuration data from a GVFS cache-server
    or Git server.  This tool uses libcurl to send object requests to either
    server.  This tool creates loose objects and/or packfiles.
    
    Create gvfs-helper-client.  This code resides within git proper and
    uses the sub-process API to manage gvfs-helper as a long-running background
    process.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    5579a80 View commit details
    Browse the repository at this point in the history
  71. sha1-file: create shared-cache directory if it doesn't exist

    The config variable `gvfs.sharedCache` contains the pathname to an alternate
    <odb> that will be used by `gvfs-helper` to store dynamically-fetched missing
    objects.  If this directory does not exist on disk, `prepare_alt_odb()` omits
    this directory from the in-memory list of alternates.  This causes `git`
    commands (and `gvfs-helper` in particular) to fall-back to `.git/objects` for
    storage of these objects.  This disables the shared-cache and leads to poorer
    performance.
    
    Teach `alt_obj_usable()` and `prepare_alt_odb()`, match up the directory
    named in `gvfs.sharedCache` with an entry in `.git/objects/info/alternates`
    and force-create the `<odb>` root directory (and the associated `<odb>/pack`
    directory) if necessary.
    
    If the value of `gvfs.sharedCache` refers to a directory that is NOT listed
    as an alternate, create an in-memory alternate entry in the odb-list.  (This
    is similar to how GIT_ALTERNATE_OBJECT_DIRECTORIES works.)
    
    This work happens the first time that `prepare_alt_odb()` is called.
    
    Furthermore, teach the `--shared-cache=<odb>` command line option in
    `gvfs-helper` (which is runs after the first call to `prepare_alt_odb()`)
    to override the inherited shared-cache (and again, create the ODB directory
    if necessary).
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    ac4a124 View commit details
    Browse the repository at this point in the history
  72. gvfs-helper: better handling of network errors

    Add trace2 message for CURL and HTTP errors.
    
    Fix typo reporting network error code back to gvfs-helper-client.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    6619a85 View commit details
    Browse the repository at this point in the history
  73. gvfs-helper-client: properly update loose cache with fetched OID

    Fix parsing of the "loose <odb>" response from `gvfs-helper` and
    use the actually parsed OID when updating the loose oid cache.
    
    Previously, an uninitialized "struct oid" was used to update
    the cache.  This did not cause any corruption, but could cause
    extra fetches for objects visited multiple times.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    311af31 View commit details
    Browse the repository at this point in the history
  74. gvfs-helper: V2 robust retry and throttling

    Add robust-retry mechanism to automatically retry a request after network
    errors.  This includes retry after:
       [] transient network problems reported by CURL.
       [] http 429 throttling (with associated Retry-After)
       [] http 503 server unavailable (with associated Retry-After)
    
    Add voluntary throttling using Azure X-RateLimit-* hints to avoid being
    soft-throttled (tarpitted) or hard-throttled (429) on later requests.
    
    Add global (outside of a single request) azure-throttle data to track the
    rate limit hints from the cache-server and main Git server independently.
    
    Add exponential retry backoff.  This is used for transient network problems
    when we don't have a Retry-After hint.
    
    Move the call to index-pack earlier in the response/error handling sequence
    so that if we receive a 200 but yet the packfile is truncated/corrupted, we
    can use the regular retry logic to get it again.
    
    Refactor the way we create tempfiles for packfiles to use
    <odb>/pack/tempPacks/ rather than working directly in the <odb>/pack/
    directory.
    
    Move the code to create a new tempfile to the start of a single request
    attempt (initial and retry attempts), rather than at the overall start
    of a request.  This gives us a fresh tempfile for each network request
    attempt.  This simplifies the retry mechanism and isolates us from the file
    ownership issues hidden within the tempfile class.  And avoids the need to
    truncate previous incomplete results.  This was necessary because index-pack
    was pulled into the retry loop.
    
    Minor: Add support for logging X-VSS-E2EID to telemetry on network errors.
    
    Minor: rename variable:
        params.b_no_cache_server --> params.b_permit_cache_server_if_defined.
    This variable is used to indicate whether we should try to use the
    cache-server when it is defined.  Got rid of double-negative logic.
    
    Minor: rename variable:
        params.label --> params.tr2_label
    Clarify that this variable is only used with trace2 logging.
    
    Minor: Move the code to automatically map cache-server 400 responses
    to normal 401 response earlier in the response/error handling sequence
    to simplify later retry logic.
    
    Minor: Decorate trace2 messages with "(cs)" or "(main)" to identify the
    server in log messages.  Add params->server_type to simplify this.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    8c1a1c4 View commit details
    Browse the repository at this point in the history
  75. gvfs-helper: expose gvfs/objects GET and POST semantics

    Expose the differences in the semantics of GET and POST for
    the "gvfs/objects" API:
    
        HTTP GET: fetches a single loose object over the network.
                  When a commit object is requested, it just returns
    	      the single object.
    
        HTTP POST: fetches a batch of objects over the network.
                   When the oid-set contains a commit object, all
    	       referenced trees are also included in the response.
    
    gvfs-helper is updated to take "get" and "post" command line options.
    the gvfs-helper "server" mode is updated to take "objects.get" and
    "objects.post" verbs.
    
    For convenience, the "get" option and the "objects.get" verb
    do allow more than one object to be requested.  gvfs-helper will
    automatically issue a series of (single object) HTTP GET requests
    and creating a series of loose objects.
    
    The "post" option and the "objects.post" verb will perform bulk
    object fetching using the batch-size chunking.  Individual HTTP
    POST requests containing more than one object will be created
    as a packfile.  A HTTP POST for a single object will create a
    loose object.
    
    This commit also contains some refactoring to eliminate the
    assumption that POST is always associated with packfiles.
    
    In gvfs-helper-client.c, gh_client__get_immediate() now uses the
    "objects.get" verb and ignores any currently queued objects.
    
    In gvfs-helper-client.c, the OIDSET built by gh_client__queue_oid()
    is only processed when gh_client__drain_queue() is called.  The queue
    is processed using the "object.post" verb.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    43442ca View commit details
    Browse the repository at this point in the history
  76. gvfs-helper: dramatically reduce progress noise

    During development, it was very helpful to see the gvfs-helper do its
    work to request a pack-file or download a loose object. When these
    messages appear during normal use, it leads to a very noisy terminal
    output.
    
    Remove all progress indicators when downloading loose objects. We know
    that these can be numbered in the thousands in certain kinds of history
    calls, and would litter the terminal output with noise. This happens
    during 'git fetch' or 'git pull' as well when the tip commits are
    checked for the new refs.
    
    Remove the "Requesting packfile with %ld objects" message, as this
    operation is very fast. We quickly follow up with the more valuable
    "Receiving packfile %ld%ld with %ld objects". When a large "git
    checkout" causes many pack-file downloads, it is good to know that Git
    is asking for data from the server.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    0d98739 View commit details
    Browse the repository at this point in the history
  77. gvfs-helper-client.h: define struct object_id

    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d8a4d89 View commit details
    Browse the repository at this point in the history
  78. gvfs-helper: handle pack-file after single POST request

    If our POST request includes a commit ID, then the the remote will
    send a pack-file containing the commit and all trees reachable from
    its root tree. With the current implementation, this causes a
    failure since we call install_loose() when asking for one object.
    
    Modify the condition to check for install_pack() when the response
    type changes.
    
    Also, create a tempfile for the pack-file download or else we will
    have problems!
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    9175db6 View commit details
    Browse the repository at this point in the history
  79. test-gvfs-prococol, t5799: tests for gvfs-helper

    Create t/helper/test-gvfs-protocol.c and t/t5799-gvfs-helper.sh
    to test gvfs-helper.
    
    Create t/helper/test-gvfs-protocol.c as a stand-alone web server that
    speaks the GVFS Protocol [1] and serves loose objects and packfiles
    to clients.  It is borrows heavily from the code in daemon.c.
    It includes a "mayhem" mode to cause various network and HTTP errors
    to test the retry/recovery ability of gvfs-helper.
    
    Create t/t5799-gvfs-helper.sh to test gvfs-helper.
    
    [1] https://github.com/microsoft/VFSForGit/blob/master/Protocol.md
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    f89f72b View commit details
    Browse the repository at this point in the history
  80. gvfs-helper: move result-list construction into install functions

    gvfs-helper prints a "loose <oid>" or "packfile <name>" messages after
    they are received to help invokers update their in-memory caches.
    Move the code to accumulate these messages in the result_list into
    the install_* functions rather than waiting until the end.
    
    POST requests containing 1 object may return a loose object or a packfile
    depending on whether the object is a commit or non-commit.  Delaying the
    message generation just complicated the caller.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    04a00fc View commit details
    Browse the repository at this point in the history
  81. gvfs-helper: add prefetch support

    Teach gvfs-helper to support "/gvfs/prefetch" REST API.
    This includes a new `gvfs-helper prefetch --since=<t>` command line option.
    And a new `objects.prefetch` verb in `gvfs-helper server` mode.
    
    If `since` argument is omitted, `gvfs-helper` will search the local
    shared-cache for the most recent prefetch packfile and start from
    there.
    
    The <t> is usually a seconds-since-epoch, but may also be a "friendly"
    date -- such as "midnight", "yesterday" and etc. using the existing
    date selection mechanism.
    
    Add `gh_client__prefetch()` API to allow `git.exe` to easily call
    prefetch (and using the same long-running process as immediate and
    queued object fetches).
    
    Expanded t5799 unit tests to include prefetch tests.  Test setup now
    also builds some commits-and-trees packfiles for testing purposes with
    well-known timestamps.
    
    Expanded t/helper/test-gvfs-protocol.exe to support "/gvfs/prefetch"
    REST API.
    
    Massive refactor of existing packfile handling in gvfs-helper.c to
    reuse more code between "/gvfs/objects POST" and "/gvfs/prefetch".
    With this we now properly name packfiles with the checksum SHA1
    rather than a date string.
    
    Refactor also addresses some of the confusing tempfile setup and
    install_<result> code processing (introduced to handle the ambiguity
    of how POST works with commit objects).
    
    Update 2023-05-22 (v2.41.0): add '--no-rev-index' to 'index-pack' to avoid
    writing the extra (unused) file.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    39a8eb2 View commit details
    Browse the repository at this point in the history
  82. t5799: add support for POST to return either a loose object or packfile

    Earlier versions of the test always returned a packfile in response to a POST.
    Now we look at the number of objects in the POST request.
    
    If > 1, always send a packfile.
    
    If = 1 and it is a commit, send a packfile.
    Otherwise, send a loose object.
    
    This is to better model the behavior of the GVFS server/protocol which
    treats commits differently.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b8d9a68 View commit details
    Browse the repository at this point in the history
  83. gvfs-helper: add prefetch .keep file for last packfile

    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    9242228 View commit details
    Browse the repository at this point in the history
  84. t5799: cleanup wc-l and grep-c lines

    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d661257 View commit details
    Browse the repository at this point in the history
  85. gvfs-helper: do one read in my_copy_fd_len_tail()

    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    7ed9e35 View commit details
    Browse the repository at this point in the history
  86. gvfs-helper: verify loose objects after write

    It is possible that a loose object that is written from a GVFS protocol
    "get object" request does not match the expected hash. Error out in this
    case.
    
    2021-10-30: The prototype for read_loose_object() changed in 31deb28 (fsck:
    don't hard die on invalid object types, 2021-10-01) and 96e41f5 (fsck:
    report invalid object type-path combinations, 2021-10-01).
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    4c63e73 View commit details
    Browse the repository at this point in the history
  87. gvfs-helper: move content-type warning for prefetch packs

    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    4f4b450 View commit details
    Browse the repository at this point in the history
  88. t7599: create corrupt blob test

    Teach helper/test-gvfs-protocol to be able to send corrupted
    loose blobs.
    
    Add unit test for gvfs-helper to detect receipt of a corrupted loose blob.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d765e39 View commit details
    Browse the repository at this point in the history
  89. fetch: use gvfs-helper prefetch under config

    The gvfs-helper allows us to download prefetch packs using a simple
    subprocess call. The gvfs-helper-client.h method will automatically
    compute the timestamp if passing 0, and passing NULL for the number
    of downloaded packs is valid.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    3c4c219 View commit details
    Browse the repository at this point in the history
  90. gvfs-helper: better support for concurrent packfile fetches

    Teach gvfs-helper to better support the concurrent fetching of the
    same packfile by multiple instances.
    
    If 2 instances of gvfs-helper did a POST and requested the same set of
    OIDs, they might receive the exact same packfile (same checksum SHA).
    Both processes would then race to install their copy of the .pack and
    .idx files into the ODB/pack directory.
    
    This is not a problem on Unix (because of filesystem semantics).
    
    On Windows, this can cause an EBUSY/EPERM problem for the loser while
    the winner is holding a handle to the target files.  (The existing
    packfile code already handled simple the existence and/or replacement
    case.)
    
    The solution presented here is to silently let the loser claim
    victory IIF the .pack and .idx are already present in the ODB.
    (We can't check this in advance because we don't know the packfile
    SHA checksum until after we receive it and run index-pack.)
    
    We avoid using a per-packfile lockfile (or a single lockfile for
    the `vfs-` prefix) to avoid the usual issues with stale lockfiles.
    
    Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    ae0eb9a View commit details
    Browse the repository at this point in the history
  91. remote-curl: do not call fetch-pack when using gvfs-helper

    When using the GVFS protocol, we should _never_ call "git fetch-pack"
    to attempt downloading a pack-file via the regular Git protocol. It
    appears that the mechanism that prevented this in the VFS for Git
    world is due to the read-object hook populating the commits at the
    new ref tips in a different way than the gvfs-helper does.
    
    By acting as if the fetch-pack succeeds here in remote-curl, we
    prevent a failed fetch.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    2b1e1c1 View commit details
    Browse the repository at this point in the history
  92. fetch: reprepare packs before checking connectivity

    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    e7f9082 View commit details
    Browse the repository at this point in the history
  93. gvfs-helper: add --max-retries to prefetch verb

    Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    2edc14c View commit details
    Browse the repository at this point in the history
  94. gvfs-helper: retry when creating temp files

    When we create temp files for downloading packs, we use a name
    based on the current timestamp. There is no randomness in the
    name, so we can have collisions in the same second.
    
    Retry the temp pack names using a new "-<retry>" suffix to the
    name before the ".temp".
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    21f9a98 View commit details
    Browse the repository at this point in the history
  95. t5799: add tests to detect corrupt pack/idx files in prefetch

    Add "mayhem" keys to generate corrupt packfiles and/or corrupt idx
    files in prefetch by trashing the trailing checksum SHA.
    
    Add unit tests to t5799 to verify that `gvfs-helper` detects these
    corrupt pack/idx files.
    
    Currently, only the (bad-pack, no-idx) case is correctly detected,
    Because `gvfs-helper` needs to locally compute the idx file itself.
    
    A test for the (bad-pack, any-idx) case was also added (as a known
    breakage) because `gvfs-helper` assumes that when the cache server
    provides both, it doesn't need to verify them.  We will fix that
    assumption in the next commit.
    
    Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    38ff92e View commit details
    Browse the repository at this point in the history
  96. sparse: avoid warnings about known cURL issues in gvfs-helper.c

    `sparse` complains with an error message like this:
    
    	gvfs-helper.c:2912:17: error: expression using sizeof on a
    	function
    
    The culprit is this line:
    
    	curl_easy_setopt(slot->curl, CURLOPT_WRITEFUNCTION, fwrite);
    
    Similar lines exist in `http-push.c` and other files that are in
    upstream Git, and to avoid these bogus warnings, they are already
    exempted from `sparse`'s tender, loving care. We simply add
    `gvfs-helper.c` to that list.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    98386f1 View commit details
    Browse the repository at this point in the history
  97. homebrew: add GitHub workflow to release Cask

    Add a GitHub workflow that is triggered on the `release` event to
    automatically update the `microsoft-git` Homebrew Cask on the
    `microsoft/git` Tap.
    
    A secret `HOMEBREW_TOKEN` with push permissions to the
    `microsoft/homebrew-git` repository must exist. A pull request will be
    created at the moment to allow for last minute manual verification.
    
    Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
    mjcheetham authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    6086795 View commit details
    Browse the repository at this point in the history
  98. gvfs-helper: ignore .idx files in prefetch multi-part responses

    The GVFS cache server can return multiple pairs of (.pack, .idx)
    files.  If both are provided, `gvfs-helper` assumes that they are
    valid without any validation.  This might cause problems if the
    .pack file is corrupt inside the data stream.  (This might happen
    if the cache server sends extra unexpected STDERR data or if the
    .pack file is corrupt on the cache server's disk.)
    
    All of the .pack file verification logic is already contained
    within `git index-pack`, so let's ignore the .idx from the data
    stream and force compute it.
    
    This defeats the purpose of some of the data cacheing on the cache
    server, but safety is more important.
    
    Signed-off-by: Jeff Hostetler <jeffhostetler@github.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    5a63114 View commit details
    Browse the repository at this point in the history
  99. upload-pack: fix race condition in error messages

    Test t5516-fetch-push.sh has a test 'deny fetch unreachable SHA1,
    allowtipsha1inwant=true' that checks stderr for a specific error
    string from the remote. In some build environments the error sent
    over the remote connection gets mingled with the error from the
    die() statement. Since both signals are being output to the same
    file descriptor (but from parent and child processes), the output
    we are matching with grep gets split.
    
    To reduce the risk of this failure, follow this process instead:
    
    1. Write an error message to stderr.
    2. Write an error message across the connection.
    3. exit(1).
    
    This reorders the events so the error is written entirely before
    the client receives a message from the remote, removing the race
    condition.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    9ee1e4a View commit details
    Browse the repository at this point in the history
  100. maintenance: care about gvfs.sharedCache config

    For Scalar and VFS for Git, we use an alternate as a shared object
    cache. We need to enable the maintenance builtin to work on that
    shared object cache, especially in the background.
    
    'scalar run <task>' would set GIT_OBJECT_DIRECTORY to handle this.
    
    We set GIT_OBJECT_DIRECTORY based on the gvfs.sharedCache config,
    but we also need the checks in pack_loose() to look at that object
    directory instead of the current ODB's.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    273466d View commit details
    Browse the repository at this point in the history
  101. unpack-trees:virtualfilesystem: Improve efficiency of clear_ce_flags

    When the virtualfilesystem is enabled the previous implementation of
    clear_ce_flags would iterate all of the cache entries and query whether
    each one is in the virtual filesystem to determine whether to clear one
    of the SKIP_WORKTREE bits. For each cache entry, we would do a hash
    lookup for each parent directory in the is_included_in_virtualfilesystem
    function.
    
    The former approach is slow for a typical Windows OS enlistment with
    3 million files where only a small percentage is in the virtual
    filesystem. The cost is
    O(n_index_entries * n_chars_per_path * n_parent_directories_per_path).
    
    In this change, we use the same approach as apply_virtualfilesystem,
    which iterates the set of entries in the virtualfilesystem and searches
    in the cache for the corresponding entries in order to clear their
    flags. This approach has a cost of
    O(n_virtual_filesystem_entries * n_chars_per_path * log(n_index_entries)).
    
    The apply_virtualfilesystem code was refactored a bit and modified to
    clear flags for all names that 'alias' a given virtual filesystem name
    when ignore_case is set.
    
    n_virtual_filesystem_entries is typically much less than
    n_index_entries, in which case the new approach is much faster. We wind
    up building the name hash for the index, but this occurs quickly thanks
    to the multi-threading.
    
    Signed-off-by: Neeraj Singh <neerajsi@ntdev.microsoft.com>
    neerajsi-msft2 authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    cae5026 View commit details
    Browse the repository at this point in the history
  102. Adding winget workflows

    Lessley Dennington authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    ecd2e75 View commit details
    Browse the repository at this point in the history
  103. release: create initial Windows installer build workflow

    - trigger on tag matching basic "vfs" version pattern
    - validate tag is annotated & matches stricter checks
    - include `scalar`
    - build x86_64 & portable git installers, upload artifacts to workflow
    
    Update Apr 18, 2022: these steps are built explicitly on 'windows-2019'
    agents (rather than 'windows-latest') to ensure the correct version of
    Visual Studio is used (verified in the pipeline via 'type -p mspdb140.dll').
    Additionally, due to a known (but not-yet-fixed) issue downloading the
    'build-installers' flavor of the Git for Windows SDK with the
    'git-for-windows/setup-git-for-windows-sdk' Action, the SDK used is the
    'full' flavor.
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    cfed047 View commit details
    Browse the repository at this point in the history
  104. release: add Mac OSX installer build

    - include `scalar`
    - build signed .dmg & .pkg for target OS version 10.6
    - upload artifacts to workflow
    
    Update 2022-08-11: .dmg and .pkg are now signed
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    7563c50 View commit details
    Browse the repository at this point in the history
  105. release: build unsigned Ubuntu .deb package

    - include `scalar`
    - build & upload unsigned .deb package
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    6dc4e87 View commit details
    Browse the repository at this point in the history
  106. Disable the monitor-components workflow in msft-git

    It really does not make sense to run that workflow in any fork of
    git-for-windows/git. Typically, it is enough to simply disable it (since
    it is a scheduled workflow, it is disabled by default in any new fork).
    
    However, in microsoft/git, we switch the default branch whenever we
    rebase to a new upstream version, and every time we do so, this
    scheduled workflow gets re-enabled.
    
    Let's just delete it in microsoft/git and never be bothered by it again.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    3869825 View commit details
    Browse the repository at this point in the history
  107. release: add signing step for .deb package

    - sign using Azure-stored certificates & client
    - sign on Windows agent via python script
    - job skipped if credentials for accessing certificate aren't present
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    2b9e0f6 View commit details
    Browse the repository at this point in the history
  108. .github: enable windows builds on microsoft fork

    This was disabled by a0da6de (ci: only run win+VS build & tests in
    Git for Windows' fork, 2022-12-19) to avoid other forks doing too many
    builds. But we want to keep these builds for the microsoft/git fork.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    44ef83b View commit details
    Browse the repository at this point in the history
  109. Makefile: allow specifying GIT_BUILT_FROM_COMMIT

    Allow specification of a custom `GIT_BUILT_FROM_COMMIT` string to replace
    the output of `git rev-parse HEAD`. This allows a build of `git` from
    somewhere other than an active clone of `git` (e.g. from the archive created
    with `make dist`) to include commit information in
    `git version --build-options`.
    
    Signed-off-by: Victoria Dye <vdye@github.com>
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    166decd View commit details
    Browse the repository at this point in the history
  110. dist: archive HEAD instead of HEAD^{tree}

    Update `git archive` tree-ish argument from `HEAD^{tree}` to `HEAD`. By
    using a commit (rather than tree) reference, the commit hash will be stored
    as an extended pax header, extractable git `git get-tar-commit-id`.
    
    The intended use-case for this change is building `git` from the output of
    `make dist` - in combination with the ability to specify a fallback
    `GIT_BUILT_FROM_COMMIT`, a user can extract the commit ID used to build the
    archive and set it as `GIT_BUILT_FROM_COMMIT`. The result is fully-populated
    information for the commit hash in `git version --build-options`.
    
    Signed-off-by: Victoria Dye <vdye@github.com>
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    fea717b View commit details
    Browse the repository at this point in the history
  111. update-microsoft-git: create barebones builtin

    Just do the boilerplate stuff of making a new builtin, including
    documentation and integration with git.c.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    be41ec0 View commit details
    Browse the repository at this point in the history
  112. release: create draft GitHub release with packages & installers

    - create release & uploads artifact using Octokit
    - use job "if" condition to handle uploading signed *or* unsigned .deb
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    644384f View commit details
    Browse the repository at this point in the history
  113. release: include GIT_BUILT_FROM_COMMIT in MacOS build

    Set the `GIT_BUILT_FROM_COMMIT` based on the version specified in the `make
    dist` output archive header. This ensures the commit hash is shown in
    `git version --build-options`.
    
    Signed-off-by: Victoria Dye <vdye@github.com>
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    3eb9a0a View commit details
    Browse the repository at this point in the history
  114. update-microsoft-git: Windows implementation

    On Windows, we have the 'git update-git-for-windows' command. It is
    poorly named within the microsoft/git fork, because the script has been
    updated to look at the GitHub releases of microsoft/git, not
    git-for-windows/git.
    
    Still, it handles all the complicated details about downloading,
    verifying, and running the installer.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    8ba7557 View commit details
    Browse the repository at this point in the history
  115. release: continue pestering until user upgrades

    In 'git-update-git-for-windows', there is a recently_seen variable that
    is loaded from Git config. This is intended to allow users to say "No, I
    don't want that version of Git for Windows." If users say no, then they
    are not reminded. Ever.
    
    We want users of microsoft/git to be notified repeately until they
    upgrade. The first notification might be dismissed because they don't
    want to interrupt their work. They should get the picture within a few
    reminders and upgrade in a timely fashion.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b373c23 View commit details
    Browse the repository at this point in the history
  116. release: add installer validation

    Add basic installer validation to release pipeline for Windows, macOS, and
    Linux (Debian package only). Validation runs the installers/any necessary
    setup and checks that the installed version matches the expected version.
    ldennington authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    fae3436 View commit details
    Browse the repository at this point in the history
  117. .github: update ISSUE_TEMPLATE.md for microsoft/git

    We have been using the default issue template from git-for-windows/git,
    but we should ask different questions than Git for Windows. Update the
    issue template to ask these helpful questions.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    82e9672 View commit details
    Browse the repository at this point in the history
  118. .github: update PULL_REQUEST_TEMPLATE.md

    We have long inherited the pull request template from
    git-for-windows/git, but we should probably do a better job of
    specifying the need for why a PR in microsoft/git exists instead of an
    upstream contribution.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    8c64722 View commit details
    Browse the repository at this point in the history
  119. git_config_set_multivar_in_file_gently(): add a lock timeout

    In particular when multiple processes want to write to the config
    simultaneously, it would come in handy to not fail immediately when
    another process locked the config, but to gently try again.
    
    This will help with Scalar's functional test suite which wants to
    register multiple repositories for maintenance semi-simultaneously.
    
    As not all code paths calling this function read the config (e.g. `git
    config`), we have to read the config setting via
    `git_config_get_ulong()`.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    747ad2c View commit details
    Browse the repository at this point in the history
  120. update-microsoft-git: use brew on macOS

    The steps to update the microsoft-git cask are:
    
    1. brew update
    2. brew upgrade --cask microsoft-git
    
    This is adapted from the UpgradeVerb within microsoft/scalar. There is
    one important simplification: Scalar needed to check 'brew list --cask'
    to find out if the 'scalar' cask or the 'scalar-azrepos' cask was
    installed (which determined if the 'microsoft-git' cask was a necessary
    dependency). We do not need that here, since we are already in the
    microsoft-git cask.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    ddba2fa View commit details
    Browse the repository at this point in the history
  121. Adjust README.md for microsoft/git

    Microsoft's fork of Git is not quite Git for Windows, therefore we want
    to tell the keen reader all about it. :-)
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    Lessley Dennington authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b54bd15 View commit details
    Browse the repository at this point in the history
  122. scalar: set the config write-lock timeout to 150ms

    By default, Git fails immediately when locking a config file for writing
    fails due to an existing lock. With this change, Scalar-registered
    repositories will fall back to trying a couple times within a 150ms
    timeout.
    
    Signed-off-by: Johannes Schindelin <johasc@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    6682f12 View commit details
    Browse the repository at this point in the history
  123. scalar: add docs from microsoft/scalar

    These docs have been altered to fit the version implemented in C within
    microsoft/git. This means in particular that the advanced.md file no
    longer applied at all. Some other areas were removed or significantly
    edited.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    ae4a077 View commit details
    Browse the repository at this point in the history
  124. Merge branch 'scalar-gentler-config-locking'

    Allow concurrent `scalar register` and `scalar unregister` calls to be
    more collaborative when trying to lock the global Git config at the very
    same time.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    8ccb9c1 View commit details
    Browse the repository at this point in the history
  125. Merge branch 'scalar-extra-docs'

    Adding the extra documentation from the Scalar project.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    43a5337 View commit details
    Browse the repository at this point in the history
  126. scalar (Windows): use forward slashes as directory separators

    Git traditionally uses those, not backslashes, ever.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    1498a83 View commit details
    Browse the repository at this point in the history
  127. scalar: add retry logic to run_git()

    Use a fixed 3 tries total to see how that increases our chances of
    success for subcommands such as 'git fetch'.
    
    We special-case the `diagnose` command here: When 672196a
    (scalar-diagnose: use 'git diagnose --mode=all', 2022-08-12) updated
    'scalar diagnose' to run 'git diagnose' as a subprocess, it was passed
    through the run_git() caller. We need to avoid repeating the call when
    the underlying 'git diagnose' command fails.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d98431c View commit details
    Browse the repository at this point in the history
  128. scalar: support the config command for backwards compatibility

    The .NET version supported running `scalar config` to reconfigure the
    current enlistment, and now the C port does, too.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    5ed4466 View commit details
    Browse the repository at this point in the history
  129. Merge branch 'microsoft/vfs-2.35.0'

    We actually only need the FSMonitor...
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    a69f8a0 View commit details
    Browse the repository at this point in the history
  130. scalar: implement a minimal JSON parser

    No grown-up C project comes without their own JSON parser.
    
    Just kidding!
    
    We need to parse a JSON result when determining which cache server to
    use. It would appear that searching for needles `"CacheServers":[`,
    `"Url":"` and `"GlobalDefault":true` _happens_ to work right now, it is
    fragile as it depends on no whitespace padding and on the order of the
    fields remaining as-is.
    
    Let's implement a super simple JSON parser (at the cost of being
    slightly inefficient) for that purpose. To avoid allocating a ton of
    memory, we implement a callback-based one. And to save on complexity,
    let's not even bother validating the input properly (we will just go
    ahead and instead rely on Azure Repos to produce correct JSON).
    
    Note: An alternative would have been to use existing solutions such as
    JSON-C, CentiJSON or JSMN. However, they are all a lot larger than the
    current solution; The smallest, JSMN, which does not even provide parsed
    string values (something we actually need) weighs in with 471 lines,
    while we get away with 182 + 29 lines for the C and the header file,
    respectively.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d4b2133 View commit details
    Browse the repository at this point in the history
  131. scalar clone: support GVFS-enabled remote repositories

    With this change, we come a big step closer to feature parity with
    Scalar: this allows cloning from Azure Repos (which do not support
    partial clones at time of writing).
    
    We use the just-implemented JSON parser to parse the response we got
    from the `gvfs/config` endpoint; Please note that this response might,
    or might not, contain information about a cache server. The presence or
    absence of said cache server, however, has nothing to do with the
    ability to speak the GVFS protocol (but the presence of the
    `gvfs/config` endpoint does that).
    
    An alternative considered during the development of this patch was to
    perform simple string matching instead of parsing the JSON-formatted
    data; However, this would have been fragile, as the response contains
    free-form text (e.g. the repository's description) which might contain
    parts that would confuse a simple string matcher (but not a proper JSON
    parser).
    
    Note: we need to limit the re-try logic in `git clone` to handle only
    the non-GVFS case: the call to `set_config()` to un-set the partial
    clone settings would otherwise fail because those settings would not
    exist in the GVFS protocol case. This will at least give us a clearer
    reason why such a fetch fails.
    
    Co-authored-by: Derrick Stolee <dstolee@microsoft.com>
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    dscho and derrickstolee committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    e7c0563 View commit details
    Browse the repository at this point in the history
  132. test-gvfs-protocol: also serve smart protocol

    This comes in handy, as we want to verify that `scalar clone` also works
    against a GVFS-enabled remote repository.
    
    Note that we have to set `MSYS2_ENV_CONV_EXCL` to prevent MSYS2 from
    mangling `PATH_TRANSLATED`: The value _does_ look like a Unix-style
    path, but no, MSYS2 must not be allowed to convert that into a Windows
    path: `http-backend` needs it in the unmodified form. (The MSYS2 runtime
    comes in when `git` is run via `bin-wrappers/git`, which is a shell
    script.)
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    11adbf7 View commit details
    Browse the repository at this point in the history
  133. gvfs-helper: add the endpoint command

    We already have the `config` command that accesses the `gvfs/config`
    endpoint.
    
    To implement `scalar`, we also need to be able to access the `vsts/info`
    endpoint. Let's add a command to do precisely that.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b98dacc View commit details
    Browse the repository at this point in the history
  134. dir_inside_of(): handle directory separators correctly

    On Windows, both the forward slash and the backslash are directory
    separators. Which means that `a\b\c` really is inside `a/b`. Therefore,
    we need to special-case the directory separators in the helper function
    `cmp_icase()` that is used in the loop in `dir_inside_of()`.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    1a61a8e View commit details
    Browse the repository at this point in the history
  135. Merge branch 'scalar'

    This merges the upstreamable part of the Scalar patches.
    
    Minor merge conflicts (caused by the gvfs-helper) were resolved
    trivially.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    fb255f0 View commit details
    Browse the repository at this point in the history
  136. scalar: disable authentication in unattended mode

    Modified to remove call to is_unattended() that has not been implemented
    yet.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    85d9478 View commit details
    Browse the repository at this point in the history
  137. sparse-checkout: add config to disable deleting dirs

    The clean_tracked_sparse_directories() method deletes the tracked
    directories that go out of scope when the sparse-checkout cone changes,
    at least in cone mode. This is new behavior, but is recommended based on
    our understanding of how users are interacting with the feature in most
    cases.
    
    It is possible that some users will object to the new behavior, so
    create a new configuration option 'index.deleteSparseDirectories' that
    can be set to 'false' to make clean_tracked_sparse_directories() do
    nothing. This will keep all untracked files in the working tree and
    cause performance problems with the sparse index, but those trade-offs
    are for the user to decide.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    c9c7b34 View commit details
    Browse the repository at this point in the history
  138. add/rm: allow adding sparse entries when virtual

    Upstream, a20f704 (add: warn when asked to update SKIP_WORKTREE entries,
    2021-04-08) modified how 'git add <pathspec>' works with cache entries
    marked with the SKIP_WORKTREE bit. The intention is to prevent a user
    from accidentally adding a path that is outside their sparse-checkout
    definition but somehow matches an existing index entry.
    
    A similar change for 'git rm' happened in d5f4b82 (rm: honor sparse
    checkout patterns, 2021-04-08).
    
    This breaks when using the virtual filesystem in VFS for Git. It is
    rare, but we could be in a scenario where the user has staged a change
    and then the file is projected away. If the user re-adds the file, then
    this warning causes the command to fail with the advise message.
    
    Disable this logic when core_virtualfilesystem is enabled.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    bedddbb View commit details
    Browse the repository at this point in the history
  139. diff: ignore sparse paths in diffstat

    The diff_populate_filespec() method is used to describe the diff after a
    merge operation is complete, especially when a conflict appears. In
    order to avoid expanding a sparse index, the reuse_worktree_file() needs
    to be adapted to ignore files that are outside of the sparse-checkout
    cone. The file names and OIDs used for this check come from the merged
    tree in the case of the ORT strategy, not the index, hence the ability
    to look into these paths without having already expanded the index.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    45e72a7 View commit details
    Browse the repository at this point in the history
  140. Merge pull request msysgit#392: add: allow adding sparse entries when…

    … virtual
    
    Upstream, a20f704 (add: warn when asked to update SKIP_WORKTREE entries,
    04-08-2021) modified how 'git add <pathspec>' works with cache entries
    marked with the SKIP_WORKTREE bit. The intention is to prevent a user
    from accidentally adding a path that is outside their sparse-checkout
    definition but somehow matches an existing index entry.
    
    This breaks when using the virtual filesystem in VFS for Git. It is
    rare, but we could be in a scenario where the user has staged a change
    and then the file is projected away. If the user re-adds the file, then
    this warning causes the command to fail with the advise message.
    
    Disable this logic when core_virtualfilesystem is enabled.
    
    This should allow the VFS for Git functional tests to pass (at least
    the ones in the default run). I'll create a `-pr` installer build to
    check before merging this.
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    3de4449 View commit details
    Browse the repository at this point in the history
  141. Merge branch 'sparse-index/merge' into vfs-2.33.0

    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    4cad8ac View commit details
    Browse the repository at this point in the history
  142. repo-settings: enable sparse index by default

    There is some strangeness when expanding a sparse-index that exists
    within a submodule. We will need to resolve that later, but for now,
    let's do a better job of explicitly disabling the sparse-index when
    requested, and do so in t7817.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b584ffd View commit details
    Browse the repository at this point in the history
  143. Merge pull request msysgit#410: Sparse Index: latest integrations

    ```
    6e74958 p2000: add 'git checkout -' test and decrease depth
    3e1d03c p2000: compress repo names
    cd94f82 commit: integrate with sparse-index
    65e79b8 sparse-index: recompute cache-tree
    e9a9981 checkout: stop expanding sparse indexes
    4b801c8 t1092: document bad 'git checkout' behavior
    71e3015 unpack-trees: resolve sparse-directory/file conflicts
    5e96df4 t1092: test merge conflicts outside cone
    defab1b add: allow operating on a sparse-only index
    9fc4313 pathspec: stop calling ensure_full_index
    0ec03ab add: ignore outside the sparse-checkout in refresh()
    adf5b15 add: remove ensure_full_index() with --renormalize
    ```
    
    These commits are equivalent to those already in `next` via gitgitgadget#999.
    
    ```
    80b8d6c Merge branch 'sparse-index/add' into stolee/sparse-index/add
    ```
    
    This merge resolves conflicts with some work that happened in parallel, but is already in upstream `master`.
    
    ```
    c407b2c t7519: rewrite sparse index test
    9dad0d2 sparse-index: silently return when not using cone-mode patterns
    2974920 sparse-index: silently return when cache tree fails
    e7cdaa0 unpack-trees: fix nested sparse-dir search
    347410c sparse-checkout: create helper methods
    4537233 attr: be careful about sparse directories
    5282a86 sparse-index: add SPARSE_INDEX_MEMORY_ONLY flag
    3a2f316 sparse-checkout: clear tracked sparse dirs
    fb47b56 sparse-checkout: add config to disable deleting dirs
    ```
    
    These commits are the ones under review as of gitgitgadget#1009. Recent review made this less stable. It's a slightly different and more robust version of msysgit#396.
    
    > Note: I'm still not done with the feedback for upstream, but the remaining feedback is "can we add tests that cover these tricky technical bits?" and in `microsoft/git` these are already covered by the Scalar functional tests (since that's how they were found).
    
    ```
    080b02c diff: ignore sparse paths in diffstat
    d91a647 merge: make sparse-aware with ORT
    df49b5f merge-ort: expand only for out-of-cone conflicts
    cdecb85 t1092: add cherry-pick, rebase tests
    0c1ecfb sequencer: ensure full index if not ORT strategy
    406dfbe sparse-index: integrate with cherry-pick and rebase
    ```
    
    These commits integrate with `git merge`, `git cherry-pick`, `git revert`, and `git rebase` as of gitgitgadget#1019. This got some feedback that changed how the tests were working so they are more robust. This led to a new commit (0c1ecfb).
    
    ```
    cbb0ab3 Merge branch 'sparse-index/merge' into vfs-2.33.0
    acb8623 t7524: test no longer fails
    ```
    
    Finally, the commits are merged into `vfs-2.33.0` and also we include a fix to a `microsoft/git` test that is no longer broken.
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    eae77a5 View commit details
    Browse the repository at this point in the history
  144. diff(sparse-index): verify with partially-sparse

    This verifies that `diff` and `diff --staged` behave the same in sparse
    index repositories in the following partially-staged scenarios (i.e. the
    index, HEAD, and working directory differ at a given path):
        1. Path is within sparse-checkout cone.
        2. Path is outside sparse-checkout cone.
        3. A merge conflict exists for paths outside sparse-checkout cone.
    
    Signed-off-by: Lessley Dennington <lessleydennington@gmail.com>
    ldennington authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    41b507a View commit details
    Browse the repository at this point in the history
  145. Merge pull request msysgit#414: Make sparse index the default

    This branch is exactly msysgit#410, but with one more commit: enabling the sparse index by default in d59110a.
    
    Having this in the `vfs-2.33.0` branch helps build confidence that the sparse index is doing what it should be doing by running in the Scalar functional tests and in our test branches.
    
    If we want to cut a new `microsoft/git` release without enabling the sparse index, we can simply revert this commit.
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    ba55e8d View commit details
    Browse the repository at this point in the history
  146. Merge pull request msysgit#419 from ldennington/sparse-index-diff

    diff: enable and test the sparse index
    ldennington authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    203919c View commit details
    Browse the repository at this point in the history
  147. stash: expand testing for git stash -u

    Test cases specific to handling untracked files in `git stash` a) ensure
    that files outside the sparse checkout definition are handled as-expected
    and b) document the index expansion inside of `git stash -u`. Note that, in b),
    it is not the full repository index that is expanded - it is the temporary,
    standalone index containing the stashed untracked files only.
    
    Signed-off-by: Victoria Dye <vdye@github.com>
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    9e01926 View commit details
    Browse the repository at this point in the history
  148. sequencer: avoid progress when stderr is redirected

    During a run of the Scalar functional tests, we hit a case where the
    inexact rename detection of a 'git cherry-pick' command slowed to the
    point of writing its delayed progress, failing the test because stderr
    differed from the control case. Showing progress like this when stderr
    is not a terminal is non-standard for Git, so inject an isatty(2) when
    initializing the progress option in sequencer.c.
    
    Unfortunately, there is no '--quiet' option in 'git cherry-pick'
    currently wired up. This could be considered in the future, and the
    isatty(2) could be moved to that position. This would also be needed for
    commands like 'git rebase', so we leave that for another time.
    
    Reported-by: Victoria Dye <vdye@github.com>
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d99a8a0 View commit details
    Browse the repository at this point in the history
  149. Merge pull request msysgit#430 from vdye/sparse-index/clean

    Sparse index: integrate with `clean` and `stash -u`
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    1da34b2 View commit details
    Browse the repository at this point in the history
  150. Merge pull request git-for-windows#432: sequencer: avoid progress whe…

    …n stderr is redirected
    
    During a run of the Scalar functional tests, we hit a case where the
    inexact rename detection of a 'git cherry-pick' command slowed to the
    point of writing its delayed progress, failing the test because stderr
    differed from the control case. Showing progress like this when stderr
    is not a terminal is non-standard for Git, so inject an isatty(2) when
    initializing the progress option in sequencer.c.
    
    Unfortunately, there is no '--quiet' option in 'git cherry-pick'
    currently wired up. This could be considered in the future, and the
    isatty(2) could be moved to that position. This would also be needed for
    commands like 'git rebase', so we leave that for another time.
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    71138e2 View commit details
    Browse the repository at this point in the history
  151. sparse: add vfs-specific precautions

    * t1092: remove the 'git update-index' test that currently fails
      because the command ignores the bad path, but doesn't return a
      failure.
    
    * dir.c: prevent matching against sparse-checkout patterns when the
      virtual filesystem is enabled. Should prevent some corner case
      issues.
    
    * t1092: add quiet mode for some rebase tests because the stderr
      output can change in some of the modes.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    30b36a6 View commit details
    Browse the repository at this point in the history
  152. Merge core VFS features

    These were done in private, before microsoft/git.
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    cb839fe View commit details
    Browse the repository at this point in the history
  153. Merge advanced VFS-specific features

    Most of these were done in private before microsoft/git. However,
    the following pull requests modified the core feature:
    
    	msysgit#85
    	msysgit#89
    	msysgit#91
    	msysgit#98
    	msysgit#243
    	msysgit#263
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    ab37eac View commit details
    Browse the repository at this point in the history
  154. Merge virtualfilesystem hook

    Add virtual file system settings and hook proc.  On index load,
    clear/set the skip worktree bits based on the virtual file system data.
    Use virtual file system data to update skip-worktree bit in
    unpack-trees. Use virtual file system data to exclude files and folders
    not explicitly requested.
    
    The hook was first contributed in private, but was extended via the
    following pull requests:
    
    	#15
    	#27
    	#33
    	msysgit#70
    
    Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    498a997 View commit details
    Browse the repository at this point in the history
  155. Merge updates to serialized status

    Includes these pull requests:
    
    	#1
    	#6
    	#10
    	#11
    	msysgit#157
    	msysgit#212
    	msysgit#260
    	msysgit#270
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    d5908c1 View commit details
    Browse the repository at this point in the history
  156. Merge trace2 experimental regions

    Includes gvfs-specific commits from these pull requests:
    
    	msysgit#158
    	msysgit#159
    	msysgit#160
    	msysgit#164
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    740600d View commit details
    Browse the repository at this point in the history
  157. Merge first wave of gvfs-helper feature

    Includes commits from these pull requests:
    
    	msysgit#191
    	msysgit#205
    	msysgit#206
    	msysgit#207
    	msysgit#208
    	msysgit#215
    	msysgit#220
    	msysgit#221
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    f60db9a View commit details
    Browse the repository at this point in the history
  158. Merge gvfs-helper prefetch feature

    Includes these pull requests:
    
     msysgit#227
     msysgit#228
     msysgit#229
     msysgit#231
     msysgit#240
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    b1d2c0f View commit details
    Browse the repository at this point in the history
  159. Harden gvfs-helper to validate the packfiles in a multipart prefetch …

    …response (git-for-windows#571)
    
    Teach `gvfs-helper` to ignore the optional `.idx` files that may be
    included in a `prefetch` response and always use `git index-pack` to
    create them from the `.pack` files received in the data stream.
    
    This is a little wasteful in terms of client-side compute and of the
    network bandwidth, but allows us to use the full packfile verification
    code contained within `git index-pack` to ensure that the received
    packfiles are valid.
    jeffhostetler authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    69f2af6 View commit details
    Browse the repository at this point in the history
  160. Merge upstreamable patches

    Includes commits from these pull requests:
    
    	msysgit#188
    
    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    97a2f31 View commit details
    Browse the repository at this point in the history
  161. Merge pull request msysgit#301: Update 'git maintenance' to match ups…

    …tream
    
    This PR updates our `vfs-2.29.0` branch's version of `git maintenance` to match the latest in upstream. Unfortunately, not all of these commits made it to the `2.30` release candidate, but there are more commits from the series making it in. They will cause a conflict in the `vfs-2.30.0` rebase, so merge them in here. This also includes the `fixup!` reverts of the earlier versions.
    
    Finally, I also noticed that we started depending on `git maintenance start` in Scalar for macOS, but we never checked that this worked with the shared object cache. It doesn't! 😨  The very tip commit of this PR includes logic to make `git maintenance run` care about `gvfs.sharedCache`. Functional test updates in Scalar will follow.
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    784cfcf View commit details
    Browse the repository at this point in the history
  162. Merge pull request msysgit#315: unpack-trees:virtualfilesystem: Impro…

    …ve efficiency of clear_ce_flags
    
    When the virtualfilesystem is enabled the previous implementation of
    clear_ce_flags would iterate all of the cache entries and query whether
    each one is in the virtual filesystem to determine whether to clear one
    of the SKIP_WORKTREE bits. For each cache entry, we would do a hash
    lookup for each parent directory in the is_included_in_virtualfilesystem
    function.
    
    The former approach is slow for a typical Windows OS enlistment with
    3 million files where only a small percentage is in the virtual
    filesystem. The cost is
    O(n_index_entries * n_chars_per_path * n_parent_directories_per_path).
    
    In this change, we use the same approach as apply_virtualfilesystem,
    which iterates the set of entries in the virtualfilesystem and searches
    in the cache for the corresponding entries in order to clear their
    flags. This approach has a cost of
    O(n_virtual_filesystem_entries * n_chars_per_path * log(n_index_entries)).
    
    The apply_virtualfilesystem code was refactored a bit and modified to
    clear flags for all names that 'alias' a given virtual filesystem name
    when ignore_case is set.
    
    n_virtual_filesystem_entries is typically much less than
    n_index_entries, in which case the new approach is much faster. We wind
    up building the name hash for the index, but this occurs quickly thanks
    to the multi-threading.
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    e4a2af6 View commit details
    Browse the repository at this point in the history
  163. Merge branch 'add-workflows'

    Adding a few workflows to publish releases! 🥳
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    a94cf79 View commit details
    Browse the repository at this point in the history
  164. Merge branch 'adjust-g4w-workflows'

    This disables the `monitor-components` workflow in msft-git, and
    re-enables the `win+VS` tests in this repository, too.
    dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    5f0261b View commit details
    Browse the repository at this point in the history
  165. Merge pull request msysgit#399 from vdye/feature/build-installers

    Implement workflow to create GitHub release with attached `git` installers
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    db534bb View commit details
    Browse the repository at this point in the history
  166. Merge pull request git-for-windows#472 from vdye/ms/macos-build-options

    Fixes for MacOS release build & build options
    vdye authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    603d78e View commit details
    Browse the repository at this point in the history
  167. Merge pull request msysgit#329: Add git update-microsoft-git

    This adds a new builtin, `git update-microsoft-git`, that executes the platform-specific upgrade steps to get the latest version of `microsoft-git`.
    
    On Windows, this means running `git update-git-for-windows` which was updated to use the `microsoft/git` releases page, when appropriate. See msysgit#321 for details.
    
    On macOS, this means running a sequence of `brew` commands. These are adapted from the `UpgradeVerb` in `microsoft/scalar`, with an important simplification: we don't need to differentiate between the `scalar` and `scalar-azrepos` cask.
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    9945961 View commit details
    Browse the repository at this point in the history
  168. Merge pull request msysgit#333: update microsoft/git README

    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee authored and dscho committed Aug 21, 2023
    Configuration menu
    Copy the full SHA
    7443907 View commit details
    Browse the repository at this point in the history

Commits on Aug 23, 2023

  1. scalar: do initialize gvfs.sharedCache

    This finalizes the port of the `QueryVstsInfo()` function: we already
    taught `gvfs-helper` to access the `vsts/info` endpoint on demand, we
    implemented proper JSON parsing, and now it is time to hook it all up.
    
    To that end, we also provide a default local cache root directory. It
    works the same way as the .NET version of Scalar: it uses
    
        C:\scalarCache on Windows,
    
        ~/.scalarCache/ on macOS and
    
        ~/.cache/scalar on Linux
    
    Modified to include call to is_unattended() that was removed from a
    previous commit.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    a39b9ec View commit details
    Browse the repository at this point in the history
  2. scalar diagnose: include shared cache info

    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    d1ba0f9 View commit details
    Browse the repository at this point in the history
  3. scalar: only try GVFS protocol on https:// URLs

    Well, technically also the http:// protocol is allowed _when testing_...
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    965a390 View commit details
    Browse the repository at this point in the history
  4. reset: fix mixed reset when using virtual filesystem

    During the 2.35.0 rebase, we ejected 570f64b (Fix reset when using the
    sparse-checkout feature., 2017-03-15) because of a similar change
    upstream that actually works with the expected behavior of
    sparse-checkout.
    
    That commit only ever existed in microsoft/git, but when it was
    considered for upstream we realized that it behaved strangely for a
    sparse-checkout scenario.
    
    The root problem is that during a mixed reset, 'git reset <commit>'
    updates the index to aggree with <commit> but leaves the worktree the
    same as it was before. The issue with sparse-checkout is that some files
    might not be in the worktree and thus the information from those files
    would be "lost".
    
    The upstream decision was to leave these files as ignored, because
    that's what the SKIP_WORKTREE bit means: don't put these files in the
    worktree and ignore their contents. If there already were files in the
    worktree, then Git does not change them. The case for "losing" data is
    if a committed change outside of the sparse-checkout was in the previous
    HEAD position. However, this information could be recovered from the
    reflog.
    
    The case where this is different is in a virtualized filesystem. The
    virtualization is projecting the index contents onto the filesystem, so
    we need to do something different here. In a virtual environment, every
    file is considered "important" and we abuse the SKIP_WORKTREE bit to
    indicate that Git does not need to process a projected file. When a file
    is populated, the virtual filesystem hook provides the information for
    removing the SKIP_WORKTREE bit.
    
    In the case of these mixed resets, we have the issue where we change the
    projection of the worktree for these cache entries that change. If a
    file is populated in the worktree, then the populated file will persist
    and appear in a follow-up 'git status'. However, if the file is not
    populated and only projected, we change the projection from the current
    value to the new value, leaving a clean 'git status'.
    
    The previous version of this commit includes a call to checkout_entry(),
    which populates the file. This causes the file to be actually in the
    working tree and no longer projected.
    
    To make this work with the upstream changes, stop setting the
    skip-worktree bit for the new cache entry. This seemed to work fine
    without this change, but it's likely due to some indirection with the
    virtual filesystem. Better to do the best-possible thing here so we
    don't hide a corner-case bug by accident.
    
    Helped-by: Victoria Dye <vdye@github.com>
    Signed-off-by: Kevin Willford <kewillf@microsoft.com>
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    Kevin Willford authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    0bb7fae View commit details
    Browse the repository at this point in the history
  5. Merge pull request git-for-windows#494: reset: fix mixed reset when u…

    …sing virtual filesystem
    
    This replaces git-for-windows#493 (can't reopen a PR after a force-push...).
    
    I updated this commit with a more firm version of the fix. This hopefully answers Victoria's excellent concerns with the previous approach.
    
    I did not manage to get an automated test for this, but I did carefully verify this manually with a few commits in a VFS for Git enlistment (with different files every time). I updated the commit message with more details about why this works.
    
    ---
    
    This fork contains changes specific to monorepo scenarios. If you are an
    external contributor, then please detail your reason for submitting to
    this fork:
    
    * [X] This change only applies to the virtualization hook and VFS for Git.
    
    Resolves git-for-windows#490.
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    aaa7d52 View commit details
    Browse the repository at this point in the history
  6. scalar: verify that we can use a GVFS-enabled repository

    Azure Repos does not support partial clones at the moment, but it does
    support the GVFS protocol. To that end, the Microsoft fork of Git has a
    `gvfs-helper` command that is optionally used to perform essentially the
    same functionality as partial clone.
    
    Let's verify that `scalar clone` detects that situation and enables the
    GVFS helper.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    ad14a2e View commit details
    Browse the repository at this point in the history
  7. scalar: add the cache-server command

    This allows setting the GVFS-enabled cache server, or listing the one(s)
    associated with the remote repository.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    7378a39 View commit details
    Browse the repository at this point in the history
  8. scalar: add a test toggle to skip accessing the vsts/info endpoint

    In Scalar's functional tests, we do not do anything with authentication.
    Therefore, we do want to avoid accessing the `vsts/info` endpoint
    because it requires authentication even on otherwise public
    repositories.
    
    Let's introduce the environment variable `SCALAR_TEST_SKIP_VSTS_INFO`
    which can be set to `true` to simply skip that step (and force the
    `url_*` style repository IDs instead of `id_*` whenever possible).
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    25aa160 View commit details
    Browse the repository at this point in the history
  9. scalar: adjust documentation to the microsoft/git fork

    Scalar in Microsoft's Git fork can do a little more than Scalar in
    upstream Git: in Microsoft's Git, it supports the GVFS protocol so that
    Scalar can clone from Azure DevOps.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    84ce512 View commit details
    Browse the repository at this point in the history
  10. scalar: enable untracked cache unconditionally

    Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    f905638 View commit details
    Browse the repository at this point in the history
  11. scalar diagnose: accommodate Scalar's Functional Tests

    Those tests specifically verify that the `.zip` file path is shown on
    `stdout`. Let's do that again, under the assumption that there are
    scripts out there that rely on this behavior.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    7efae3f View commit details
    Browse the repository at this point in the history
  12. scalar: parse clone --no-fetch-commits-and-trees for backwards comp…

    …atibility
    
    This option does not do anything anymore, though.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    ad15733 View commit details
    Browse the repository at this point in the history
  13. ci: run Scalar's Functional Tests

    Scalar's Functional Test suite is pretty comprehensive, and caught more
    than just one bug in the built-in FSMonitor that was missed by Git's own
    test suite.
    
    To benefit from this test suite, automatically run it on the `vfs-*`
    and `features/*` branches.
    
    Note: for simplicity, we're building Git from scratch in all matrix
    jobs.
    
    Also note: for speed, we are using `git-sdk-64-minimal`, even if it
    lacks the `/bin/install` that we need to install Git's files; We're
    providing a minimal shell script shim instead. Also, we do not need to
    bother with the Tcl/Tk parts, therefore we're skipping them, too.
    
    Finally, we use GIT_FORCE_UNTRACKED_CACHE in the functional tests, to
    give the untracked cache a thorough work-out.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    0ca292a View commit details
    Browse the repository at this point in the history
  14. Merge branch 'scalar-with-gvfs'

    Prepare `scalar` to use the GVFS protocol instead of partial clone
    (required to support Azure Repos).
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    c0617ee View commit details
    Browse the repository at this point in the history
  15. abspath: make strip_last_path_component() global

    The strip_last_component() method is helpful for finding the parent
    directory of a path stored in a strbuf. Extract it to a global method
    advertised in abspath.h. With that additional visibility, it is helpful to
    rename it to be more specific to paths.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    5aeee2f View commit details
    Browse the repository at this point in the history
  16. setup: add discover_git_directory_reason()

    There are many reasons why discovering a Git directory may fail. In
    particular, 8959555 (setup_git_directory(): add an owner check for
    the top-level directory, 2022-03-02) added ownership checks as a
    security precaution.
    
    Callers attempting to set up a Git directory may want to inform the user
    about the reason for the failure. For that, expose the enum
    discovery_result from within setup.c and into cache.h where
    discover_git_directory() is defined.
    
    I initially wanted to change the return type of discover_git_directory()
    to be this enum, but several callers rely upon the "zero means success".
    The two problems with this are:
    
    1. The zero value of the enum is actually GIT_DIR_NONE, so nonpositive
       results are errors.
    
    2. There are multiple successful states, so some positive results are
       successful.
    
    Instead of updating all callers immediately, add a new method,
    discover_git_directory_reason(), and convert discover_git_directory() to
    be a thin shim on top of it.
    
    Because there are extra checks that discover_git_directory_reason() does
    after setup_git_directory_gently_1(), there are other modes that can be
    returned for failure states. Add these modes to the enum, but be sure to
    explicitly add them as BUG() states in the switch of
    setup_git_directory_gently().
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    cfa61bd View commit details
    Browse the repository at this point in the history
  17. scalar: upgrade to newest FSMonitor config setting

    When FSMonitor was upstreamed, the 'core.useBuiltinFSMonitor' config was
    deprecated and replaced with an overload of the 'core.fsmonitor' config
    (i.e., if a boolean value was specified in 'core.fsmonitor', it is treated
    the way 'core.useBuiltinFSMonitor' originally was). Because 'scalar
    register' actively sets that config, use it to upgrade the deprecated config
    setting.
    
    Co-authored-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
    Signed-off-by: Victoria Dye <vdye@github.com>
    2 people authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    779915c View commit details
    Browse the repository at this point in the history
  18. Merge branch 'run-scalar-functional-tests'

    Run the comprehensive Scalar Functional Tests as part of CI and PR
    builds.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    8468f62 View commit details
    Browse the repository at this point in the history
  19. scalar: .scalarCache should live above enlistment

    We should not be putting the .scalarCache inside the enlistment as a
    sibling to the 'src' directory. This only happens in "unattended" mode,
    but it also negates any benefit of a shared object cache because each
    enlistment absolutely does not share any objects with others.
    
    Move the shared object cache in this case to a level above the
    enlistment, so at least there is some hope that it can be reused. This
    is also critical to the upcoming --no-src option, since the shared
    object cache cannot be located within the Git repository.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    6ccab79 View commit details
    Browse the repository at this point in the history
  20. scalar reconfigure: help users remove buggy repos

    When running 'scalar reconfigure -a', such as at install time, Scalar
    has warning messages about the repository missing (or not containing a
    .git directory). Failures can also happen while trying to modify the
    repository-local config for that repository.
    
    These warnings may seem confusing to users who don't understand what
    they mean or how to stop them.
    
    Add a warning that instructs the user how to remove the warning in
    future installations.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    45ea335 View commit details
    Browse the repository at this point in the history
  21. Merge branch 'scalar-reconfigure'

    This allows fixing settings after a Scalar upgrade, or after botching
    the enlistments configuration.
    
    Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    f9997c4 View commit details
    Browse the repository at this point in the history
  22. scalar: add --no-src option

    Some users have strong aversions to Scalar's opinion that the repository
    should be in a 'src' directory, even though it creates a clean slate for
    placing build outputs in adjacent directories.
    
    The --no-src option allows users to opt-out of the default behavior. The
    parse-opt logic automatically figures out that '--src' is a possible
    flag that negates '--no-src'.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    679f0de View commit details
    Browse the repository at this point in the history
  23. maintenance: add get_random_minute()

    When we initially created background maintenance -- with its hourly,
    daily, and weekly schedules -- we considered the effects of all clients
    launching fetches to the server every hour on the hour. The worry of
    DDoSing server hosts was noted, but left as something we would consider
    for a future update.
    
    As background maintenance has gained more adoption over the past three
    years, our worries about DDoSing the big Git hosts has been unfounded.
    Those systems, especially those serving public repositories, are already
    resilient to thundering herds of much smaller scale.
    
    However, sometimes organizations spin up specific custom server
    infrastructure either in addition to or on top of their Git host. Some
    of these technologies are built for a different range of scale, and can
    hit concurrency limits sooner. Organizations with such custom
    infrastructures are more likely to recommend tools like `scalar` which
    furthers their adoption of background maintenance.
    
    To help solve for this, create get_random_minute() as a method to help
    Git select a random minute when creating schedules in the future. The
    integrations with this method do not yet exist, but will follow in
    future changes.
    
    To avoid multiple sources of randomness in the Git codebase, create a
    new helper function, git_rand(), that returns a random uint32_t. This is
    similar to how rand() returns a random nonnegative value, except it is
    based on csprng_bytes() which is cryptographic and will return values
    larger than RAND_MAX.
    
    One thing that is important for testability is that we notice when we
    are under a test scenario and return a predictable result. The schedules
    themselves are not checked for this value, but at least one launchctl
    test checks that we do not unnecessarily reboot the schedule if it has
    not changed from a previous version.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    003438d View commit details
    Browse the repository at this point in the history
  24. maintenance: use random minute in launchctl scheduler

    The get_random_minute() method was created to allow maintenance
    schedules to be fixed to a random minute of the hour. This randomness is
    only intended to spread out the load from a number of clients, but each
    client should have an hour between each maintenance cycle.
    
    Use get_random_minute() when constructing the schedules for launchctl.
    
    The format already includes a 'Minute' key which is modified from 0 to
    the random minute.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    a0bfea8 View commit details
    Browse the repository at this point in the history
  25. maintenance: use random minute in Windows scheduler

    The get_random_minute() method was created to allow maintenance
    schedules to be fixed to a random minute of the hour. This randomness is
    only intended to spread out the load from a number of clients, but each
    client should have an hour between each maintenance cycle.
    
    Add this random minute to the Windows scheduler integration.
    
    We need only to modify the minute value for the 'StartBoundary' tag
    across the three schedules.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    b6aec3e View commit details
    Browse the repository at this point in the history
  26. maintenance: use random minute in cron scheduler

    The get_random_minute() method was created to allow maintenance
    schedules to be fixed to a random minute of the hour. This randomness is
    only intended to spread out the load from a number of clients, but each
    client should have an hour between each maintenance cycle.
    
    Add this random minute to the cron integration.
    
    The cron schedule specification starts with a minute indicator, which
    was previously inserted as the "0" string but now takes the given minute
    as an integer parameter.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    5ef6e38 View commit details
    Browse the repository at this point in the history
  27. maintenance: swap method locations

    The systemd_timer_write_unit_templates() method writes a single template
    that is then used to start the hourly, daily, and weekly schedules with
    systemd.
    
    However, in order to schedule systemd maintenance on a given minute,
    these templates need to be replaced with specific schedules for each of
    these jobs.
    
    Before modifying the schedules, move the writing method above the
    systemd_timer_enable_unit() method, so we can write a specific schedule
    for each unit.
    
    The diff is computed smaller by showing systemd_timer_enable_unit() and
    systemd_timer_delete_units()  move instead of
    systemd_timer_write_unit_templates() and
    systemd_timer_delete_unit_templates().
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    c66dfb2 View commit details
    Browse the repository at this point in the history
  28. Merge pull request git-for-windows#508: scalar reconfigure: help user…

    …s remove buggy repos
    
    When running 'scalar reconfigure -a', such as at install time, Scalar
    has warning messages about the repository missing (or not containing a
    .git directory). Failures can also happen while trying to modify the
    repository-local config for that repository.
    
    These warnings may seem confusing to users who don't understand what
    they mean or how to stop them.
    
    Add a warning that instructs the user how to remove the warning in
    future installations.
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    81cdda3 View commit details
    Browse the repository at this point in the history
  29. maintenance: use random minute in systemd scheduler

    The get_random_minute() method was created to allow maintenance
    schedules to be fixed to a random minute of the hour. This randomness is
    only intended to spread out the load from a number of clients, but each
    client should have an hour between each maintenance cycle.
    
    Add this random minute to the systemd integration.
    
    This integration is more complicated than similar changes for other
    schedulers because of a neat trick that systemd allows: templating.
    
    The previous implementation generated two template files with names
    of the form 'git-maintenance@.(timer|service)'. The '.timer' or
    '.service' indicates that this is a template that is picked up when we
    later specify '...@<schedule>.timer' or '...@<schedule>.service'. The
    '<schedule>' string is then used to insert into the template both the
    'OnCalendar' schedule setting and the '--schedule' parameter of the
    'git maintenance run' command.
    
    In order to set these schedules to a given minute, we can no longer use
    the 'hourly', 'daily', or 'weekly' strings for '<schedule>' and instead
    need to abandon the template model for the .timer files. We can still
    use templates for the .service files. For this reason, we split these
    writes into two methods.
    
    Modify the template with a custom schedule in the 'OnCalendar' setting.
    This schedule has some interesting differences from cron-like patterns,
    but is relatively easy to figure out from context. The one that might be
    confusing is that '*-*-*' is a date-based pattern, but this must be
    omitted when using 'Mon' to signal that we care about the day of the
    week. Monday is used since that matches the day used for the 'weekly'
    schedule used previously.
    
    Now that the timer files are not templates, we might want to abandon the
    '@' symbol in the file names. However, this would cause users with
    existing schedules to get two competing schedules due to different
    names. The work to remove the old schedule name is one thing that we can
    avoid by keeping the '@' symbol in our unit names. Since we are locked
    into this name, it makes sense that we keep the template model for the
    .service files.
    
    The rest of the change involves making sure we are writing these .timer
    and .service files before initializing the schedule with 'systemctl' and
    deleting the files when we are done. Some changes are also made to share
    the random minute along with a single computation of the execution path
    of the current Git executable.
    
    In addition, older Git versions may have written a
    'git-maintenance@.timer' template file. Be sure to remove this when
    successfully enabling maintenance (or disabling maintenance).
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    cf2cb00 View commit details
    Browse the repository at this point in the history
  30. Merge pull request git-for-windows#536: Allow --no-src during clones …

    …and git worktree after clones
    
    These are two highly-requested items from an internal team considering a
    move to Scalar using Azure Repos.
    
    1. Remove the requirement that we create a `src` directory at clone time.
    
    2. Allow `git worktree` even when using the GVFS protocol.
    
    These are not difficult to implement. The `--no-src` option could even
    be submitted upstream (though the commit will need to drop one bit about
    an interaction with the local cache path).
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    c364ac0 View commit details
    Browse the repository at this point in the history
  31. maintenance: fix systemd schedule overlaps

    The 'git maintenance run' command prevents concurrent runs in the same
    repository using a 'maintenance.lock' file. However, when using systemd
    the hourly maintenance runs the same time as the daily and weekly runs.
    (Similarly, daily maintenance runs at the same time as weekly
    maintenance.) These competing commands result in some maintenance not
    actually being run.
    
    This overlap was something we could not fix until we made the recent
    change to not use the builting 'hourly', 'daily', and 'weekly' schedules
    in systemd. We can adjust the schedules such that:
    
     1. Hourly runs avoid the 0th hour.
     2. Daily runs avoid Monday.
    
    This will keep maintenance runs from colliding when using systemd.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    3bf089b View commit details
    Browse the repository at this point in the history
  32. Merge pull request msysgit#371 from dscho/run-scalar-functional-tests…

    …-and-fix-built-in-fsmonitor
    
    Fix the built-in FSMonitor, and run Scalar's Functional Tests as part of the automated builds
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    80631e0 View commit details
    Browse the repository at this point in the history
  33. maintenance: update schedule before config

    When running 'git maintenance start', the current pattern is to
    configure global config settings to enable maintenance on the current
    repository and set 'maintenance.auto' to false and _then_ to set up the
    schedule with the system scheduler.
    
    This has a problematic error condition: if the scheduler fails to
    initialize, the repository still will not use automatic maintenance due
    to the 'maintenance.auto' setting.
    
    Fix this gap by swapping the order of operations. If Git fails to
    initialize maintenance, then the config changes should never happen.
    
    Reported-by: Phillip Wood <phillip.wood123@gmail.com>
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    6d15915 View commit details
    Browse the repository at this point in the history
  34. Merge branch 'sparse-index-stuff'

    This is random stuff that probably all got upstream in the meantime.
    dscho authored and derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    a309546 View commit details
    Browse the repository at this point in the history
  35. maintenance: use random minute for scheduling (git-for-windows#597)

    * [x] This is an early version of work already under review upstream.
    
    See gitgitgadget#1567 for the version submitted upstream. This is an
    early version for the `microsoft/git` fork so we could potentially
    include it in a release to our Microsoft partners. Upgrading to a
    version with these changes may help with some of the auth problems
    plaguing GVFS Cache Servers. (It's not a long-term fix, but would avoid
    having fingers pointed in this direction in the future.)
    
    At least on Windows, we should re-run `git maintenance start` as part of
    `scalar reconfigure` during the installer. On other platforms, we will
    need to rely on users slowly rotating through their local repositories.
    
    > This PR is a recreation of git-for-windows#593 now that the upstream change required
    rebasing to resolve header conflicts.
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    c3a3d55 View commit details
    Browse the repository at this point in the history
  36. credential: add new interactive config option

    When scripts or background maintenance wish to perform HTTP(S) requests,
    there is a risk that our stored credentials might be invalid. At the
    moment, this causes the credential helper to ping the user and block the
    process. Even if the credential helper does not ping the user, Git falls
    back to the 'askpass' method, which includes a direct ping to the user
    via the terminal.
    
    Even setting the 'core.askPass' config as something like 'echo' will
    causes Git to fallback to a terminal prompt. It uses
    git_terminal_prompt(), which finds the terminal from the environment and
    ignores whether stdin has been redirected. This can also block the
    process awaiting input.
    
    Create a new config option to prevent user interaction, favoring a
    failure to a blocked process.
    
    The chosen name, 'credential.interactive', is taken from the config
    option used by Git Credential Manager to already avoid user
    interactivity, so there is already one credential helper that integrates
    with this option. However, older versions of Git Credential Manager also
    accepted other string values, including 'auto', 'never', and 'always'.
    The modern use is to use a boolean value, but we should still be
    careful that some users could have these non-booleans. Further, we
    should respect 'never' the same as 'false'. This is respected by the
    implementation and test, but not mentioned in the documentation.
    
    The implementation for the Git interactions takes place within
    credential_getpass(). The method prototype is modified to return an
    'int' instead of 'void'. This allows us to detect that no attempt was
    made to fill the given credential, changing the single caller slightly.
    
    Also, a new trace2 region is added around the interactive portion of the
    credential request. This provides a way to measure the amount of time
    spent in that region for commands that _are_ interactive. It also makes
    a conventient way to test that the config option works with
    'test_region'.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    22acd55 View commit details
    Browse the repository at this point in the history
  37. maintenance: add custom config to background jobs

    At the moment, some background jobs are getting blocked on credentials
    during the 'prefetch' task. This leads to other tasks, such as
    incremental repacks, getting blocked. Further, if a user manages to fix
    their credentials, then they still need to cancel the background process
    before their background maintenance can continue working.
    
    Update the background schedules for our four scheduler integrations to
    include these config options via '-c' options:
    
     * 'credential.interactive=false' will stop Git and some credential
       helpers from prompting in the UI (assuming the '-c' parameters are
       carried through and respected by GCM).
    
     * 'core.askPass=true' will replace the text fallback for a username
       and password into the 'true' command, which will return a success in
       its exit code, but Git will treat the empty string returned as an
       invalid password and move on.
    
    We can do some testing that the credentials are passed, at least in the
    systemd case due to writing the service files.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    384c80e View commit details
    Browse the repository at this point in the history
  38. scalar: configure maintenance during 'reconfigure'

    The 'scalar reconfigure' command is intended to update registered repos
    with the latest settings available. However, up to now we were not
    reregistering the repos with background maintenance.
    
    In particular, this meant that the background maintenance schedule would
    not be updated if there are improvements between versions.
    
    Be sure to register repos for maintenance during the reconfigure step.
    
    Signed-off-by: Derrick Stolee <derrickstolee@github.com>
    derrickstolee committed Aug 23, 2023
    Configuration menu
    Copy the full SHA
    c68e5fb View commit details
    Browse the repository at this point in the history