Commits on Apr 17, 2018
  1. Merge branch 'sb/filenames-with-dashes' into next

    gitster committed Apr 17, 2018
    Rename bunch of source files to more consistently use dashes
    instead of underscores to connect words.
    
    * sb/filenames-with-dashes:
      replace_object.c: rename to use dash in file name
      sha1_file.c: rename to use dash in file name
      sha1_name.c: rename to use dash in file name
      exec_cmd: rename to use dash in file name
      unicode_width.h: rename to use dash in file name
      write_or_die.c: rename to use dashes in file name
  2. Merge branch 'jk/ref-array-push' into next

    gitster committed Apr 17, 2018
    API clean-up aournd ref-filter code.
    
    * jk/ref-array-push:
      ref-filter: factor ref_array pushing into its own function
      ref-filter: make ref_array_item allocation more consistent
      ref-filter: use "struct object_id" consistently
  3. Merge branch 'bw/commit-partial-from-subdirectory-fix' into next

    gitster committed Apr 17, 2018
    "cd sub/dir && git commit ../path" ought to record the changes to
    the file "sub/path", but this regressed long time ago.
    
    * bw/commit-partial-from-subdirectory-fix:
      commit: allow partial commits with relative paths
Commits on Apr 11, 2018
  1. sha1_file.c: rename to use dash in file name

    stefanbeller authored and gitster committed Apr 10, 2018
    This is more consistent with the project style. The majority of Git's
    source files use dashes in preference to underscores in their file names.
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
  2. exec_cmd: rename to use dash in file name

    stefanbeller authored and gitster committed Apr 10, 2018
    This is more consistent with the project style. The majority of Git's
    source files use dashes in preference to underscores in their file names.
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
  3. Merge branch 'jk/branch-l-0-deprecation' into next

    gitster committed Apr 11, 2018
    The "-l" option in "git branch -l" is an unfortunate short-hand for
    "--create-reflog", but many users, both old and new, somehow expect
    it to be something else, perhaps "--list".  This step deprecates
    the short-hand and warns about the future removal of the it when it
    is used.
    
    * jk/branch-l-0-deprecation:
      branch: deprecate "-l" option
      t: switch "branch -l" to "branch --create-reflog"
      t3200: unset core.logallrefupdates when testing reflog creation
  4. Merge branch 'bw/protocol-v2' into next

    gitster committed Apr 11, 2018
    The beginning of the next-gen transfer protocol.
    
    * bw/protocol-v2: (35 commits)
      remote-curl: don't request v2 when pushing
      remote-curl: implement stateless-connect command
      http: eliminate "# service" line when using protocol v2
      http: don't always add Git-Protocol header
      http: allow providing extra headers for http requests
      remote-curl: store the protocol version the server responded with
      remote-curl: create copy of the service name
      pkt-line: add packet_buf_write_len function
      transport-helper: introduce stateless-connect
      transport-helper: refactor process_connect_service
      transport-helper: remove name parameter
      connect: don't request v2 when pushing
      connect: refactor git_connect to only get the protocol version once
      fetch-pack: support shallow requests
      fetch-pack: perform a fetch using v2
      upload-pack: introduce fetch server command
      push: pass ref prefixes when pushing
      fetch: pass ref prefixes when fetching
      ls-remote: pass ref prefixes when requesting a remote's refs
      transport: convert transport_get_remote_refs to take a list of ref prefixes
      ...
  5. Merge branch 'rs/status-with-removed-submodule'

    gitster committed Apr 11, 2018
    "git submodule status" misbehaved on a submodule that has been
    removed from the working tree.
    
    * rs/status-with-removed-submodule:
      submodule: check for NULL return of get_submodule_ref_store()
  6. Merge branch 'sb/packfiles-in-repository'

    gitster committed Apr 11, 2018
    Refactoring of the internal global data structure continues.
    
    * sb/packfiles-in-repository:
      packfile: keep prepare_packed_git() private
      packfile: allow find_pack_entry to handle arbitrary repositories
      packfile: add repository argument to find_pack_entry
      packfile: allow reprepare_packed_git to handle arbitrary repositories
      packfile: allow prepare_packed_git to handle arbitrary repositories
      packfile: allow prepare_packed_git_one to handle arbitrary repositories
      packfile: add repository argument to reprepare_packed_git
      packfile: add repository argument to prepare_packed_git
      packfile: add repository argument to prepare_packed_git_one
      packfile: allow install_packed_git to handle arbitrary repositories
      packfile: allow rearrange_packed_git to handle arbitrary repositories
      packfile: allow prepare_packed_git_mru to handle arbitrary repositories
  7. Merge branch 'sb/object-store'

    gitster committed Apr 11, 2018
    Refactoring the internal global data structure to make it possible
    to open multiple repositories, work with and then close them.
    
    Rerolled by Duy on top of a separate preliminary clean-up topic.
    The resulting structure of the topics looked very sensible.
    
    * sb/object-store: (27 commits)
      sha1_file: allow sha1_loose_object_info to handle arbitrary repositories
      sha1_file: allow map_sha1_file to handle arbitrary repositories
      sha1_file: allow map_sha1_file_1 to handle arbitrary repositories
      sha1_file: allow open_sha1_file to handle arbitrary repositories
      sha1_file: allow stat_sha1_file to handle arbitrary repositories
      sha1_file: allow sha1_file_name to handle arbitrary repositories
      sha1_file: add repository argument to sha1_loose_object_info
      sha1_file: add repository argument to map_sha1_file
      sha1_file: add repository argument to map_sha1_file_1
      sha1_file: add repository argument to open_sha1_file
      sha1_file: add repository argument to stat_sha1_file
      sha1_file: add repository argument to sha1_file_name
      sha1_file: allow prepare_alt_odb to handle arbitrary repositories
      sha1_file: allow link_alt_odb_entries to handle arbitrary repositories
      sha1_file: add repository argument to prepare_alt_odb
      sha1_file: add repository argument to link_alt_odb_entries
      sha1_file: add repository argument to read_info_alternates
      sha1_file: add repository argument to link_alt_odb_entry
      sha1_file: add raw_object_store argument to alt_odb_usable
      pack: move approximate object count to object store
      ...
