1. 22 May, 2007 1 commit
  2. 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
      Signed-off-by: default avatarRene Scharfe <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  3. 12 May, 2007 1 commit
  4. 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
      Signed-off-by: default avatarNicolas Pitre <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  5. 06 Jan, 2007 1 commit
    • René Scharfe's avatar
      Set default "tar" umask to 002 and owner.group to root.root · f08b3b0e
      René Scharfe authored
      In order to make the generated tar files more friendly to users who
      extract them as root using GNU tar and its implied -p option, change
      the default umask to 002 and change the owner name and group name to
      root.  This ensures that a) the extracted files and directories are
      not world-writable and b) that they belong to user and group root.
      Before they would have been assigned to a user and/or group named
      git if it existed.  This also answers the question in the removed
      comment: uid=0, gid=0, uname=root, gname=root is exactly what we
      Normal users who let tar apply their umask while extracting are
      only affected if their umask allowed the world to change their
      files (e.g. a umask of zero).  This case is so unlikely and strange
      that we don't need to support it.
      Signed-off-by: default avatarRene Scharfe <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  6. 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 <[email protected]>
  7. 25 Sep, 2006 2 commits
  8. 17 Sep, 2006 1 commit
    • Rene Scharfe's avatar
      git-tar-tree: devolve git-tar-tree into a wrapper for git-archive · 87af29f0
      Rene Scharfe authored
      This patch removes the custom tree walker tree_traverse(), and makes
      generate_tar() use write_tar_archive() and the infrastructure provided
      by git-archive instead.
      As a kind of side effect, make write_tar_archive() able to handle NULL
      as base directory, as this is what the new and simple generate_tar()
      uses to indicate the absence of a base directory.  This was simpler
      and cleaner than playing tricks with empty strings.
      The behaviour of git-tar-tree should be unchanged (quick tests didn't
      indicate otherwise) except for the text of some error messages.
      Signed-off-by: default avatarRene Scharfe <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  9. 10 Sep, 2006 2 commits
  10. 09 Sep, 2006 1 commit
  11. 02 Sep, 2006 1 commit
    • Shawn Pearce's avatar
      Replace uses of strdup with xstrdup. · 9befac47
      Shawn Pearce authored
      Like xmalloc and xrealloc xstrdup dies with a useful message if
      the native strdup() implementation returns NULL rather than a
      valid pointer.
      I just tried to use xstrdup in new code and found it to be missing.
      However I expected it to be present as xmalloc and xrealloc are
      already commonly used throughout the code.
      [jc: removed the part that deals with last_XXX, which I am
       finding more and more dubious these days.]
      Signed-off-by: default avatarShawn O. Pearce <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  12. 24 Aug, 2006 1 commit
  13. 22 Aug, 2006 2 commits
    • Rene Scharfe's avatar
      Add write_or_die(), a helper function · 7230e6d0
      Rene Scharfe authored
      The little helper write_or_die() won't come back with bad news about
      full disks or broken pipes.  It either succeeds or terminates the
      program, making additional error handling unnecessary.
      This patch adds the new function and uses it to replace two similar
      ones (the one in tar-tree originally has been copied from cat-file
      btw.).  I chose to add the fd parameter which both lacked to make
      write_or_die() just as flexible as write() and thus suitable for
      There is a regression: error messages emitted by this function don't
      show the program name, while the replaced two functions did.  That's
      acceptable, I think; a lot of other functions do the same.
      Signed-off-by: default avatarRene Scharfe <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
    • Rene Scharfe's avatar
      Axe the last ent · 3f0073a2
      Rene Scharfe authored
      In the name of Standardization, this cleanses the last usage string of
      mystical creatures.  But they still dwell deep within the source and in
      some debug messages, it is said.
      Signed-off-by: default avatarRene Scharfe <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  14. 04 Aug, 2006 1 commit
  15. 29 Jul, 2006 1 commit
  16. 24 Jul, 2006 1 commit
    • Willy Tarreau's avatar
      tar-tree: add the "tar.umask" config option · ce1a79b6
      Willy Tarreau authored
      By default, git-tar-tree(1) sets file and directories modes to 0666
      or 0777. While this is both useful and acceptable for projects such
      as the Linux Kernel, it might be excessive for other projects. With
      this variable, it becomes possible to tell git-tar-tree(1) to apply
      a specific umask to the modes above. The special value "user"
      indicates that the user's current umask will be used. This should be
      enough for most projects, as it will lead to the same permissions as
      git-checkout(1) would use. The default value remains 0, which means
      world read-write.
      Signed-off-by: Willy Tarreau's avatarWilly Tarreau <[email protected]>
      Acked-by: default avatarRene Scharfe <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  17. 25 Jun, 2006 1 commit
  18. 18 Jun, 2006 2 commits
  19. 17 Jun, 2006 1 commit
  20. 10 Jun, 2006 1 commit
  21. 07 Jun, 2006 1 commit
  22. 31 May, 2006 1 commit
    • Linus Torvalds's avatar
      tree_entry(): new tree-walking helper function · 4c068a98
      Linus Torvalds authored
      This adds a "tree_entry()" function that combines the common operation of
      doing a "tree_entry_extract()" + "update_tree_entry()".
      It also has a simplified calling convention, designed for simple loops
      that traverse over a whole tree: the arguments are pointers to the tree
      descriptor and a name_entry structure to fill in, and it returns a boolean
      "true" if there was an entry left to be gotten in the tree.
      This allows tree traversal with
      	struct tree_desc desc;
      	struct name_entry entry;
      	desc.buf = tree->buffer;
      	desc.size = tree->size;
      	while (tree_entry(&desc, &entry) {
      		... use "entry.{path, sha1, mode, pathlen}" ...
      which is not only shorter than writing it out in full, it's hopefully less
      error prone too.
      [ It's actually a tad faster too - we don't need to recalculate the entry
        pathlength in both extract and update, but need to do it only once.
        Also, some callers can avoid doing a "strlen()" on the result, since
        it's returned as part of the name_entry structure.
        However, by now we're talking just 1% speedup on "git-rev-list --objects
        --all", and we're definitely at the point where tree walking is no
        longer the issue any more. ]
      NOTE! Not everybody wants to use this new helper function, since some of
      the tree walkers very much on purpose do the descriptor update separately
      from the entry extraction. So the "extract + update" sequence still
      remains as the core sequence, this is just a simplified interface.
      We should probably add a silly two-line inline helper function for
      initializing the descriptor from the "struct tree" too, just to cut down
      on the noise from that common "desc" initializer.
      Signed-off-by: default avatarLinus Torvalds <[email protected]>
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  23. 23 May, 2006 1 commit
  24. 20 May, 2006 1 commit
  25. 08 May, 2006 1 commit
  26. 04 Apr, 2006 1 commit
  27. 02 Apr, 2006 1 commit
  28. 30 Mar, 2006 1 commit
    • Junio C Hamano's avatar
      tree/diff header cleanup. · 1b0c7174
      Junio C Hamano authored
      Introduce tree-walk.[ch] and move "struct tree_desc" and
      associated functions from various places.
      Rename DIFF_FILE_CANON_MODE(mode) macro to canon_mode(mode) and
      move it to cache.h.  This macro returns the canonicalized
      st_mode value in the host byte order for files, symlinks and
      directories -- to be compared with a tree_desc entry.
      create_ce_mode(mode) in cache.h is similar but is intended to be
      used for index entries (so it does not work for directories) and
      returns the value in the network byte order.
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  29. 26 Mar, 2006 5 commits
  30. 24 Mar, 2006 1 commit
  31. 04 Mar, 2006 1 commit
    • Junio C Hamano's avatar
      tar-tree: file/dirmode fix. · 473d404b
      Junio C Hamano authored
      This fixes two bugs introduced when we switched to generic tree
      traversal code.
       (1) directory mode recorded silently became 0755, not 0777
       (2) if passed a tree object (not a commit), it emitted an
           alarming error message (but proceeded anyway).
      Signed-off-by: default avatarJunio C Hamano <[email protected]>
  32. 01 Feb, 2006 1 commit