1. 21 3月, 2015 1 次提交
    • T
      read-cache: fix reading of split index · 03f15a79
      Thomas Gummerer 提交于
      The split index extension uses ewah bitmaps to mark index entries as
      deleted, instead of removing them from the index directly.  This can
      result in an on-disk index, in which entries of stage #0 and higher
      stages appear, which are removed later when the index bases are merged.
      
      15999d0b read_index_from(): catch out of order entries when reading an
      index file introduces a check which checks if the entries are in order
      after each index entry is read in do_read_index.  This check may however
      fail when a split index is read.
      
      Fix this by moving checking the index after we know there is no split
      index or after the split index bases are successfully merged instead.
      Signed-off-by: NThomas Gummerer <t.gummerer@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      03f15a79
  2. 18 2月, 2015 1 次提交
  3. 18 12月, 2014 3 次提交
    • J
      read-cache: optionally disallow NTFS .git variants · 2b4c6efc
      Johannes Schindelin 提交于
      The point of disallowing ".git" in the index is that we
      would never want to accidentally overwrite files in the
      repository directory. But this means we need to respect the
      filesystem's idea of when two paths are equal. The prior
      commit added a helper to make such a comparison for NTFS
      and FAT32; let's use it in verify_path().
      
      We make this check optional for two reasons:
      
        1. It restricts the set of allowable filenames, which is
           unnecessary for people who are not on NTFS nor FAT32.
           In practice this probably doesn't matter, though, as
           the restricted names are rather obscure and almost
           certainly would never come up in practice.
      
        2. It has a minor performance penalty for every path we
           insert into the index.
      
      This patch ties the check to the core.protectNTFS config
      option. Though this is expected to be most useful on Windows,
      we allow it to be set everywhere, as NTFS may be mounted on
      other platforms. The variable does default to on for Windows,
      though.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      2b4c6efc
    • J
      read-cache: optionally disallow HFS+ .git variants · a42643aa
      Jeff King 提交于
      The point of disallowing ".git" in the index is that we
      would never want to accidentally overwrite files in the
      repository directory. But this means we need to respect the
      filesystem's idea of when two paths are equal. The prior
      commit added a helper to make such a comparison for HFS+;
      let's use it in verify_path.
      
      We make this check optional for two reasons:
      
        1. It restricts the set of allowable filenames, which is
           unnecessary for people who are not on HFS+. In practice
           this probably doesn't matter, though, as the restricted
           names are rather obscure and almost certainly would
           never come up in practice.
      
        2. It has a minor performance penalty for every path we
           insert into the index.
      
      This patch ties the check to the core.protectHFS config
      option. Though this is expected to be most useful on OS X,
      we allow it to be set everywhere, as HFS+ may be mounted on
      other platforms. The variable does default to on for OS X,
      though.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      a42643aa
    • J
      verify_dotfile(): reject .git case-insensitively · cc2fc7c2
      Jeff King 提交于
      We do not allow ".git" to enter into the index as a path
      component, because checking out the result to the working
      tree may causes confusion for subsequent git commands.
      However, on case-insensitive file systems, ".Git" or ".GIT"
      is the same. We should catch and prevent those, too.
      
      Note that technically we could allow this for repos on
      case-sensitive filesystems. But there's not much point. It's
      unlikely that anybody cares, and it creates a repository
      that is unexpectedly non-portable to other systems.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      cc2fc7c2
  4. 02 10月, 2014 6 次提交
  5. 30 8月, 2014 2 次提交
  6. 11 8月, 2014 1 次提交
  7. 08 8月, 2014 1 次提交
  8. 21 6月, 2014 1 次提交
    • J
      cleanup duplicate name_compare() functions · ccdd4a0f
      Jeremiah Mahler 提交于
      We often represent our strings as a counted string, i.e. a pair of
      the pointer to the beginning of the string and its length, and the
      string may not be NUL terminated to that length.
      
      To compare a pair of such counted strings, unpack-trees.c and
      read-cache.c implement their own name_compare() functions
      identically.  In addition, the cache_name_compare() function in
      read-cache.c is nearly identical.  The only difference is when one
      string is the prefix of the other string, in which case
      name_compare() returns -1/+1 to show which one is longer, and
      cache_name_compare() returns the difference of the lengths to show
      the same information.
      
      Unify these three functions by using the implementation from
      cache_name_compare().  This does not make any difference to the
      existing and future callers, as they must be paying attention only
      to the sign of the returned value (and not the magnitude) because
      the original implementations of these two functions return values
      returned by memcmp(3) when the one string is not a prefix of the
      other string, and the only thing memcmp(3) guarantees its callers is
      the sign of the returned value, not the magnitude.
      Signed-off-by: NJeremiah Mahler <jmmahler@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ccdd4a0f
  9. 14 6月, 2014 19 次提交
  10. 11 4月, 2014 1 次提交
    • Y
      read-cache.c: verify index file before we opportunistically update it · 426ddeea
      Yiannis Marangos 提交于
      Before we proceed to opportunistically update the index (often done
      by an otherwise read-only operation like "git status" and "git diff"
      that internally refreshes the index), we must verify that the
      current index file is the same as the one that we read earlier
      before we took the lock on it, in order to avoid a possible race.
      
      In the example below git-status does "opportunistic update" and
      git-rebase updates the index, but the race can happen in general.
      
        1. process A calls git-rebase (or does anything that uses the index)
      
        2. process A applies 1st commit
      
        3. process B calls git-status (or does anything that updates the index)
      
        4. process B reads index
      
        5. process A applies 2nd commit
      
        6. process B takes the lock, then overwrites process A's changes.
      
        7. process A applies 3rd commit
      
      As an end result the 3rd commit will have a revert of the 2nd commit.
      When process B takes the lock, it needs to make sure that the index
      hasn't changed since step 4.
      Signed-off-by: NYiannis Marangos <yiannis.marangos@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      426ddeea
  11. 04 3月, 2014 1 次提交
  12. 25 2月, 2014 3 次提交