1. 24 Sep, 2012 1 commit
    • René Scharfe's avatar
      archive-zip: write extended timestamp · 227bf598
      René Scharfe authored
      File modification times in ZIP files are encoded in DOS format: local
      time with a granularity of two seconds.  Add an extra field to all
      archive entries to also record the mtime in Unix' fashion, as UTC with
      a granularity of one second.
      
      This has the desirable side-effect of convincing Info-ZIP unzip 6.00
      to respect general purpose flag 11, which is used to indicate that a
      file name is encoded in UTF-8.  Any extra field would do, actually,
      but the extended timestamp is a reasonably small one (22 bytes per
      entry).  Archives created by Info-ZIP zip 3.0 contain it, too (but
      with ctime and atime as well).
      Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      227bf598
  2. 18 Sep, 2012 2 commits
  3. 04 Sep, 2012 1 commit
    • René Scharfe's avatar
      archive-zip: support UTF-8 paths · 2162bd8c
      René Scharfe authored
      Set general purpose flag 11 if we encounter a path that contains
      non-ASCII characters.  We assume that all paths are given as UTF-8; no
      conversion is done.
      
      The flag seems to be ignored by unzip unless we also mark the archive
      entry as coming from a Unix system.  This is done by setting the field
      creator_version ("version made by" in the standard[1]) to 0x03NN.
      
      The NN part represents the version of the standard supported by us, and
      this patch sets it to 3f (for version 6.3) for Unix paths.  We keep
      creator_version set to 0 (FAT filesystem, standard version 0) in the
      non-special cases, as before.
      
      But when we declare a file to have a Unix path, then we have to set the
      file mode as well, or unzip will extract the files with the permission
      set 0000, i.e. inaccessible by all.
      
      [1] http://www.pkware.com/documents/casestudies/APPNOTE.TXTSigned-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      2162bd8c
  4. 03 May, 2012 5 commits
  5. 22 Jun, 2011 3 commits
    • Jeff King's avatar
      upload-archive: allow user to turn off filters · 7b97730b
      Jeff King authored
      Some tar filters may be very expensive to run, so sites do
      not want to expose them via upload-archive. This patch lets
      users configure tar.<filter>.remote to turn them off.
      
      By default, gzip filters are left on, as they are about as
      expensive as creating zip archives.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      7b97730b
    • Jeff King's avatar
      archive: pass archiver struct to write_archive callback · 4d7c9898
      Jeff King authored
      The current archivers are very static; when you are in the
      write_tar_archive function, you know you are writing a tar.
      However, to facilitate runtime-configurable archivers
      that will share a common write function we need to tell the
      function which archiver was used.
      
      As a convenience, we also provide an opaque data pointer in
      the archiver struct so that individual archivers can put
      something useful there when they register themselves.
      Technically they could just use the "name" field to look in
      an internal map of names to data, but this is much simpler.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      4d7c9898
    • Jeff King's avatar
      archive: refactor list of archive formats · 13e0f88d
      Jeff King authored
      Most of the tar and zip code was nicely split out into two
      abstracted files which knew only about their specific
      formats. The entry point to this code was a single "write
      archive" function.
      
      However, as these basic formats grow more complex (e.g., by
      handling multiple file extensions and format names), a
      static list of the entry point functions won't be enough.
      Instead, let's provide a way for the tar and zip code to
      tell the main archive code what they support by registering
      archiver names and functions.
      Signed-off-by: default avatarJeff King <peff@peff.net>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      13e0f88d
  6. 10 Jun, 2011 3 commits
    • Junio C Hamano's avatar
      zlib: zlib can only process 4GB at a time · ef49a7a0
      Junio C Hamano authored
      The size of objects we read from the repository and data we try to put
      into the repository are represented in "unsigned long", so that on larger
      architectures we can handle objects that weigh more than 4GB.
      
      But the interface defined in zlib.h to communicate with inflate/deflate
      limits avail_in (how many bytes of input are we calling zlib with) and
      avail_out (how many bytes of output from zlib are we ready to accept)
      fields effectively to 4GB by defining their type to be uInt.
      
      In many places in our code, we allocate a large buffer (e.g. mmap'ing a
      large loose object file) and tell zlib its size by assigning the size to
      avail_in field of the stream, but that will truncate the high octets of
      the real size. The worst part of this story is that we often pass around
      z_stream (the state object used by zlib) to keep track of the number of
      used bytes in input/output buffer by inspecting these two fields, which
      practically limits our callchain to the same 4GB limit.
      
      Wrap z_stream in another structure git_zstream that can express avail_in
      and avail_out in unsigned long. For now, just die() when the caller gives
      a size that cannot be given to a single zlib call. In later patches in the
      series, we would make git_inflate() and git_deflate() internally loop to
      give callers an illusion that our "improved" version of zlib interface can
      operate on a buffer larger than 4GB in one go.
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      ef49a7a0
    • Junio C Hamano's avatar
      zlib: wrap deflateBound() too · 225a6f10
      Junio C Hamano authored
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      225a6f10
    • Junio C Hamano's avatar
      zlib: wrap deflate side of the API · 55bb5c91
      Junio C Hamano authored
      Wrap deflateInit, deflate, and deflateEnd for everybody, and the sole use
      of deflateInit2 in remote-curl.c to tell the library to use gzip header
      and trailer in git_deflate_init_gzip().
      
      There is only one caller that cares about the status from deflateEnd().
      Introduce git_deflate_end_gently() to let that sole caller retrieve the
      status and act on it (i.e. die) for now, but we would probably want to
      make inflate_end/deflate_end die when they ran out of memory and get
      rid of the _gently() kind.
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      55bb5c91
  7. 19 Jul, 2008 2 commits
  8. 15 Jul, 2008 4 commits
  9. 09 Jun, 2008 1 commit
  10. 10 Apr, 2008 1 commit
    • René Scharfe's avatar
      git-archive: ignore prefix when checking file attribute · ac7fa277
      René Scharfe authored
      Ulrik Sverdrup noticed that git-archive doesn't correctly apply the attribute
      export-subst when the option --prefix is given, too.
      
      When it checked if a file has the attribute turned on, git-archive would try
      to look up the full path -- including the prefix -- in .gitattributes.  That's
      wrong, as the prefix doesn't need to have any relation to any existing
      directories, tracked or not.
      
      This patch makes git-archive ignore the prefix when looking up if value of the
      attribute export-subst for a file.
      Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      ac7fa277
  11. 18 Sep, 2007 1 commit
  12. 03 Sep, 2007 1 commit
    • René Scharfe's avatar
      archive: specfile support (--pretty=format: in archive files) · 8460b2fc
      René Scharfe authored
      Add support for a new attribute, specfile.  Files marked as being
      specfiles are expanded by git-archive when they are written to an
      archive.  It has no effect on worktree files.  The same placeholders
      as those for the option --pretty=format: of git-log et al. can be
      used.
      
      The attribute is useful for creating auto-updating specfiles.  It is
      limited by the underlying function format_commit_message(), though.
      E.g. currently there is no placeholder for git-describe like output,
      and expanded specfiles can't contain NUL bytes.  That can be fixed
      in format_commit_message() later and will then benefit users of
      git-log, too.
      Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <gitster@pobox.com>
      8460b2fc
  13. 22 May, 2007 1 commit
  14. 18 May, 2007 1 commit
    • René Scharfe's avatar
      git-archive: convert archive entries like checkouts do · 5e6cfc80
      René Scharfe authored
      As noted by Johan Herland, git-archive is a kind of checkout and needs
      to apply any checkout filters that might be configured.
      
      This patch adds the convenience function convert_sha1_file which returns
      a buffer containing the object's contents, after converting, if necessary
      (i.e. it's a combination of read_sha1_file and convert_to_working_tree).
      Direct calls to read_sha1_file in git-archive are then replaced by calls
      to convert_sha1_file.
      
      Since convert_sha1_file expects its path argument to be NUL-terminated --
      a convention it inherits from convert_to_working_tree -- the patch also
      changes the path handling in archive-tar.c to always NUL-terminate the
      string.  It used to solely rely on the len field of struct strbuf before.
      
      archive-zip.c already NUL-terminates the path and thus needs no such
      change.
      Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      5e6cfc80
  15. 12 May, 2007 1 commit
  16. 27 Feb, 2007 1 commit
    • Nicolas Pitre's avatar
      convert object type handling from a string to a number · 21666f1a
      Nicolas Pitre authored
      We currently have two parallel notation for dealing with object types
      in the code: a string and a numerical value.  One of them is obviously
      redundent, and the most used one requires more stack space and a bunch
      of strcmp() all over the place.
      
      This is an initial step for the removal of the version using a char array
      found in object reading code paths.  The patch is unfortunately large but
      there is no sane way to split it in smaller parts without breaking the
      system.
      Signed-off-by: default avatarNicolas Pitre <nico@cam.org>
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      21666f1a
  17. 20 Dec, 2006 1 commit
    • Junio C Hamano's avatar
      simplify inclusion of system header files. · 85023577
      Junio C Hamano authored
      This is a mechanical clean-up of the way *.c files include
      system header files.
      
       (1) sources under compat/, platform sha-1 implementations, and
           xdelta code are exempt from the following rules;
      
       (2) the first #include must be "git-compat-util.h" or one of
           our own header file that includes it first (e.g. config.h,
           builtin.h, pkt-line.h);
      
       (3) system headers that are included in "git-compat-util.h"
           need not be included in individual C source files.
      
       (4) "git-compat-util.h" does not have to include subsystem
           specific header files (e.g. expat.h).
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      85023577
  18. 23 Nov, 2006 1 commit
    • René Scharfe's avatar
      archive-zip: don't use sizeof(struct ...) · 0ea865ce
      René Scharfe authored
      We can't rely on sizeof(struct zip_*) returning the sum of
      all struct members.  At least on ARM padding is added at the
      end, as Gerrit Pape reported.  This fixes the problem but
      still lets the compiler do the summing by introducing
      explicit padding at the end of the structs and then taking
      its offset as the combined size of the preceding members.
      
      As Junio correctly notes, the _end[] marker array's size
      must be greater than zero for compatibility with compilers
      other than gcc.  The space wasted by the markers can safely
      be neglected because we only have one instance of each
      struct, i.e. in sum 3 wasted bytes on i386, and 0 on ARM. :)
      
      We still rely on the compiler to not add padding between the
      struct members, but that's reasonable given that all of them
      are unsigned char arrays.
      Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      0ea865ce
  19. 18 Nov, 2006 1 commit
  20. 08 Oct, 2006 2 commits
    • Rene Scharfe's avatar
      git-archive --format=zip: add symlink support · 62cdce17
      Rene Scharfe authored
      Add symlink support to ZIP file creation, and a few tests.
      
      This implementation sets the "version made by" field
      (creator_version) to Unix for symlinks, only; regular files and
      directories are still marked as originating from FAT/VFAT/NTFS.
      
      Also set "external file attributes" (attr2) to 0 for regular
      files and 16 for directories (FAT attribute), and to the file
      mode for symlinks.
      
      We could always set the creator_version to Unix and include the
      mode, but then Info-ZIP unzip would set the mode of the extracted
      files to *exactly* the value stored in attr2.  The FAT trick
      makes it apply the umask instead.  Note: FAT has no executable
      bit, so this information is not stored in the ZIP file.
      Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      62cdce17
    • Rene Scharfe's avatar
      git-archive --format=zip: use default version ID · cf72fb07
      Rene Scharfe authored
      Use 10 for the "version needed to extract" field.  This is the
      default value, and we want to use it because we don't do anything
      special.  Info-ZIP's zip uses it, too.
      Signed-off-by: default avatarRene Scharfe <rene.scharfe@lsrfire.ath.cx>
      Signed-off-by: default avatarJunio C Hamano <junkio@cox.net>
      cf72fb07
  21. 23 Sep, 2006 2 commits
  22. 10 Sep, 2006 2 commits
  23. 09 Sep, 2006 2 commits