Merge branch 'jc/git-add--interactive'
authorJunio C Hamano <junkio@cox.net>
Mon, 25 Dec 2006 09:31:17 +0000 (01:31 -0800)
committerJunio C Hamano <junkio@cox.net>
Mon, 25 Dec 2006 09:31:17 +0000 (01:31 -0800)
* jc/git-add--interactive:
git-add --interactive: add documentation
git-add --interactive: hunk splitting
git-add --interactive

1  2 
Makefile
builtin-add.c
diff --combined Makefile
index 8827dee59ccee9365b19113e28034ef822776026,354f66b23335ba08f13813e64f8360015871867a..475047f100ef1a2a9cf73557eba3b300e74cac9d
+++ b/Makefile
@@@ -79,6 -79,13 +79,6 @@@ all
  #
  # Define NO_ICONV if your libc does not properly support iconv.
  #
 -# Define NO_ACCURATE_DIFF if your diff program at least sometimes misses
 -# a missing newline at the end of the file.
 -#
 -# Define COLLISION_CHECK below if you believe that SHA1's
 -# 1461501637330902918203684832716283019655932542976 hashes do not give you
 -# sufficient guarantee that no collisions between objects will ever happen.
 -#
  # Define USE_NSEC below if you want git to care about sub-second file mtimes
  # and ctimes. Note that you need recent glibc (at least 2.2.4) for this, and
  # it will BREAK YOUR LOCAL DIFFS! show-diff and anything using it will likely
@@@ -170,7 -177,9 +170,8 @@@ SCRIPT_SH = 
        git-lost-found.sh git-quiltimport.sh
  
  SCRIPT_PERL = \
+       git-add--interactive.perl \
        git-archimport.perl git-cvsimport.perl git-relink.perl \
 -      git-rerere.perl \
        git-cvsserver.perl \
        git-svnimport.perl git-cvsexportcommit.perl \
        git-send-email.perl git-svn.perl
@@@ -229,8 -238,7 +230,8 @@@ LIB_H = 
        archive.h blob.h cache.h commit.h csum-file.h delta.h grep.h \
        diff.h object.h pack.h pkt-line.h quote.h refs.h list-objects.h sideband.h \
        run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h \
 -      tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h
 +      tree-walk.h log-tree.h dir.h path-list.h unpack-trees.h builtin.h \
 +      utf8.h
  
  DIFF_OBJS = \
        diff.o diff-lib.o diffcore-break.o diffcore-order.o \
@@@ -249,8 -257,7 +250,8 @@@ LIB_OBJS = 
        revision.o pager.o tree-walk.o xdiff-interface.o \
        write_or_die.o trace.o list-objects.o grep.o \
        alloc.o merge-file.o path-list.o help.o unpack-trees.o $(DIFF_OBJS) \
 -      color.o wt-status.o archive-zip.o archive-tar.o
 +      color.o wt-status.o archive-zip.o archive-tar.o \
 +      utf8.o
  
  BUILTIN_OBJS = \
        builtin-add.o \
        builtin-push.o \
        builtin-read-tree.o \
        builtin-repo-config.o \
 +      builtin-rerere.o \
        builtin-rev-list.o \
        builtin-rev-parse.o \
        builtin-rm.o \
@@@ -548,6 -554,9 +549,6 @@@ els
  endif
  endif
  endif
 -ifdef NO_ACCURATE_DIFF
 -      BASIC_CFLAGS += -DNO_ACCURATE_DIFF
 -endif
  ifdef NO_PERL_MAKEMAKER
        export NO_PERL_MAKEMAKER
  endif
@@@ -826,8 -835,6 +827,8 @@@ install: al
  install-doc:
        $(MAKE) -C Documentation install
  
 +quick-install-doc:
 +      $(MAKE) -C Documentation quick-install
  
  
  
diff --combined builtin-add.c
index f306f82b16c3c3c76416610cd4cabf0a307924ed,9443bae5352326a1915dd5f6ed65bc1aa4815408..17641b433d5249a88a396fa4d68415f1d1dcd7ca
@@@ -3,13 -3,16 +3,14 @@@
   *
   * Copyright (C) 2006 Linus Torvalds
   */
 -#include <fnmatch.h>
 -
  #include "cache.h"
  #include "builtin.h"
  #include "dir.h"
+ #include "exec_cmd.h"
  #include "cache-tree.h"
  
  static const char builtin_add_usage[] =
- "git-add [-n] [-v] <filepattern>...";
+ "git-add [-n] [-v] [--interactive] [--] <filepattern>...";
  
  static void prune_directory(struct dir_struct *dir, const char **pathspec, int prefix)
  {
@@@ -87,6 -90,20 +88,20 @@@ int cmd_add(int argc, const char **argv
        int verbose = 0, show_only = 0;
        const char **pathspec;
        struct dir_struct dir;
+       int add_interactive = 0;
+       for (i = 1; i < argc; i++) {
+               if (!strcmp("--interactive", argv[i]))
+                       add_interactive++;
+       }
+       if (add_interactive) {
+               const char *args[] = { "add--interactive", NULL };
+               if (add_interactive != 1 || argc != 2)
+                       die("add --interactive does not take any parameters");
+               execv_git_cmd(args);
+               exit(1);
+       }
  
        git_config(git_default_config);
  
                }
                usage(builtin_add_usage);
        }
 +      if (argc <= i) {
 +              fprintf(stderr, "Nothing specified, nothing added.\n");
 +              fprintf(stderr, "Maybe you wanted to say 'git add .'?\n");
 +              return 0;
 +      }
        pathspec = get_pathspec(prefix, argv + i);
  
        fill_directory(&dir, pathspec);