Commits on Apr 10, 2018
  1. Merge branch 'ps/contains-id-error-message'

    gitster committed Apr 10, 2018
    "git tag --contains no-such-commit" gave a full list of options
    after giving an error message.
    
    * ps/contains-id-error-message:
      parse-options: do not show usage upon invalid option value
Commits on Apr 9, 2018
  1. Merge branch 'nd/worktree-prune'

    gitster committed Apr 9, 2018
    The way "git worktree prune" worked internally has been simplified,
    by assuming how "git worktree move" moves an existing worktree to a
    different place.
    
    * nd/worktree-prune:
      worktree prune: improve prune logic when worktree is moved
      worktree: delete dead code
      gc.txt: more details about what gc does
  2. Merge branch 'bc/object-id'

    gitster committed Apr 9, 2018
    Conversion from uchar[20] to struct object_id continues.
    
    * bc/object-id: (36 commits)
      convert: convert to struct object_id
      sha1_file: introduce a constant for max header length
      Convert lookup_replace_object to struct object_id
      sha1_file: convert read_sha1_file to struct object_id
      sha1_file: convert read_object_with_reference to object_id
      tree-walk: convert tree entry functions to object_id
      streaming: convert istream internals to struct object_id
      tree-walk: convert get_tree_entry_follow_symlinks internals to object_id
      builtin/notes: convert static functions to object_id
      builtin/fmt-merge-msg: convert remaining code to object_id
      sha1_file: convert sha1_object_info* to object_id
      Convert remaining callers of sha1_object_info_extended to object_id
      packfile: convert unpack_entry to struct object_id
      sha1_file: convert retry_bad_packed_offset to struct object_id
      sha1_file: convert assert_sha1_type to object_id
      builtin/mktree: convert to struct object_id
      streaming: convert open_istream to use struct object_id
      sha1_file: convert check_sha1_signature to struct object_id
      sha1_file: convert read_loose_object to use struct object_id
      builtin/index-pack: convert struct ref_delta_entry to object_id
      ...
  3. Merge branch 'ma/shortlog-revparse'

    gitster committed Apr 9, 2018
    "git shortlog cruft" aborted with a BUG message when run outside a
    Git repository.  The command has been taught to complain about
    extra and unwanted arguments on its command line instead in such a
    case.
    
    * ma/shortlog-revparse:
      shortlog: disallow left-over arguments outside repo
      shortlog: add usage-string for stdin-reading
      git-shortlog.txt: reorder usages
