1. 27 2月, 2015 2 次提交
    • K
      Git::SVN::*: avoid premature FileHandle closure · e426311b
      Kyle J. McKay 提交于
      Since b19138b (git-svn: Make it incrementally faster by minimizing temp
      files, v1.6.0), git-svn has been using the Git.pm temp_acquire and
      temp_release mechanism to avoid unnecessary temp file churn and provide
      a speed boost.
      
      However, that change introduced a call to temp_acquire inside the
      Git::SVN::Fetcher::close_file function for an 'svn_hash' temp file.
      Because an SVN::Pool is active at the time this function is called, if
      the Git::temp_acquire function ends up actually creating a new
      FileHandle for the temp file (which it will the first time it's called
      with the name 'svn_hash') that FileHandle will end up in the SVN::Pool
      and should that pool have SVN::Pool::clear called on it that FileHandle
      will be closed out from under Git::temp_acquire.
      
      Since the only call site to Git::temp_acquire with the name 'svn_hash'
      is inside the close_file function, if an 'svn_hash' temp file is ever
      created its FileHandle is guaranteed to be created in the active
      SVN::Pool.
      
      This has not been a problem in the past because the SVN::Pool was not
      being cleared.  However, since dfa72fdb (git-svn: reload RA every
      log-window-size, v2.2.0) the pool has been getting cleared periodically
      at which point the FileHandle for the 'svn_hash' temp file gets closed.
      Any subsequent calls to Git::temp_acquire for 'svn_hash', however,
      succeed without creating/opening a new temporary file since it still has
      the now invalid FileHandle in its cache.  Callers that then attempt to
      use that FileHandle fail with an error.
      
      We avoid this problem by making sure the 'svn_hash' temp file is created
      in the same place the 'svn_delta_...' and 'git_blob_...' temp files are
      (and then temp_release'd) so that it can be safely used inside the
      close_file function without having its FileHandle end up in an SVN::Pool
      that gets cleared.
      
      Additionally the Git.pm cat_blob function creates a bidirectional pipe
      FileHandle using the IPC::Open2::open2 function.  If that handle is
      created too late, it also gets caught up in the SVN::Pool and incorrectly
      closed by the SVN::Pool::clear call.  But this only seems to happen with
      more recent versions of Perl and svn.
      
      To avoid this problem we add an explicit call to _open_cat_blob_if_needed
      before the first call to SVN::Pool->new_default to make sure the open2
      handle does not end up in the SVN::Pool.
      Signed-off-by: NKyle J. McKay <mackyle@gmail.com>
      Signed-off-by: NEric Wong <normalperson@yhbt.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e426311b
    • R
      git-svn: fix localtime=true on non-glibc environments · 45c956b3
      Ryuichi Kokubo 提交于
      git svn uses POSIX::strftime('%s', $sec, $min, ...) to make unix epoch time.
      But lowercase %s formatting character is a GNU extention. This causes problem
      in git svn fetch --localtime on non-glibc systems, such as msys or cygwin.
      Using Time::Local::timelocal($sec, $min, ...) fixes it.
      Signed-off-by: NRyuichi Kokubo <ryu1kkb@gmail.com>
      Signed-off-by: NEric Wong <normalperson@yhbt.net>
      
      Notes:
          lowercase %s format character in strftime is a GNU extension and not widely supported.
          POSIX::strftime affected by underlying crt's strftime because POSIX::strftime just calls crt's one.
          Time::Local is good function to replace POSIX::strftime because it's a perl core module function.
      
          Document about Time::Local.
           http://perldoc.perl.org/Time/Local.html
      
          These are specifications of strftime.
      
          The GNU C Library Reference Manual.
           http://www.gnu.org/software/libc/manual/html_node/Formatting-Calendar-Time.html
      
          perl POSIX module's strftime document. It does not have '%s'.
           http://perldoc.perl.org/POSIX.html
      
          strftime document of Microsort Windows C Run-Time library.
           https://msdn.microsoft.com/en-us/library/fe06s4ak.aspx
      
          The Open Group's old specification does not have '%s' too.
           http://pubs.opengroup.org/onlinepubs/007908799/xsh/strftime.html
      
          On my environment, following problems happened.
          - msys   : git svn fetch does not progress at all with perl.exe consuming CPU.
          - cygwin : git svn fetch progresses but time stamp information is dropped.
             Every commits have unix epoch timestamp.
      
          I would like to thank git developer and contibutors.
          git helps me so much everyday.
          Thank you.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      45c956b3
  2. 13 1月, 2015 7 次提交
  3. 08 1月, 2015 5 次提交
  4. 30 12月, 2014 1 次提交
    • J
      is_hfs_dotgit: loosen over-eager match of \u{..47} · 6aaf956b
      Jeff King 提交于
      Our is_hfs_dotgit function relies on the hackily-implemented
      next_hfs_char to give us the next character that an HFS+
      filename comparison would look at. It's hacky because it
      doesn't implement the full case-folding table of HFS+; it
      gives us just enough to see if the path matches ".git".
      
      At the end of next_hfs_char, we use tolower() to convert our
      32-bit code point to lowercase. Our tolower() implementation
      only takes an 8-bit char, though; it throws away the upper
      24 bits. This means we can't have any false negatives for
      is_hfs_dotgit. We only care about matching 7-bit ASCII
      characters in ".git", and we will correctly process 'G' or
      'g'.
      
      However, we _can_ have false positives. Because we throw
      away the upper bits, code point \u{0147} (for example) will
      look like 'G' and get downcased to 'g'. It's not known
      whether a sequence of code points whose truncation ends up
      as ".git" is meaningful in any language, but it does not
      hurt to be more accurate here. We can just pass out the full
      32-bit code point, and compare it manually to the upper and
      lowercase characters we care about.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6aaf956b
  5. 23 12月, 2014 13 次提交
  6. 18 12月, 2014 12 次提交
    • J
      Git 2.2.1 · 9b7cbb31
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9b7cbb31
    • J
      Sync with v2.1.4 · 77933f44
      Junio C Hamano 提交于
      * maint-2.1:
        Git 2.1.4
        Git 2.0.5
        Git 1.9.5
        Git 1.8.5.6
        fsck: complain about NTFS ".git" aliases in trees
        read-cache: optionally disallow NTFS .git variants
        path: add is_ntfs_dotgit() helper
        fsck: complain about HFS+ ".git" aliases in trees
        read-cache: optionally disallow HFS+ .git variants
        utf8: add is_hfs_dotgit() helper
        fsck: notice .git case-insensitively
        t1450: refactor ".", "..", and ".git" fsck tests
        verify_dotfile(): reject .git case-insensitively
        read-tree: add tests for confusing paths like ".." and ".git"
        unpack-trees: propagate errors adding entries to the index
      77933f44
    • J
      Git 2.1.4 · 8e36a6d5
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      8e36a6d5
    • J
      Sync with v2.0.5 · 58f1d950
      Junio C Hamano 提交于
      * maint-2.0:
        Git 2.0.5
        Git 1.9.5
        Git 1.8.5.6
        fsck: complain about NTFS ".git" aliases in trees
        read-cache: optionally disallow NTFS .git variants
        path: add is_ntfs_dotgit() helper
        fsck: complain about HFS+ ".git" aliases in trees
        read-cache: optionally disallow HFS+ .git variants
        utf8: add is_hfs_dotgit() helper
        fsck: notice .git case-insensitively
        t1450: refactor ".", "..", and ".git" fsck tests
        verify_dotfile(): reject .git case-insensitively
        read-tree: add tests for confusing paths like ".." and ".git"
        unpack-trees: propagate errors adding entries to the index
      58f1d950
    • J
      Git 2.0.5 · 9a8c2b67
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9a8c2b67
    • J
      Sync with v1.9.5 · 5e519fb8
      Junio C Hamano 提交于
      * maint-1.9:
        Git 1.9.5
        Git 1.8.5.6
        fsck: complain about NTFS ".git" aliases in trees
        read-cache: optionally disallow NTFS .git variants
        path: add is_ntfs_dotgit() helper
        fsck: complain about HFS+ ".git" aliases in trees
        read-cache: optionally disallow HFS+ .git variants
        utf8: add is_hfs_dotgit() helper
        fsck: notice .git case-insensitively
        t1450: refactor ".", "..", and ".git" fsck tests
        verify_dotfile(): reject .git case-insensitively
        read-tree: add tests for confusing paths like ".." and ".git"
        unpack-trees: propagate errors adding entries to the index
      5e519fb8
    • J
      Git 1.9.5 · 83332636
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      83332636
    • J
      Sync with v1.8.5.6 · 6898b797
      Junio C Hamano 提交于
      * maint-1.8.5:
        Git 1.8.5.6
        fsck: complain about NTFS ".git" aliases in trees
        read-cache: optionally disallow NTFS .git variants
        path: add is_ntfs_dotgit() helper
        fsck: complain about HFS+ ".git" aliases in trees
        read-cache: optionally disallow HFS+ .git variants
        utf8: add is_hfs_dotgit() helper
        fsck: notice .git case-insensitively
        t1450: refactor ".", "..", and ".git" fsck tests
        verify_dotfile(): reject .git case-insensitively
        read-tree: add tests for confusing paths like ".." and ".git"
        unpack-trees: propagate errors adding entries to the index
      6898b797
    • J
      Git 1.8.5.6 · 5c8213a7
      Junio C Hamano 提交于
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      5c8213a7
    • J
      Merge branch 'dotgit-case-maint-1.8.5' into maint-1.8.5 · 2aa91008
      Junio C Hamano 提交于
      * dotgit-case-maint-1.8.5:
        fsck: complain about NTFS ".git" aliases in trees
        read-cache: optionally disallow NTFS .git variants
        path: add is_ntfs_dotgit() helper
        fsck: complain about HFS+ ".git" aliases in trees
        read-cache: optionally disallow HFS+ .git variants
        utf8: add is_hfs_dotgit() helper
        fsck: notice .git case-insensitively
        t1450: refactor ".", "..", and ".git" fsck tests
        verify_dotfile(): reject .git case-insensitively
        read-tree: add tests for confusing paths like ".." and ".git"
        unpack-trees: propagate errors adding entries to the index
      2aa91008
    • J
      fsck: complain about NTFS ".git" aliases in trees · d08c13b9
      Johannes Schindelin 提交于
      Now that the index can block pathnames that can be mistaken
      to mean ".git" on NTFS and FAT32, it would be helpful for
      fsck to notice such problematic paths. This lets servers
      which use receive.fsckObjects block them before the damage
      spreads.
      
      Note that the fsck check is always on, even for systems
      without core.protectNTFS set. This is technically more
      restrictive than we need to be, as a set of users on ext4
      could happily use these odd filenames without caring about
      NTFS.
      
      However, on balance, it's helpful for all servers to block
      these (because the paths can be used for mischief, and
      servers which bother to fsck would want to stop the spread
      whether they are on NTFS themselves or not), and hardly
      anybody will be affected (because the blocked names are
      variants of .git or git~1, meaning mischief is almost
      certainly what the tree author had in mind).
      
      Ideally these would be controlled by a separate
      "fsck.protectNTFS" flag. However, it would be much nicer to
      be able to enable/disable _any_ fsck flag individually, and
      any scheme we choose should match such a system. Given the
      likelihood of anybody using such a path in practice, it is
      not unreasonable to wait until such a system materializes.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d08c13b9
    • 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