1. 27 3月, 2018 1 次提交
  2. 24 8月, 2017 1 次提交
  3. 26 5月, 2017 1 次提交
  4. 08 5月, 2017 1 次提交
    • B
      object: convert parse_object* to take struct object_id · c251c83d
      brian m. carlson 提交于
      Make parse_object, parse_object_or_die, and parse_object_buffer take a
      pointer to struct object_id.  Remove the temporary variables inserted
      earlier, since they are no longer necessary.  Transform all of the
      callers using the following semantic patch:
      
      @@
      expression E1;
      @@
      - parse_object(E1.hash)
      + parse_object(&E1)
      
      @@
      expression E1;
      @@
      - parse_object(E1->hash)
      + parse_object(E1)
      
      @@
      expression E1, E2;
      @@
      - parse_object_or_die(E1.hash, E2)
      + parse_object_or_die(&E1, E2)
      
      @@
      expression E1, E2;
      @@
      - parse_object_or_die(E1->hash, E2)
      + parse_object_or_die(E1, E2)
      
      @@
      expression E1, E2, E3, E4, E5;
      @@
      - parse_object_buffer(E1.hash, E2, E3, E4, E5)
      + parse_object_buffer(&E1, E2, E3, E4, E5)
      
      @@
      expression E1, E2, E3, E4, E5;
      @@
      - parse_object_buffer(E1->hash, E2, E3, E4, E5)
      + parse_object_buffer(E1, E2, E3, E4, E5)
      Signed-off-by: Nbrian m. carlson <sandals@crustytoothpaste.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c251c83d
  5. 18 4月, 2017 1 次提交
  6. 30 9月, 2016 1 次提交
  7. 10 5月, 2016 1 次提交
  8. 20 11月, 2015 1 次提交
  9. 26 5月, 2015 2 次提交
  10. 07 1月, 2015 1 次提交
    • J
      update-server-info: create info/* with mode 0666 · d91175b2
      Jeff King 提交于
      Prior to d38379ec (make update-server-info more robust, 2014-09-13),
      we used a straight "fopen" to create the info/refs and
      objects/info/packs files, which creates the file using mode 0666
      (less the default umask).
      
      In d38379ec, we switched to creating the file with mkstemp to get a
      unique filename. But mkstemp also uses the more restrictive 0600
      mode to create the file. This was an unintended side effect that we
      did not want, and causes problems when the repository is served by a
      different user than the one running update-server-info (it is not
      readable by a dumb http server running as `www`, for example).
      
      We can fix this by using git_mkstemp_mode and specifying 0666 to
      make sure that the umask is honored.
      
      Note that we could also say "just use core.sharedrepository", as we
      do call adjust_shared_perm on the result before renaming it into
      place.  But that should not be necessary as long as everybody
      involved is using permissive umask to allow HTTP server to read
      necessary files.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d91175b2
  11. 16 9月, 2014 2 次提交
    • J
      server-info: clean up after writing info/packs · 3907a407
      Jeff King 提交于
      We allocate pack information in a static global list but
      never clean it up. This leaks memory, and means that calling
      update_server_info twice will generate a buggy file (it will
      have duplicate entries).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      3907a407
    • J
      make update-server-info more robust · d38379ec
      Jeff King 提交于
      Since "git update-server-info" may be called automatically
      as part of a push or a "gc --auto", we should be robust
      against two processes trying to update it simultaneously.
      However, we currently use a fixed tempfile, which means that
      two simultaneous writers may step on each other's toes and
      end up renaming junk into place.
      
      Let's instead switch to using a unique tempfile via mkstemp.
      We do not want to use a lockfile here, because it's OK for
      two writers to simultaneously update (one will "win" the
      rename race, but that's OK; they should be writing the same
      information).
      
      While we're there, let's clean up a few other things:
      
        1. Detect write errors. Report them and abort the update
           if any are found.
      
        2. Free path memory rather than leaking it (and clean up
           the tempfile when necessary).
      
        3. Use the pathdup functions consistently rather than
           static buffers or manually calculated lengths.
      
      This last one fixes a potential overflow of "infofile" in
      update_info_packs (e.g., by putting large junk into
      $GIT_OBJECT_DIRECTORY). However, this overflow was probably
      not an interesting attack vector for two reasons:
      
        a. The attacker would need to control the environment to
           do this, in which case it was already game-over.
      
        b. During its setup phase, git checks that the directory
           actually exists, which means it is probably shorter
           than PATH_MAX anyway.
      
      Because both update_info_refs and update_info_packs share
      these same failings (and largely duplicate each other), this
      patch factors out the improved error-checking version into a
      helper function.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d38379ec
  12. 20 7月, 2010 1 次提交
  13. 02 5月, 2009 1 次提交
  14. 30 4月, 2009 1 次提交
    • A
      replace direct calls to unlink(2) with unlink_or_warn · 691f1a28
      Alex Riesen 提交于
      This helps to notice when something's going wrong, especially on
      systems which lock open files.
      
      I used the following criteria when selecting the code for replacement:
      - it was already printing a warning for the unlink failures
      - it is in a function which already printing something or is
        called from such a function
      - it is in a static function, returning void and the function is only
        called from a builtin main function (cmd_)
      - it is in a function which handles emergency exit (signal handlers)
      - it is in a function which is obvously cleaning up the lockfiles
      Signed-off-by: NAlex Riesen <raa.lkml@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      691f1a28
  15. 31 10月, 2008 1 次提交
  16. 05 1月, 2008 1 次提交
  17. 26 11月, 2007 1 次提交
  18. 12 7月, 2007 1 次提交
  19. 01 2月, 2007 1 次提交
  20. 21 9月, 2006 2 次提交
    • J
      Tell between packed, unpacked and symbolic refs. · 8da19775
      Junio C Hamano 提交于
      This adds a "int *flag" parameter to resolve_ref() and makes
      for_each_ref() family to call callback function with an extra
      "int flag" parameter.  They are used to give two bits of
      information (REF_ISSYMREF and REF_ISPACKED) about the ref.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      8da19775
    • J
      Add callback data to for_each_ref() family. · cb5d709f
      Junio C Hamano 提交于
      This is a long overdue fix to the API for for_each_ref() family
      of functions.  It allows the callers to specify a callback data
      pointer, so that the caller does not have to use static
      variables to communicate with the callback funciton.
      
      The updated for_each_ref() family takes a function of type
      
      	int (*fn)(const char *, const unsigned char *, void *)
      
      and a void pointer as parameters, and calls the function with
      the name of the ref and its SHA-1 with the caller-supplied void
      pointer as parameters.
      
      The commit updates two callers, builtin-name-rev.c and
      builtin-pack-refs.c as an example.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      cb5d709f
  21. 02 9月, 2006 1 次提交
    • S
      Replace uses of strdup with xstrdup. · 9befac47
      Shawn Pearce 提交于
      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: NShawn O. Pearce <spearce@spearce.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9befac47
  22. 13 7月, 2006 1 次提交
  23. 09 7月, 2006 1 次提交
  24. 18 6月, 2006 1 次提交
    • L
      Shrink "struct object" a bit · 885a86ab
      Linus Torvalds 提交于
      This shrinks "struct object" by a small amount, by getting rid of the
      "struct type *" pointer and replacing it with a 3-bit bitfield instead.
      
      In addition, we merge the bitfields and the "flags" field, which
      incidentally should also remove a useless 4-byte padding from the object
      when in 64-bit mode.
      
      Now, our "struct object" is still too damn large, but it's now less
      obviously bloated, and of the remaining fields, only the "util" (which is
      not used by most things) is clearly something that should be eventually
      discarded.
      
      This shrinks the "git-rev-list --all" memory use by about 2.5% on the
      kernel archive (and, perhaps more importantly, on the larger mozilla
      archive). That may not sound like much, but I suspect it's more on a
      64-bit platform.
      
      There are other remaining inefficiencies (the parent lists, for example,
      probably have horrible malloc overhead), but this was pretty obvious.
      
      Most of the patch is just changing the comparison of the "type" pointer
      from one of the constant string pointers to the appropriate new TYPE_xxx
      small integer constant.
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      885a86ab
  25. 22 12月, 2005 2 次提交
  26. 09 12月, 2005 1 次提交
  27. 06 12月, 2005 2 次提交
  28. 05 12月, 2005 3 次提交
  29. 17 11月, 2005 1 次提交
  30. 16 11月, 2005 1 次提交
    • S
      Rework object refs tracking to reduce memory usage · 4a4e6fd7
      Sergey Vlasov 提交于
      Store pointers to referenced objects in a variable sized array instead
      of linked list.  This cuts down memory usage of utilities which use
      object references; e.g., git-fsck-objects --full on the git.git
      repository consumes about 2 MB of memory tracked by Massif instead of
      7 MB before the change.  Object refs are still the biggest consumer of
      memory (57%), but the malloc overhead for a single block instead of a
      linked list is substantially smaller.
      Signed-off-by: NSergey Vlasov <vsu@altlinux.ru>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      4a4e6fd7
  31. 03 11月, 2005 1 次提交
    • J
      Be careful when dereferencing tags. · 9534f40b
      Junio C Hamano 提交于
      One caller of deref_tag() was not careful enough to make sure
      what deref_tag() returned was not NULL (i.e. we found a tag
      object that points at an object we do not have).  Fix it, and
      warn about refs that point at such an incomplete tag where
      needed.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9534f40b
  32. 16 10月, 2005 1 次提交
    • J
      Show peeled onion from upload-pack and server-info. · f6b42a81
      Junio C Hamano 提交于
      This updates git-ls-remote to show SHA1 names of objects that are
      referred by tags, in the "ref^{}" notation.
      
      This would make git-findtags (without -t flag) almost trivial.
      
          git-peek-remote . |
          sed -ne "s:^$target	"'refs/tags/\(.*\)^{}$:\1:p'
      
      Also Pasky could do:
      
          git-ls-remote --tags $remote |
          sed -ne 's:\(	refs/tags/.*\)^{}$:\1:p'
      
      to find out what object each of the remote tags refers to, and
      if he has one locally, run "git-fetch $remote tag $tagname" to
      automatically catch up with the upstream tags.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      f6b42a81
  33. 09 10月, 2005 1 次提交