1. 07 10月, 2011 1 次提交
    • B
      cleanup: use internal memory allocation wrapper functions everywhere · 040a6551
      Brandon Casey 提交于
      The "x"-prefixed versions of strdup, malloc, etc. will check whether the
      allocation was successful and terminate the process otherwise.
      
      A few uses of malloc were left alone since they already implemented a
      graceful path of failure or were in a quasi external library like xdiff.
      
      Additionally, the call to malloc in compat/win32/syslog.c was not modified
      since the syslog() implemented there is a die handler and a call to the
      x-wrappers within a die handler could result in recursion should memory
      allocation fail.  This will have to be addressed separately.
      Signed-off-by: NBrandon Casey <drafnel@gmail.com>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      040a6551
  2. 10 3月, 2011 2 次提交
  3. 16 11月, 2010 2 次提交
  4. 06 7月, 2010 1 次提交
  5. 28 6月, 2010 1 次提交
  6. 23 2月, 2010 1 次提交
    • L
      Move 'builtin-*' into a 'builtin/' subdirectory · 81b50f3c
      Linus Torvalds 提交于
      This shrinks the top-level directory a bit, and makes it much more
      pleasant to use auto-completion on the thing. Instead of
      
      	[torvalds@nehalem git]$ em buil<tab>
      	Display all 180 possibilities? (y or n)
      	[torvalds@nehalem git]$ em builtin-sh
      	builtin-shortlog.c     builtin-show-branch.c  builtin-show-ref.c
      	builtin-shortlog.o     builtin-show-branch.o  builtin-show-ref.o
      	[torvalds@nehalem git]$ em builtin-shor<tab>
      	builtin-shortlog.c  builtin-shortlog.o
      	[torvalds@nehalem git]$ em builtin-shortlog.c
      
      you get
      
      	[torvalds@nehalem git]$ em buil<tab>		[type]
      	builtin/   builtin.h
      	[torvalds@nehalem git]$ em builtin		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/sh<tab>	[type]
      	shortlog.c     shortlog.o     show-branch.c  show-branch.o  show-ref.c     show-ref.o
      	[torvalds@nehalem git]$ em builtin/sho		[auto-completes to]
      	[torvalds@nehalem git]$ em builtin/shor<tab>	[type]
      	shortlog.c  shortlog.o
      	[torvalds@nehalem git]$ em builtin/shortlog.c
      
      which doesn't seem all that different, but not having that annoying
      break in "Display all 180 possibilities?" is quite a relief.
      
      NOTE! If you do this in a clean tree (no object files etc), or using an
      editor that has auto-completion rules that ignores '*.o' files, you
      won't see that annoying 'Display all 180 possibilities?' message - it
      will just show the choices instead.  I think bash has some cut-off
      around 100 choices or something.
      
      So the reason I see this is that I'm using an odd editory, and thus
      don't have the rules to cut down on auto-completion.  But you can
      simulate that by using 'ls' instead, or something similar.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      81b50f3c
  7. 23 1月, 2010 1 次提交
    • J
      git-mv: fix moving more than one source to a single destination · af82559b
      Junio C Hamano 提交于
      The code used as if return value from basename(3) were stable, but
      often the function is implemented to return a pointer to a static
      storage internal to it.
      
      Because basename(3) is also allowed to modify its input parameter in
      place, casting constness away from the strings we obtained from the
      caller and giving them to basename is a no-no.
      
      Reported, and initial fix and test supplied by David Rydh.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      af82559b
  8. 04 1月, 2010 1 次提交
  9. 11 11月, 2009 1 次提交
  10. 30 8月, 2009 1 次提交
  11. 01 7月, 2009 1 次提交
  12. 28 6月, 2009 1 次提交
  13. 25 5月, 2009 1 次提交
  14. 05 2月, 2009 1 次提交
  15. 15 1月, 2009 1 次提交
  16. 28 7月, 2008 2 次提交
    • P
      git-mv: Keep moved index entries inact · 81dc2307
      Petr Baudis 提交于
      The rewrite of git-mv from a shell script to a builtin was perhaps
      a little too straightforward: the git add and git rm queues were
      emulated directly, which resulted in a rather complicated code and
      caused an inconsistent behaviour when moving dirty index entries;
      git mv would update the entry based on working tree state,
      except in case of overwrites, where the new entry would still have
      sha1 of the old file.
      
      This patch introduces rename_index_entry_at() into the index toolkit,
      which will rename an entry while removing any entries the new entry
      might render duplicate. This is then used in git mv instead
      of all the file queues, resulting in a major simplification
      of the code and an inevitable change in git mv -n output format.
      
      Also the code used to refuse renaming overwriting symlink with a regular
      file and vice versa; there is no need for that.
      
      A few new tests have been added to the testsuite to reflect this change.
      Signed-off-by: NPetr Baudis <pasky@suse.cz>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      81dc2307
    • P
      git-mv: Remove dead code branch · f6c52fe4
      Petr Baudis 提交于
      The path list builder had a branch for the case the source is not in index, but
      this can happen only if the source was a directory. However, in that case we
      have already expanded the list to the directory contents and set mode
      to WORKING_DIRECTORY, which is tested earlier.
      
      The patch removes the superfluous branch and adds an assert() instead. git-mv
      testsuite still passes.
      Signed-off-by: NPetr Baudis <pasky@suse.cz>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      f6c52fe4
  17. 22 7月, 2008 1 次提交
    • J
      Rename path_list to string_list · c455c87c
      Johannes Schindelin 提交于
      The name path_list was correct for the first usage of that data structure,
      but it really is a general-purpose string list.
      
      $ perl -i -pe 's/path-list/string-list/g' $(git grep -l path-list)
      $ perl -i -pe 's/path_list/string_list/g' $(git grep -l path_list)
      $ git mv path-list.h string-list.h
      $ git mv path-list.c string-list.c
      $ perl -i -pe 's/has_path/has_string/g' $(git grep -l has_path)
      $ perl -i -pe 's/path/string/g' string-list.[ch]
      $ git mv Documentation/technical/api-path-list.txt \
      	Documentation/technical/api-string-list.txt
      $ perl -i -pe 's/strdup_paths/strdup_strings/g' $(git grep -l strdup_paths)
      
      ... and then fix all users of string-list to access the member "string"
      instead of "path".
      
      Documentation/technical/api-string-list.txt needed some rewrapping, too.
      Signed-off-by: NJohannes Schindelin <johannes.schindelin@gmx.de>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      c455c87c
  18. 14 7月, 2008 1 次提交
    • S
      Make usage strings dash-less · 1b1dd23f
      Stephan Beyer 提交于
      When you misuse a git command, you are shown the usage string.
      But this is currently shown in the dashed form.  So if you just
      copy what you see, it will not work, when the dashed form
      is no longer supported.
      
      This patch makes git commands show the dash-less version.
      
      For shell scripts that do not specify OPTIONS_SPEC, git-sh-setup.sh
      generates a dash-less usage string now.
      Signed-off-by: NStephan Beyer <s-beyer@gmx.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1b1dd23f
  19. 22 5月, 2008 1 次提交
  20. 15 5月, 2008 1 次提交
  21. 13 5月, 2008 1 次提交
  22. 07 3月, 2008 1 次提交
  23. 05 2月, 2008 2 次提交
    • J
      builtin-mv: minimum fix to avoid losing files · 744dacd3
      Junio C Hamano 提交于
      An incorrect command "git mv subdir /outer/space" threw the
      subdirectory to outside of the repository and then noticed that
      /outer/space/subdir/ would be outside of the repository.  The
      error checking is backwards.
      
      This fixes the issue by being careful about use of the return
      value of get_pathspec().  Since the implementation already has
      handcrafted loop to munge each path on the command line, we use
      prefix_path() instead.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      744dacd3
    • J
      setup: sanitize absolute and funny paths in get_pathspec() · d089ebaa
      Junio C Hamano 提交于
      The prefix_path() function called from get_pathspec() is
      responsible for translating list of user-supplied pathspecs to
      list of pathspecs that is relative to the root of the work
      tree.  When working inside a subdirectory, the user-supplied
      pathspecs are taken to be relative to the current subdirectory.
      
      Among special path components in pathspecs, we used to accept
      and interpret only "." ("the directory", meaning a no-op) and
      ".."  ("up one level") at the beginning.  Everything else was
      passed through as-is.
      
      For example, if you are in Documentation/ directory of the
      project, you can name Documentation/howto/maintain-git.txt as:
      
          howto/maintain-git.txt
          ../Documentation/howto/maitain-git.txt
          ../././Documentation/howto/maitain-git.txt
      
      but not as:
      
          howto/./maintain-git.txt
          $(pwd)/howto/maintain-git.txt
      
      This patch updates prefix_path() in several ways:
      
       - If the pathspec is not absolute, prefix (i.e. the current
         subdirectory relative to the root of the work tree, with
         terminating slash, if not empty) and the pathspec is
         concatenated first and used in the next step.  Otherwise,
         that absolute pathspec is used in the next step.
      
       - Then special path components "." (no-op) and ".." (up one
         level) are interpreted to simplify the path.  It is an error
         to have too many ".." to cause the intermediate result to
         step outside of the input to this step.
      
       - If the original pathspec was not absolute, the result from
         the previous step is the resulting "sanitized" pathspec.
         Otherwise, the result from the previous step is still
         absolute, and it is an error if it does not begin with the
         directory that corresponds to the root of the work tree.  The
         directory is stripped away from the result and is returned.
      
       - In any case, the resulting pathspec in the array
         get_pathspec() returns omit the ones that caused errors.
      
      With this patch, the last two examples also behave as expected.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d089ebaa
  24. 17 1月, 2008 1 次提交
  25. 30 10月, 2007 1 次提交
  26. 19 9月, 2007 1 次提交
  27. 14 9月, 2007 1 次提交
    • J
      Simplify cache API · 09d5dc32
      Junio C Hamano 提交于
      Earlier, add_file_to_index() invalidated the path in the cache-tree
      but remove_file_from_cache() did not, and the user of the latter
      needed to invalidate the entry himself.  This led to a few bugs due to
      missed invalidate calls already.  This patch makes the management of
      cache-tree less error prone by making more invalidate calls from lower
      level cache API functions.
      
      The rules are:
      
       - If you are going to write the index, you should either maintain
         cache_tree correctly.
      
         - If you cannot, alternatively you can remove the entire cache_tree
           by calling cache_tree_free() before you call write_cache().
      
         - When you modify the index, cache_tree_invalidate_path() should be
           called with the path you are modifying, to discard the entry from
           the cache-tree structure.
      
       - The following cache API functions exported from read-cache.c (and
         the macro whose names have "cache" instead of "index")
         automatically call cache_tree_invalidate_path() for you:
      
         - remove_file_from_index();
         - add_file_to_index();
         - add_index_entry();
      
         You can modify the index bypassing the above API functions
         (e.g. find an existing cache entry from the index and modify it in
         place).  You need to call cache_tree_invalidate_path() yourself in
         such a case.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      09d5dc32
  28. 06 4月, 2007 1 次提交
    • J
      Rename add_file_to_index() to add_file_to_cache() · fd1c3bf0
      Junio C Hamano 提交于
      This function was not called "add_file_to_cache()" only because
      an ancient program, update-cache, used that name as an internal
      function name that does something slightly different.  Now that
      is gone, we can take over the better name.
      
      The plan is to name all functions that operate on the default
      index xxx_cache().  Later patches create a variant of them that
      take an explicit parameter xxx_index(), and then turn
      xxx_cache() functions into macros that use "the_index".
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      fd1c3bf0
  29. 04 4月, 2007 1 次提交
    • J
      _GIT_INDEX_OUTPUT: allow plumbing to output to an alternative index file. · 30ca07a2
      Junio C Hamano 提交于
      When defined, this allows plumbing commands that update the
      index (add, apply, checkout-index, merge-recursive, mv,
      read-tree, rm, update-index, and write-tree) to write their
      resulting index to an alternative index file while holding a
      lock to the original index file.  With this, git-commit that
      jumps the index does not have to make an extra copy of the index
      file, and more importantly, it can do the update while holding
      the lock on the index.
      
      However, I think the interface to let an environment variable
      specify the output is a mistake, as shown in the documentation.
      If a curious user has the environment variable set to something
      other than the file GIT_INDEX_FILE points at, almost everything
      will break.  This should instead be a command line parameter to
      tell these plumbing commands to write the result in the named
      file, to prevent stupid mistakes.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      30ca07a2
  30. 21 12月, 2006 1 次提交
    • J
      simplify inclusion of system header files. · 85023577
      Junio C Hamano 提交于
      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: NJunio C Hamano <junkio@cox.net>
      85023577
  31. 04 12月, 2006 1 次提交
  32. 02 10月, 2006 1 次提交
  33. 27 8月, 2006 1 次提交
  34. 24 8月, 2006 1 次提交
  35. 22 8月, 2006 2 次提交