1. 20 4月, 2007 1 次提交
  2. 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
  3. 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
  4. 01 4月, 2007 1 次提交
    • L
      Optimize directory listing with pathspec limiter. · 9fc42d60
      Linus Torvalds 提交于
      The way things are set up, you can now pass a "pathspec" to the
      "read_directory()" function. If you pass NULL, it acts exactly
      like it used to do (read everything). If you pass a non-NULL
      pointer, it will simplify it into a "these are the prefixes
      without any special characters", and stop any readdir() early if
      the path in question doesn't match any of the prefixes.
      
      NOTE! This does *not* obviate the need for the caller to do the *exact*
      pathspec match later. It's a first-level filter on "read_directory()", but
      it does not do the full pathspec thing. Maybe it should. But in the
      meantime, builtin-add.c really does need to do first
      
      	read_directory(dir, .., pathspec);
      	if (pathspec)
      		prune_directory(dir, pathspec, baselen);
      
      ie the "prune_directory()" part will do the *exact* pathspec pruning,
      while the "read_directory()" will use the pathspec just to do some quick
      high-level pruning of the directories it will recurse into.
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      9fc42d60
  5. 09 3月, 2007 1 次提交
  6. 18 1月, 2007 1 次提交
  7. 30 12月, 2006 1 次提交
    • J
      Fix 'git add' with .gitignore · 4d06f8ac
      Junio C Hamano 提交于
      When '*.ig' is ignored, and you have two files f.ig and d.ig/foo
      in the working tree,
      
      	$ git add .
      
      correctly ignored f.ig but failed to ignore d.ig/foo.  This was
      caused by a thinko in an earlier commit 4888c534, when we tried
      to allow adding otherwise ignored files.
      
      After reverting that commit, this takes a much simpler approach.
      When we have an unmatched pathspec that talks about an existing
      pathname, we know it is an ignored path the user tried to add,
      so we include it in the set of paths directory walker returned.
      
      This does not let you say "git add -f D" on an ignored directory
      D and add everything under D.  People can submit a patch to
      further allow it if they want to, but I think it is a saner
      behaviour to require explicit paths to be spelled out in such a
      case.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      4d06f8ac
  8. 26 12月, 2006 2 次提交
  9. 25 12月, 2006 2 次提交
  10. 21 12月, 2006 2 次提交
  11. 19 12月, 2006 1 次提交
    • J
      git-add --interactive · 5cde71d6
      Junio C Hamano 提交于
      A script to be driven when the user says "git add --interactive"
      is introduced.
      
      When it is run, first it runs its internal 'status' command to
      show the current status, and then goes into its internactive
      command loop.
      
      The command loop shows the list of subcommands available, and
      gives a prompt "What now> ".  In general, when the prompt ends
      with a single '>', you can pick only one of the choices given
      and type return, like this:
      
          *** Commands ***
            1: status       2: update       3: revert       4: add untracked
            5: patch        6: diff         7: quit         8: help
          What now> 1
      
      You also could say "s" or "sta" or "status" above as long as the
      choice is unique.
      
      The main command loop has 6 subcommands (plus help and quit).
      
       * 'status' shows the change between HEAD and index (i.e. what
         will be committed if you say "git commit"), and between index
         and working tree files (i.e. what you could stage further
         before "git commit" using "git-add") for each path.  A sample
         output looks like this:
      
                    staged     unstaged path
           1:       binary      nothing foo.png
           2:     +403/-35        +1/-1 git-add--interactive.perl
      
         It shows that foo.png has differences from HEAD (but that is
         binary so line count cannot be shown) and there is no
         difference between indexed copy and the working tree
         version (if the working tree version were also different,
         'binary' would have been shown in place of 'nothing').  The
         other file, git-add--interactive.perl, has 403 lines added
         and 35 lines deleted if you commit what is in the index, but
         working tree file has further modifications (one addition and
         one deletion).
      
       * 'update' shows the status information and gives prompt
         "Update>>".  When the prompt ends with double '>>', you can
         make more than one selection, concatenated with whitespace or
         comma.  Also you can say ranges.  E.g. "2-5 7,9" to choose
         2,3,4,5,7,9 from the list.  You can say '*' to choose
         everything.
      
         What you chose are then highlighted with '*', like this:
      
                    staged     unstaged path
           1:       binary      nothing foo.png
         * 2:     +403/-35        +1/-1 git-add--interactive.perl
      
         To remove selection, prefix the input with - like this:
      
              Update>> -2
      
         After making the selection, answer with an empty line to
         stage the contents of working tree files for selected paths
         in the index.
      
       * 'revert' has a very similar UI to 'update', and the staged
         information for selected paths are reverted to that of the
         HEAD version.  Reverting new paths makes them untracked.
      
       * 'add untracked' has a very similar UI to 'update' and
         'revert', and lets you add untracked paths to the index.
      
       * 'patch' lets you choose one path out of 'status' like
         selection.  After choosing the path, it presents diff between
         the index and the working tree file and asks you if you want
         to stage the change of each hunk.  You can say:
      
              y - add the change from that hunk to index
              n - do not add the change from that hunk to index
              a - add the change from that hunk and all the rest to index
              d - do not the change from that hunk nor any of the rest to index
              j - do not decide on this hunk now, and view the next
                  undecided hunk
              J - do not decide on this hunk now, and view the next hunk
              k - do not decide on this hunk now, and view the previous
                  undecided hunk
              K - do not decide on this hunk now, and view the previous hunk
      
         After deciding the fate for all hunks, if there is any hunk
         that was chosen, the index is updated with the selected hunks.
      
       * 'diff' lets you review what will be committed (i.e. between
         HEAD and index).
      
      This is still rough, but does everything except a few things I
      think are needed.
      
       * 'patch' should be able to allow splitting a hunk into
         multiple hunks.
      
       * 'patch' does not adjust the line offsets @@ -k,l +m,n @@
         in the hunk header.  This does not have major problem in
         practice, but it _should_ do the adjustment.
      
       * It does not have any explicit support for a merge in
         progress; it may not work at all.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      5cde71d6
  12. 05 12月, 2006 1 次提交
    • N
      make 'git add' a first class user friendly interface to the index · 366bfcb6
      Nicolas Pitre 提交于
      This brings the power of the index up front using a proper mental model
      without talking about the index at all. See for example how all the
      technical discussion has been evacuated from the git-add man page.
      
         Any content to be committed must be added together.  Whether that
         content comes from new files or modified files doesn't matter.  You
         just need to "add" it, either with git-add, or by providing
         git-commit with -a (for already known files only of course).
      
      No need for a separate command to distinguish new vs modified files
      please. That would only screw the mental model everybody should have
      when using GIT.
      Signed-off-by: NNicolas Pitre <nico@cam.org>
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      366bfcb6
  13. 18 9月, 2006 1 次提交
  14. 16 9月, 2006 1 次提交
  15. 13 8月, 2006 1 次提交
    • J
      Better error message when we are unable to lock the index file · 40aaae88
      Junio C Hamano 提交于
      Most of the callers except the one in refs.c use the function to
      update the index file.  Among the index writers, everybody
      except write-tree dies if they cannot open it for writing.
      
      This gives the function an extra argument, to tell it to die
      when it cannot create a new file as the lockfile.
      
      The only caller that does not have to die is write-tree, because
      updating the index for the cache-tree part is optional and not
      being able to do so does not affect the correctness.  I think we
      do not have to be so careful and make the failure into die() the
      same way as other callers, but that would be a different patch.
      Signed-off-by: NJunio C Hamano <junkio@cox.net>
      40aaae88
  16. 04 8月, 2006 1 次提交
  17. 29 7月, 2006 1 次提交
  18. 27 7月, 2006 1 次提交
  19. 26 7月, 2006 1 次提交
  20. 08 7月, 2006 1 次提交
  21. 07 6月, 2006 1 次提交
  22. 20 5月, 2006 1 次提交
  23. 18 5月, 2006 3 次提交