Commits on Apr 8, 2018
  1. ref-filter: use "struct object_id" consistently

    peff authored and gitster committed Apr 6, 2018
    Internally we store a "struct object_id", and all of our
    callers have one to pass us. But we insist that they peel it
    to its bare-sha1 hash, which we then hashcpy() into place.
    Let's pass it around as an object_id, which future-proofs us
    for a post-sha1 world.
    
    Signed-off-by: Jeff King <peff@peff.net>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Apr 5, 2018
  1. commit: allow partial commits with relative paths

    bmwill authored and gitster committed Apr 3, 2018
    Commit 8894d53 (commit: allow partial commits with relative paths,
    2011-07-30) ensured that partial commits were allowed when a user
    supplies a relative pathspec but then this was regressed in 5879f56
    (remove prefix argument from pathspec_prefix, 2011-09-04) when the
    prefix argument to 'pathspec_prefix' removed and the 'list_paths'
    function wasn't properly adjusted to cope with the change, resulting in
    over-eager pruning of the tree that is overlayed on the index.
    
    This fixes the regression and adds a regression test so this can be
    prevented in the future.
    
    Signed-off-by: Brandon Williams <bmwill@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 28, 2018
  1. submodule: check for NULL return of get_submodule_ref_store()

    rscharfe authored and gitster committed Mar 28, 2018
    If we can't find a ref store for a submodule then assume the latter
    is not initialized (or was removed).  Print a status line accordingly
    instead of causing a segmentation fault by passing NULL as the first
    parameter of refs_head_ref().
    
    Reported-by: Jeremy Feusi <jeremy@feusi.co>
    Reviewed-by: Stefan Beller <sbeller@google.com>
    Initial-Test-By: Stefan Beller <sbeller@google.com>
    Helped-by: Eric Sunshine <sunshine@sunshineco.com>
    Signed-off-by: Rene Scharfe <l.s.r@web.de>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. Merge branch 'pc/submodule-helper'

    gitster committed Mar 28, 2018
    Hotfix.
    
    * pc/submodule-helper:
      submodule deinit: handle non existing pathspecs gracefully
  3. submodule deinit: handle non existing pathspecs gracefully

    stefanbeller authored and gitster committed Mar 27, 2018
    This fixes a regression introduced in 2e61273 (submodule: port
    submodule subcommand 'deinit' from shell to C, 2018-01-15), when
    handling pathspecs that do not exist gracefully. This restores the
    historic behavior of reporting the pathspec as unknown and returning
    instead of reporting a bug.
    
    Reported-by: Peter Oberndorfer <kumbayo84@arcor.de>
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 26, 2018
  1. branch: deprecate "-l" option

    peff authored and gitster committed Mar 26, 2018
    The "-l" option is short for "--create-reflog". This has
    caused much confusion over the years. Most people expect it
    to work as "--list", because that would match the other
    "mode" options like -d/--delete and -m/--move, as well as
    the similar -l/--list option of git-tag.
    
    Adding to the confusion, using "-l" _appears_ to work as
    "--list" in some cases:
    
      $ git branch -l
      * master
    
    because the branch command defaults to listing (so even
    trying to specify --list in the command above is redundant).
    But that may bite the user later when they add a pattern,
    like:
    
      $ git branch -l foo
    
    which does not return an empty list, but in fact creates a
    new branch (with a reflog, naturally) called "foo".
    
    It's also probably quite uncommon for people to actually use
    "-l" to create a reflog. Since 0bee591 (Enable reflogs by
    default in any repository with a working directory.,
    2006-12-14), this is the default in non-bare repositories.
    So it's rather unfortunate that the feature squats on the
    short-and-sweet "-l" (which was only added in 3a4b3f2
    (Create/delete branch ref logs., 2006-05-19), meaning there
    were only 7 months where it was actually useful).
    
    Let's deprecate "-l" in hopes of eventually dropping it
    (it's a little too soon to repurpose it to "--list", but we
    may even do that eventually).
    
    Signed-off-by: Jeff King <peff@peff.net>
    Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
    Reviewed-by: Jacob Keller <jacob.keller@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. packfile: keep prepare_packed_git() private

    pclouds authored and gitster committed Mar 23, 2018
    The reason callers have to call this is to make sure either packed_git
    or packed_git_mru pointers are initialized since we don't do that by
    default. Sometimes it's hard to see this connection between where the
    function is called and where packed_git pointer is used (sometimes in
    separate functions).
    
    Keep this dependency internal because now all access to packed_git and
    packed_git_mru must go through get_xxx() wrappers.
    
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. packfile: add repository argument to reprepare_packed_git

    stefanbeller authored and gitster committed Mar 23, 2018
    See previous patch for explanation.
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  4. packfile: add repository argument to prepare_packed_git

    stefanbeller authored and gitster committed Mar 23, 2018
    Add a repository argument to allow prepare_packed_git callers to be
    more specific about which repository to handle. See commit "sha1_file:
    add repository argument to link_alt_odb_entry" for an explanation of
    the #define trick.
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  5. sha1_file: add repository argument to prepare_alt_odb

    stefanbeller authored and gitster committed Mar 23, 2018
    See previous patch for explanation.
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  6. object-store: close all packs upon clearing the object store

    stefanbeller authored and gitster committed Mar 23, 2018
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  7. object-store: move packed_git and packed_git_mru to object store

    stefanbeller authored and gitster committed Mar 23, 2018
    In a process with multiple repositories open, packfile accessors
    should be associated to a single repository and not shared globally.
    Move packed_git and packed_git_mru into the_repository and adjust
    callers to reflect this.
    
    [nd: while at there, wrap access to these two fields in get_packed_git()
    and get_packed_git_mru(). This allows us to lazily initialize these
    fields without caller doing that explicitly]
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 23, 2018
  1. object-store: move alt_odb_list and alt_odb_tail to object store

    stefanbeller authored and gitster committed Mar 23, 2018
    In a process with multiple repositories open, alternates should be
    associated to a single repository and not shared globally. Move
    alt_odb_list and alt_odb_tail into the_repository and adjust callers
    to reflect this.
    
    Now that the alternative object data base is per repository, we're
    leaking its memory upon freeing a repository. The next patch plugs
    this hole.
    
    No functional change intended.
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  2. object-store: migrate alternates struct and functions from cache.h

    stefanbeller authored and gitster committed Mar 23, 2018
    Migrate the struct alternate_object_database and all its related
    functions to the object store as these functions are easier found in
    that header. The migration is just a verbatim copy, no need to
    include the object store header at any C file, because cache.h includes
    repository.h which in turn includes the object-store.h
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
  3. repository: introduce raw object store field

    stefanbeller authored and gitster committed Mar 23, 2018
    The raw object store field will contain any objects needed for access
    to objects in a given repository.
    
    This patch introduces the raw object store and populates it with the
    `objectdir`, which used to be part of the repository struct.
    
    As the struct gains members, we'll also populate the function to clear
    the memory for these members.
    
    In a later step, we'll introduce a struct object_parser, that will
    complement the object parsing in a repository struct: The raw object
    parser is the layer that will provide access to raw object content,
    while the higher level object parser code will parse raw objects and
    keeps track of parenthood and other object relationships using 'struct
    object'.  For now only add the lower level to the repository struct.
    
    Signed-off-by: Stefan Beller <sbeller@google.com>
    Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
    Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>
