1. 28 6月, 2010 1 次提交
  2. 06 6月, 2010 1 次提交
  3. 22 3月, 2010 1 次提交
  4. 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
  5. 26 12月, 2009 1 次提交
    • J
      resolve-undo: basic tests · 9d9a2f4a
      Junio C Hamano 提交于
      Make sure that resolving a failed merge with git add records
      the conflicted state, committing the result keeps that state,
      and checking out another commit clears the state.
      
      "git ls-files" learns a new option --resolve-undo to show the
      recorded information.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      9d9a2f4a
  6. 31 10月, 2009 1 次提交
    • J
      ls-files: unbreak "ls-files -i" · 500348aa
      Jeff King 提交于
      Commit b5227d80 changed the behavior of "ls-files" with
      respect to includes, but accidentally broke the "-i" option
      The original behavior was:
      
        1. if no "-i" is given, cull all results according to --exclude*
        2. if "-i" is given, show the inverse of (1)
      
      The broken behavior was:
      
        1. if no "-i" is given:
           a. for "-o", cull results according to --exclude*
           b. for index files, always show all
        2. if "-i" is given:
           a. for "-o", shows the inverse of (1a)
           b. for index files, always show all
      
      The fixed behavior keeps the new (1b) behavior introduced
      by b5227d80, but fixes the (2b) behavior to show only ignored
      files, not all files.
      
      This patch also tweaks the documentation. The original text
      was somewhat obscure in the first place, but it is also now
      inaccurate (the relationship between (1b) and (2b) is not
      quite a "reverse").
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      500348aa
  7. 13 10月, 2009 1 次提交
    • J
      ls-files: excludes should not impact tracked files · b5227d80
      Jeff King 提交于
      In all parts of git, .gitignore and other exclude files
      impact only how we treat untracked files; they should have
      no effect on files listed in the index.
      
      This behavior was originally implemented very early on in
      9ff768e9, but only for --exclude-from. Later, commit 63d285c8
      accidentally caused us to trigger the behavior for
      --exclude-per-directory.
      
      This patch totally ignores excludes for files found in the
      index. This means we are reversing the original intent of
      9ff768e9, while at the same time fixing the accidental
      behavior of 63d285c8. This is a good thing, though, as the
      way that 9ff768e9 behaved does not really make sense with the
      way exclusions are used in modern git.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      b5227d80
  8. 09 10月, 2009 1 次提交
    • B
      ls-files: die instead of fprintf/exit in -i error · ac78b009
      Ben Walton 提交于
      When ls-files was called with -i but no exclude pattern, it was
      calling fprintf(stderr, "...", NULL) and then exiting.  On Solaris,
      passing NULL into fprintf was causing a segfault.  On glibc systems,
      it was simply producing incorrect output (eg: "(null)": ...).  The
      NULL pointer was a result of argv[0] not being preserved by the option
      parser.  Instead of requesting that the option parser preserve
      argv[0], use die() with a constant string.
      
      A trigger for this bug was: `git ls-files -i`
      Signed-off-by: NBen Walton <bwalton@artsci.utoronto.ca>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ac78b009
  9. 24 8月, 2009 3 次提交
  10. 09 7月, 2009 1 次提交
    • L
      Add 'fill_directory()' helper function for directory traversal · 1d8842d9
      Linus Torvalds 提交于
      Most of the users of "read_directory()" actually want a much simpler
      interface than the whole complex (but rather powerful) one.
      
      In fact 'git add' had already largely abstracted out the core interface
      issues into a private "fill_directory()" function that was largely
      applicable almost as-is to a number of callers.  Yes, 'git add' wants to
      do some extra work of its own, specific to the add semantics, but we can
      easily split that out, and use the core as a generic function.
      
      This function does exactly that, and now that much simplified
      'fill_directory()' function can be shared with a number of callers,
      while also ensuring that the rather more complex calling conventions of
      read_directory() are used by fewer call-sites.
      
      This also makes the 'common_prefix()' helper function private to dir.c,
      since all callers are now in that file.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      1d8842d9
  11. 25 5月, 2009 1 次提交
  12. 09 5月, 2009 1 次提交
    • J
      parseopt: add OPT_NEGBIT · e9008b9a
      Jeff King 提交于
      On Thu, May 07, 2009 at 09:44:17PM +0200, René Scharfe wrote:
      Subject: [PATCH] ls-files: make --no-empty-directory properly negatable
      
      This option was specified to parseopt as an OPT_BIT; however, we
      actually want to _set_ the bit on --no-empty-directory. Thus the
      existing implementation used --no-empty-directory, and required
      --no-no-empty-directory to negate it.
      
      Now that OPT_NEGBIT exists, we can properly support it as
      --empty-directory and --no-empty-directory (but of course
      still defaulting to showing empty directories).
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      e9008b9a
  13. 23 4月, 2009 1 次提交
  14. 22 3月, 2009 1 次提交
  15. 18 3月, 2009 1 次提交
  16. 08 3月, 2009 1 次提交
  17. 19 2月, 2009 2 次提交
  18. 08 2月, 2009 1 次提交
  19. 15 1月, 2009 1 次提交
  20. 16 11月, 2008 2 次提交
  21. 18 10月, 2008 1 次提交
    • J
      refactor handling of "other" files in ls-files and status · 98fa4738
      Jeff King 提交于
      When the "git status" display code was originally converted
      to C, we copied the code from ls-files to discover whether a
      pathname returned by read_directory was an "other", or
      untracked, file.
      
      Much later, 5698454e updated the code in ls-files to handle
      some new cases caused by gitlinks.  This left the code in
      wt-status.c broken: it would display submodule directories
      as untracked directories. Nobody noticed until now, however,
      because unless status.showUntrackedFiles was set to "all",
      submodule directories were not actually reported by
      read_directory. So the bug was only triggered in the
      presence of a submodule _and_ this config option.
      
      This patch pulls the ls-files code into a new function,
      cache_name_is_other, and uses it in both places. This should
      leave the ls-files functionality the same and fix the bug
      in status.
      Signed-off-by: NJeff King <peff@peff.net>
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      98fa4738
  22. 01 9月, 2008 1 次提交
  23. 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
  24. 15 5月, 2008 1 次提交
  25. 07 3月, 2008 1 次提交
  26. 05 2月, 2008 3 次提交
    • J
      gitignore: lazily find dtype · 6831a88a
      Junio C Hamano 提交于
      When we process "foo/" entries in gitignore files on a system
      that does not have d_type member in "struct dirent", the earlier
      implementation ran lstat(2) separately when matching with
      entries that came from the command line, in-tree .gitignore
      files, and $GIT_DIR/info/excludes file.
      
      This optimizes it by delaying the lstat(2) call until it becomes
      absolutely necessary.
      
      The initial idea for this change was by Jeff King, but I
      optimized it further to pass pointers to around.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      6831a88a
    • J
      gitignore(5): Allow "foo/" in ignore list to match directory "foo" · d6b8fc30
      Junio C Hamano 提交于
      A pattern "foo/" in the exclude list did not match directory
      "foo", but a pattern "foo" did.  This attempts to extend the
      exclude mechanism so that it would while not matching a regular
      file or a symbolic link "foo".  In order to differentiate a
      directory and non directory, this passes down the type of path
      being checked to excluded() function.
      
      A downside is that the recursive directory walk may need to run
      lstat(2) more often on systems whose "struct dirent" do not give
      the type of the entry; earlier it did not have to do so for an
      excluded path, but we now need to figure out if a path is a
      directory before deciding to exclude it.  This is especially bad
      because an idea similar to the earlier CE_UPTODATE optimization
      to reduce number of lstat(2) calls would by definition not apply
      to the codepaths involved, as (1) directories will not be
      registered in the index, and (2) excluded paths will not be in
      the index anyway.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      d6b8fc30
    • 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
  27. 22 1月, 2008 1 次提交
    • L
      Make on-disk index representation separate from in-core one · 7a51ed66
      Linus Torvalds 提交于
      This converts the index explicitly on read and write to its on-disk
      format, allowing the in-core format to contain more flags, and be
      simpler.
      
      In particular, the in-core format is now host-endian (as opposed to the
      on-disk one that is network endian in order to be able to be shared
      across machines) and as a result we can dispense with all the
      htonl/ntohl on accesses to the cache_entry fields.
      
      This will make it easier to make use of various temporary flags that do
      not exist in the on-disk format.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      7a51ed66
  28. 23 11月, 2007 1 次提交
    • J
      Export three helper functions from ls-files · ee425e46
      Junio C Hamano 提交于
      This exports three helper functions from ls-files.
      
       * pathspec_match() checks if a given path matches a set of pathspecs
         and optionally records which pathspec was used.  This function used
         to be called "match()" but renamed to be a bit less vague.
      
       * report_path_error() takes a set of pathspecs and the record
         pathspec_match() above leaves, and gives error message.  This
         was split out of the main function of ls-files.
      
       * overlay_tree_on_cache() takes a tree-ish (typically "HEAD")
         and overlays it on the current in-core index.  By iterating
         over the resulting index, the caller can find out the paths
         in either the index or the HEAD.  This function used to be
         called "overlay_tree()" but renamed to be a bit more
         descriptive.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      ee425e46
  29. 16 11月, 2007 1 次提交
  30. 06 11月, 2007 1 次提交
  31. 03 10月, 2007 1 次提交
    • K
      Must not modify the_index.cache as it may be passed to realloc at some point. · 95af39fc
      Keith Packard 提交于
      The index cache is not static, growing as new entries are added. If
      entries are added after prune_cache is called, cache will no longer
      point at the base of the allocation, and realloc will not be happy.
      
      I verified that this was the only place in the current source which
      modified any index_state.cache elements aside from the alloc/realloc
      calls in read-cache by changing the type of the element to 'struct
      cache_entry ** const cache' and recompiling.
      
      A more efficient patch would create a separate 'cache_base' value to
      track the allocation and then fix things up when reallocation was
      necessary, instead of the brute-force memmove used here.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      95af39fc
  32. 21 9月, 2007 1 次提交
    • P
      Full rework of quote_c_style and write_name_quoted. · 663af342
      Pierre Habouzit 提交于
      * quote_c_style works on a strbuf instead of a wild buffer.
      * quote_c_style is now clever enough to not add double quotes if not needed.
      
      * write_name_quoted inherits those advantages, but also take a different
        set of arguments. Now instead of asking for quotes or not, you pass a
        "terminator". If it's \0 then we assume you don't want to escape, else C
        escaping is performed. In any case, the terminator is also appended to the
        stream. It also no longer takes the prefix/prefix_len arguments, as it's
        seldomly used, and makes some optimizations harder.
      
      * write_name_quotedpfx is created to work like write_name_quoted and take
        the prefix/prefix_len arguments.
      
      Thanks to those API changes, diff.c has somehow lost weight, thanks to the
      removal of functions that were wrappers around the old write_name_quoted
      trying to give it a semantics like the new one, but performing a lot of
      allocations for this goal. Now we always write directly to the stream, no
      intermediate allocation is performed.
      
      As a side effect of the refactor in builtin-apply.c, the length of the bar
      graphs in diffstats are not affected anymore by the fact that the path was
      clipped.
      Signed-off-by: NPierre Habouzit <madcoder@debian.org>
      663af342
  33. 19 9月, 2007 1 次提交
  34. 18 9月, 2007 1 次提交
    • J
      git-commit: Allow partial commit of file removal. · 64586e75
      Junio C Hamano 提交于
      When making a partial commit, git-commit uses git-ls-files with
      the --error-unmatch option to expand and sanity check the user
      supplied path patterns.  When any path pattern does not match
      with the paths known to the index, it errors out, in order to
      catch a common mistake to say "git commit Makefiel cache.h"
      and end up with a commit that touches only cache.h (notice the
      misspelled "Makefile").  This detection however does not work
      well when the path has already been removed from the index.
      
      If you drop a path from the index and try to commit that
      partially, i.e.
      
      	$ git rm COPYING
      	$ git commit -m 'Remove COPYING' COPYING
      
      the command complains because git does not know anything about
      COPYING anymore.
      
      This introduces a new option --with-tree to git-ls-files and
      uses it in git-commit when we build a temporary index to
      write a tree object for the partial commit.
      
      When --with-tree=<tree-ish> option is specified, names from the
      given tree are added to the set of names the index knows about,
      so we can treat COPYING file in the example as known.
      
      Of course, there is no reason to use "git rm" and git-aware
      people have long time done:
      
      	$ rm COPYING
      	$ git commit -m 'Remove COPYING' COPYING
      
      which works just fine.  But this caused a constant confusion.
      Signed-off-by: NJunio C Hamano <gitster@pobox.com>
      64586e75