1. 14 Mar, 2018 1 commit
  2. 15 Jul, 2013 1 commit
  3. 27 Mar, 2013 1 commit
    • Duy Nguyen's avatar
      checkout: avoid unnecessary match_pathspec calls · e721c154
      Duy Nguyen authored
      In checkout_paths() we do this
       - for all updated items, call match_pathspec
       - for all items, call match_pathspec (inside unmerge_cache)
       - for all items, call match_pathspec (for showing "path .. is unmerged)
       - for updated items, call match_pathspec and update paths
      That's a lot of duplicate match_pathspec(s) and the function is not
      exactly cheap to be called so many times, especially on large indexes.
      This patch makes it call match_pathspec once per updated index entry,
      save the result in ce_flags and reuse the results in the following
      The changes in 0a1283bc (checkout $tree $path: do not clobber local
      changes in $path not in $tree - 2011-09-30) limit the affected paths
      to ones we read from $tree. We do not do anything to other modified
      entries in this case, so the "for all items" above could be modified
      to "for all updated items". But..
      The command's behavior now is modified slightly: unmerged entries that
      match $path, but not updated by $tree, are now NOT touched.  Although
      this should be considered a bug fix, not a regression. A new test is
      added for this change.
      And while at there, free ps_matched after use.
      The following command is tested on webkit, 215k entries. The pattern
      is chosen mainly to make match_pathspec sweat:
      git checkout -- "*[a-zA-Z]*[a-zA-Z]*[a-zA-Z]*"
              before      after
      real    0m3.493s    0m2.737s
      user    0m2.239s    0m1.586s
      sys     0m1.252s    0m1.151s
      Signed-off-by: Duy Nguyen's avatarNguyễn Thái Ngọc Duy <pclouds@gmail.com>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
  4. 02 Feb, 2010 1 commit
  5. 26 Dec, 2009 2 commits
    • Junio C Hamano's avatar
      resolve-undo: "checkout -m path" uses resolve-undo information · 4421a823
      Junio C Hamano authored
      Once you resolved conflicts by "git add path", you cannot recreate the
      conflicted state with "git checkout -m path", because you lost information
      from higher stages in the index when you resolved them.
      Since we record the necessary information in the resolve-undo index
      extension these days, we can reproduce the unmerged state in the index and
      check it out.
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
    • Junio C Hamano's avatar
      resolve-undo: record resolved conflicts in a new index extension section · cfc5789a
      Junio C Hamano authored
      When resolving a conflict using "git add" to create a stage #0 entry, or
      "git rm" to remove entries at higher stages, remove_index_entry_at()
      function is eventually called to remove unmerged (i.e. higher stage)
      entries from the index.  Introduce a "resolve_undo_info" structure and
      keep track of the removed cache entries, and save it in a new index
      extension section in the index_state.
      Operations like "read-tree -m", "merge", "checkout [-m] <branch>" and
      "reset" are signs that recorded information in the index is no longer
      necessary.  The data is removed from the index extension when operations
      start; they may leave conflicted entries in the index, and later user
      actions like "git add" will record their conflicted states afresh.
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>