Commits on Mar 22, 2018
  1. Merge branch 'jk/cached-commit-buffer' into maint

    gitster committed Mar 22, 2018
    Code clean-up.
    
    * jk/cached-commit-buffer:
      revision: drop --show-all option
      commit: drop uses of get_cached_commit_buffer()
  2. Merge branch 'sm/mv-dry-run-update' into maint

    gitster committed Mar 22, 2018
    Code clean-up.
    
    * sm/mv-dry-run-update:
      mv: remove unneeded 'if (!show_only)'
      t7001: add test case for --dry-run
  3. Merge branch 'jc/worktree-add-short-help' into maint

    gitster committed Mar 22, 2018
    Error message fix.
    
    * jc/worktree-add-short-help:
      worktree: say that "add" takes an arbitrary commit in short-help
  4. Merge branch 'rs/describe-unique-abbrev' into maint

    gitster committed Mar 22, 2018
    Code clean-up.
    
    * rs/describe-unique-abbrev:
      describe: use strbuf_add_unique_abbrev() for adding short hashes
  5. Merge branch 'jt/fsck-code-cleanup' into maint

    gitster committed Mar 22, 2018
    Plug recently introduced leaks in fsck.
    
    * jt/fsck-code-cleanup:
      fsck: fix leak when traversing trees
  6. parse-options: do not show usage upon invalid option value

    ungps authored and gitster committed Mar 22, 2018
    Usually, the usage should be shown only if the user does not know what
    options are available. If the user specifies an invalid value, the user
    is already aware of the available options. In this case, there is no
    point in displaying the usage anymore.
    
    This patch applies to "git tag --contains", "git branch --contains",
    "git branch --points-at", "git for-each-ref --contains" and many more.
    
    Signed-off-by: Paul-Sebastian Ungureanu <ungureanupaulsebastian@gmail.com>
    Signed-off-by: Junio C Hamano <gitster@pobox.com>