1. 25 9月, 2017 5 次提交
  2. 14 9月, 2017 7 次提交
  3. 09 9月, 2017 11 次提交
    • M
      files_transaction_finish(): delete reflogs before references · 5e00a6c8
      Michael Haggerty 提交于
      If the deletion steps unexpectedly fail, it is less bad to leave a
      reference without its reflog than it is to leave a reflog without its
      reference, since the latter is an invalid repository state.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5e00a6c8
    • M
      packed-backend: rip out some now-unused code · 9939b33d
      Michael Haggerty 提交于
      Now the outside world interacts with the packed ref store only via the
      generic refs API plus a few lock-related functions. This allows us to
      delete some functions that are no longer used, thereby completing the
      encapsulation of the packed ref store.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9939b33d
    • M
      files_ref_store: use a transaction to update packed refs · dc39e099
      Michael Haggerty 提交于
      When processing a `files_ref_store` transaction, it is sometimes
      necessary to delete some references from the "packed-refs" file. Do
      that using a reference transaction conducted against the
      `packed_ref_store`.
      
      This change further decouples `files_ref_store` from
      `packed_ref_store`. It also fixes multiple problems, including the two
      revealed by test cases added in the previous commit.
      
      First, the old code didn't obtain the `packed-refs` lock until
      `files_transaction_finish()`. This means that a failure to acquire the
      `packed-refs` lock (e.g., due to contention with another process)
      wasn't detected until it was too late (problems like this are supposed
      to be detected in the "prepare" phase). The new code acquires the
      `packed-refs` lock in `files_transaction_prepare()`, the same stage of
      the processing when the loose reference locks are being acquired,
      removing another reason why the "prepare" phase might succeed and the
      "finish" phase might nevertheless fail.
      
      Second, the old code deleted the loose version of a reference before
      deleting any packed version of the same reference. This left a moment
      when another process might think that the packed version of the
      reference is current, which is incorrect. (Even worse, the packed
      version of the reference can be arbitrarily old, and might even point
      at an object that has since been garbage-collected.)
      
      Third, if a reference deletion fails to acquire the `packed-refs` lock
      altogether, then the old code might leave the repository in the
      incorrect state (possibly corrupt) described in the previous
      paragraph.
      
      Now we activate the new "packed-refs" file (sans any references that
      are being deleted) *before* deleting the corresponding loose
      references. But we hold the "packed-refs" lock until after the loose
      references have been finalized, thus preventing a simultaneous
      "pack-refs" process from packing the loose version of the reference in
      the time gap, which would otherwise defeat our attempt to delete it.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      dc39e099
    • M
      t1404: demonstrate two problems with reference transactions · 6a2a7736
      Michael Haggerty 提交于
      Currently, a loose reference is deleted even before locking the
      `packed-refs` file, let alone deleting any packed version of the
      reference. This leads to two problems, demonstrated by two new tests:
      
      * While a reference is being deleted, other processes might see the
        old, packed value of the reference for a moment before the packed
        version is deleted. Normally this would be hard to observe, but we
        can prolong the window by locking the `packed-refs` file externally
        before running `update-ref`, then unlocking it before `update-ref`'s
        attempt to acquire the lock times out.
      
      * If the `packed-refs` file is locked so long that `update-ref` fails
        to lock it, then the reference can be left permanently in the
        incorrect state described in the previous point.
      
      In a moment, both problems will be fixed.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6a2a7736
    • M
      files_initial_transaction_commit(): use a transaction for packed refs · 1444bfe0
      Michael Haggerty 提交于
      Use a `packed_ref_store` transaction in the implementation of
      `files_initial_transaction_commit()` rather than using internal
      features of the packed ref store. This further decouples
      `files_ref_store` from `packed_ref_store`.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1444bfe0
    • M
      prune_refs(): also free the linked list · 22b09cdf
      Michael Haggerty 提交于
      At least since v1.7, the elements of the `refs_to_prune` linked list
      have been leaked. Fix the leak by teaching `prune_refs()` to free the
      list elements as it processes them.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      22b09cdf
    • M
      files_pack_refs(): use a reference transaction to write packed refs · 27d03d04
      Michael Haggerty 提交于
      Now that the packed reference store supports transactions, we can use
      a transaction to write the packed versions of references that we want
      to pack. This decreases the coupling between `files_ref_store` and
      `packed_ref_store`.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      27d03d04
    • M
      packed_delete_refs(): implement method · 2fb330ca
      Michael Haggerty 提交于
      Implement `packed_delete_refs()` using a reference transaction. This
      means that `files_delete_refs()` can use `refs_delete_refs()` instead
      of `repack_without_refs()` to delete any packed references, decreasing
      the coupling between the classes.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2fb330ca
    • M
      packed_ref_store: implement reference transactions · 2775d872
      Michael Haggerty 提交于
      Implement the methods needed to support reference transactions for
      the packed-refs backend. The new methods are not yet used.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2775d872
    • M
      struct ref_transaction: add a place for backends to store data · 3bf4f561
      Michael Haggerty 提交于
      `packed_ref_store` is going to want to store some transaction-wide
      data, so make a place for it.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3bf4f561
    • M
      packed-backend: don't adjust the reference count on lock/unlock · 39c8df0c
      Michael Haggerty 提交于
      The old code incremented the packed ref cache reference count when
      acquiring the packed-refs lock, and decremented the count when
      releasing the lock. This is unnecessary because:
      
      * Another process cannot change the packed-refs file because it is
        locked.
      
      * When we ourselves change the packed-refs file, we do so by first
        modifying the packed ref-cache, and then writing the data from the
        ref-cache to disk. So the packed ref-cache remains fresh because any
        changes that we plan to make to the file are made in the cache first
        anyway.
      
      So there is no reason for the cache to become stale.
      
      Moreover, the extra reference count causes a problem if we
      intentionally clear the packed refs cache, as we sometimes need to do
      if we change the cache in anticipation of writing a change to disk,
      but then the write to disk fails. In that case, `packed_refs_unlock()`
      would have no easy way to find the cache whose reference count it
      needs to decrement.
      
      This whole issue will soon become moot due to upcoming changes that
      avoid changing the in-memory cache as part of updating the packed-refs
      on disk, but this change makes that transition easier.
      Signed-off-by: NMichael Haggerty <mhagger@alum.mit.edu>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      39c8df0c
  4. 27 8月, 2017 17 次提交
    • J
      The fifth batch post 2.14 · 238e487e
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      238e487e
    • J
      Merge branch 'mg/killed-merge' · 6e6ba65a
      Junio C Hamano 提交于
      Killing "git merge --edit" before the editor returns control left
      the repository in a state with MERGE_MSG but without MERGE_HEAD,
      which incorrectly tells the subsequent "git commit" that there was
      a squash merge in progress.  This has been fixed.
      
      * mg/killed-merge:
        merge: save merge state earlier
        merge: split write_merge_state in two
        merge: clarify call chain
        Documentation/git-merge: explain --continue
      6e6ba65a
    • J
      Merge branch 'jt/packmigrate' · eabdcd4a
      Junio C Hamano 提交于
      Code movement to make it easier to hack later.
      
      * jt/packmigrate: (23 commits)
        pack: move for_each_packed_object()
        pack: move has_pack_index()
        pack: move has_sha1_pack()
        pack: move find_pack_entry() and make it global
        pack: move find_sha1_pack()
        pack: move find_pack_entry_one(), is_pack_valid()
        pack: move check_pack_index_ptr(), nth_packed_object_offset()
        pack: move nth_packed_object_{sha1,oid}
        pack: move clear_delta_base_cache(), packed_object_info(), unpack_entry()
        pack: move unpack_object_header()
        pack: move get_size_from_delta()
        pack: move unpack_object_header_buffer()
        pack: move {,re}prepare_packed_git and approximate_object_count
        pack: move install_packed_git()
        pack: move add_packed_git()
        pack: move unuse_pack()
        pack: move use_pack()
        pack: move pack-closing functions
        pack: move release_pack_memory()
        pack: move open_pack_index(), parse_pack_index()
        ...
      eabdcd4a
    • J
      Merge branch 'mh/ref-lock-entry' · f2dd90fc
      Junio C Hamano 提交于
      The code to acquire a lock on a reference (e.g. while accepting a
      push from a client) used to immediately fail when the reference is
      already locked---now it waits for a very short while and retries,
      which can make it succeed if the lock holder was holding it during
      a read-only operation.
      
      * mh/ref-lock-entry:
        refs: retry acquiring reference locks for 100ms
      f2dd90fc
    • J
      Merge branch 'jt/doc-pack-objects-fix' · 138e52ea
      Junio C Hamano 提交于
      Doc updates.
      
      * jt/doc-pack-objects-fix:
        Doc: clarify that pack-objects makes packs, plural
      138e52ea
    • J
      Merge branch 'jc/cutoff-config' · 96352ef9
      Junio C Hamano 提交于
      "[gc] rerereResolved = 5.days" used to be invalid, as the variable
      is defined to take an integer counting the number of days.  It now
      is allowed.
      
      * jc/cutoff-config:
        rerere: allow approxidate in gc.rerereResolved/gc.rerereUnresolved
        rerere: represent time duration in timestamp_t internally
        t4200: parameterize "rerere gc" custom expiry test
        t4200: gather "rerere gc" together
        t4200: make "rerere gc" test more robust
        t4200: give us a clean slate after "rerere gc" tests
      96352ef9
    • J
      Merge branch 'kw/write-index-reduce-alloc' · 030faf2f
      Junio C Hamano 提交于
      We used to spend more than necessary cycles allocating and freeing
      piece of memory while writing each index entry out.  This has been
      optimized.
      
      * kw/write-index-reduce-alloc:
        read-cache: avoid allocating every ondisk entry when writing
        read-cache: fix memory leak in do_write_index
        perf: add test for writing the index
      030faf2f
    • J
      Merge branch 'bw/submodule-config-cleanup' · 614ea03a
      Junio C Hamano 提交于
      Code clean-up to avoid mixing values read from the .gitmodules file
      and values read from the .git/config file.
      
      * bw/submodule-config-cleanup:
        submodule: remove gitmodules_config
        unpack-trees: improve loading of .gitmodules
        submodule-config: lazy-load a repository's .gitmodules file
        submodule-config: move submodule-config functions to submodule-config.c
        submodule-config: remove support for overlaying repository config
        diff: stop allowing diff to have submodules configured in .git/config
        submodule: remove submodule_config callback routine
        unpack-trees: don't respect submodule.update
        submodule: don't rely on overlayed config when setting diffopts
        fetch: don't overlay config with submodule-config
        submodule--helper: don't overlay config in update-clone
        submodule--helper: don't overlay config in remote_submodule_branch
        add, reset: ensure submodules can be added or reset
        submodule: don't use submodule_from_name
        t7411: check configuration parsing errors
      614ea03a
    • J
      Merge branch 'js/gitweb-raw-blob-link-in-history' · 2adb6149
      Junio C Hamano 提交于
      "gitweb" shows a link to visit the 'raw' contents of blbos in the
      history overview page.
      
      * js/gitweb-raw-blob-link-in-history:
        gitweb: add 'raw' blob_plain link in history overview
      2adb6149
    • J
      Merge branch 'po/object-id' · 6b8aa329
      Junio C Hamano 提交于
      * po/object-id:
        sha1_file: convert index_stream to struct object_id
        sha1_file: convert hash_sha1_file_literally to struct object_id
        sha1_file: convert index_fd to struct object_id
        sha1_file: convert index_path to struct object_id
        read-cache: convert to struct object_id
        builtin/hash-object: convert to struct object_id
      6b8aa329
    • J
      Merge branch 'jn/vcs-svn-cleanup' · 18c88f9a
      Junio C Hamano 提交于
      Code clean-up.
      
      * jn/vcs-svn-cleanup:
        vcs-svn: move remaining repo_tree functions to fast_export.h
        vcs-svn: remove repo_delete wrapper function
        vcs-svn: remove custom mode constants
        vcs-svn: remove more unused prototypes and declarations
      18c88f9a
    • J
      Merge branch 'bc/vcs-svn-cleanup' · 4c3be636
      Junio C Hamano 提交于
      Code clean-up.
      
      * bc/vcs-svn-cleanup:
        vcs-svn: rename repo functions to "svn_repo"
        vcs-svn: remove unused prototypes
      4c3be636
    • J
      Merge branch 'tb/apply-with-crlf' · a17483fc
      Junio C Hamano 提交于
      "git apply" that is used as a better "patch -p1" failed to apply a
      taken from a file with CRLF line endings to a file with CRLF line
      endings.  The root cause was because it misused convert_to_git()
      that tried to do "safe-crlf" processing by looking at the index
      entry at the same path, which is a nonsense---in that mode, "apply"
      is not working on the data in (or derived from) the index at all.
      This has been fixed.
      
      * tb/apply-with-crlf:
        apply: file commited with CRLF should roundtrip diff and apply
        convert: add SAFE_CRLF_KEEP_CRLF
      a17483fc
    • J
      Merge branch 'jt/stash-tests' · f6a47f9b
      Junio C Hamano 提交于
      Test update to improve coverage for "git stash" operations.
      
      * jt/stash-tests:
        stash: add a test for stashing in a detached state
        stash: add a test for when apply fails during stash branch
        stash: add a test for stash create with no files
      f6a47f9b
    • J
      Merge branch 'jk/trailers-parse' · 06cf4f2d
      Junio C Hamano 提交于
      "git interpret-trailers" has been taught a "--parse" and a few
      other options to make it easier for scripts to grab existing
      trailer lines from a commit log message.
      
      * jk/trailers-parse:
        doc/interpret-trailers: fix "the this" typo
        pretty: support normalization options for %(trailers)
        t4205: refactor %(trailers) tests
        pretty: move trailer formatting to trailer.c
        interpret-trailers: add --parse convenience option
        interpret-trailers: add an option to unfold values
        interpret-trailers: add an option to show only existing trailers
        interpret-trailers: add an option to show only the trailers
        trailer: put process_trailers() options into a struct
      06cf4f2d
    • J
      Merge branch 'pb/trailers-from-command-line' · bfd91b41
      Junio C Hamano 提交于
      "git interpret-trailers" learned to take the trailer specifications
      from the command line that overrides the configured values.
      
      * pb/trailers-from-command-line:
        interpret-trailers: fix documentation typo
        interpret-trailers: add options for actions
        trailers: introduce struct new_trailer_item
        trailers: export action enums and corresponding lookup functions
      bfd91b41
    • J
      Merge branch 'jt/diff-color-move-fix' · 0b963584
      Junio C Hamano 提交于
      A handful of bugfixes and an improvement to "diff --color-moved".
      
      * jt/diff-color-move-fix:
        diff: define block by number of alphanumeric chars
        diff: respect MIN_BLOCK_LENGTH for last block
        diff: avoid redundantly clearing a flag
      0b963584