From: Junio C Hamano Date: Tue, 16 May 2006 01:12:06 +0000 (-0700) Subject: Merge branch 'jc/grep' X-Git-Tag: v1.4.0-rc1~142 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/efca578eec57869994da0982e05dcf1dee0bc213?ds=sidebyside;hp=-c Merge branch 'jc/grep' * jc/grep: (22 commits) Fix silly typo in new builtin grep builtin-grep: unparse more command line options. builtin-grep: use external grep when we can take advantage of it builtin-grep: -F (--fixed-strings) builtin-grep: -w fix builtin-grep: typofix builtin-grep: tighten argument parsing. builtin-grep: documentation Teach -f option to builtin-grep. builtin-grep: -L (--files-without-match). builtin-grep: binary files -a and -I builtin-grep: terminate correctly at EOF builtin-grep: tighten path wildcard vs tree traversal. builtin-grep: support -w (--word-regexp). builtin-grep: support -c (--count). builtin-grep: allow more than one patterns. builtin-grep: allow - and -[ABC] notation for context lines. builtin-grep: printf %.*s length is int, not ptrdiff_t. builtin-grep: do not use setup_revisions() builtin-grep: support '-l' option. ... --- efca578eec57869994da0982e05dcf1dee0bc213 diff --combined Makefile index f4b6ef8751,8d5122bdd5..93779b06f1 --- a/Makefile +++ b/Makefile @@@ -28,8 -28,8 +28,8 @@@ all # # Define NO_SETENV if you don't have setenv in the C library. # -# Define USE_SYMLINK_HEAD if you want .git/HEAD to be a symbolic link. -# Don't enable it on Windows. +# Define NO_SYMLINK_HEAD if you never want .git/HEAD to be a symbolic link. +# Enable it on Windows. By default, symrefs are still used. # # Define PPC_SHA1 environment variable when running make to make use of # a bundled SHA1 routine optimized for PowerPC. @@@ -115,13 -115,13 +115,13 @@@ SPARSE_FLAGS = -D__BIG_ENDIAN__ -D__pow SCRIPT_SH = \ git-add.sh git-bisect.sh git-branch.sh git-checkout.sh \ git-cherry.sh git-clean.sh git-clone.sh git-commit.sh \ - git-count-objects.sh git-diff.sh git-fetch.sh \ + git-fetch.sh \ git-format-patch.sh git-ls-remote.sh \ git-merge-one-file.sh git-parse-remote.sh \ - git-prune.sh git-pull.sh git-push.sh git-rebase.sh \ + git-prune.sh git-pull.sh git-rebase.sh \ git-repack.sh git-request-pull.sh git-reset.sh \ git-resolve.sh git-revert.sh git-rm.sh git-sh-setup.sh \ - git-tag.sh git-verify-tag.sh git-whatchanged.sh \ + git-tag.sh git-verify-tag.sh \ git-applymbox.sh git-applypatch.sh git-am.sh \ git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \ git-merge-resolve.sh git-merge-ours.sh git-grep.sh \ @@@ -131,8 -131,7 +131,8 @@@ SCRIPT_PERL = git-archimport.perl git-cvsimport.perl git-relink.perl \ git-shortlog.perl git-fmt-merge-msg.perl git-rerere.perl \ git-annotate.perl git-cvsserver.perl \ - git-svnimport.perl git-mv.perl git-cvsexportcommit.perl + git-svnimport.perl git-mv.perl git-cvsexportcommit.perl \ + git-send-email.perl SCRIPT_PYTHON = \ git-merge-recursive.py @@@ -140,7 -139,7 +140,7 @@@ SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \ $(patsubst %.perl,%,$(SCRIPT_PERL)) \ $(patsubst %.py,%,$(SCRIPT_PYTHON)) \ - git-cherry-pick git-show git-status + git-cherry-pick git-status # The ones that do not have to link with lcrypto, lz nor xdiff. SIMPLE_PROGRAMS = \ @@@ -168,8 -167,7 +168,8 @@@ PROGRAMS = git-name-rev$X git-pack-redundant$X git-repo-config$X git-var$X \ git-describe$X git-merge-tree$X git-blame$X git-imap-send$X -BUILT_INS = git-log$X +BUILT_INS = git-log$X git-whatchanged$X git-show$X \ + git-count-objects$X git-diff$X git-push$X # what 'all' will build and 'install' will install, in gitexecdir ALL_PROGRAMS = $(PROGRAMS) $(SIMPLE_PROGRAMS) $(SCRIPTS) @@@ -206,7 -204,7 +206,7 @@@ DIFF_OBJS = diffcore-delta.o log-tree.o LIB_OBJS = \ - blob.o commit.o connect.o csum-file.o \ + blob.o commit.o connect.o csum-file.o base85.o \ date.o diff-delta.o entry.o exec_cmd.o ident.o index.o \ object.o pack-check.o patch-delta.o path.o pkt-line.o \ quote.o read-cache.o refs.o run-command.o \ @@@ -216,7 -214,7 +216,8 @@@ $(DIFF_OBJS) BUILTIN_OBJS = \ - builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o - builtin-log.o builtin-help.o builtin-grep.o ++ builtin-log.o builtin-help.o builtin-count.o builtin-diff.o builtin-push.o \ ++ builtin-grep.o GITLIBS = $(LIB_FILE) $(XDIFF_LIB) LIBS = $(GITLIBS) -lz @@@ -265,7 -263,6 +266,7 @@@ ifeq ($(uname_O),Cygwin NO_D_TYPE_IN_DIRENT = YesPlease NO_D_INO_IN_DIRENT = YesPlease NO_STRCASESTR = YesPlease + NO_SYMLINK_HEAD = YesPlease NEEDS_LIBICONV = YesPlease # There are conflicting reports about this. # On some boxes NO_MMAP is needed, and not so elsewhere. @@@ -286,9 -283,7 +287,9 @@@ ifeq ($(uname_S),OpenBSD ALL_LDFLAGS += -L/usr/local/lib endif ifeq ($(uname_S),NetBSD) - NEEDS_LIBICONV = YesPlease + ifeq ($(shell expr "$(uname_R)" : '[01]\.'),2) + NEEDS_LIBICONV = YesPlease + endif ALL_CFLAGS += -I/usr/pkg/include ALL_LDFLAGS += -L/usr/pkg/lib -Wl,-rpath,/usr/pkg/lib endif @@@ -322,6 -317,10 +323,6 @@@ els endif endif -ifdef WITH_SEND_EMAIL - SCRIPT_PERL += git-send-email.perl -endif - ifndef NO_CURL ifdef CURLDIR # This is still problematic -- gcc does not always want -R. @@@ -387,9 -386,6 +388,9 @@@ endi ifdef NO_D_INO_IN_DIRENT ALL_CFLAGS += -DNO_D_INO_IN_DIRENT endif +ifdef NO_SYMLINK_HEAD + ALL_CFLAGS += -DNO_SYMLINK_HEAD +endif ifdef NO_STRCASESTR COMPAT_CFLAGS += -DNO_STRCASESTR COMPAT_OBJS += compat/strcasestr.o @@@ -509,6 -505,9 +510,6 @@@ $(patsubst %.py,%,$(SCRIPT_PYTHON)) : git-cherry-pick: git-revert cp $< $@ -git-show: git-whatchanged - cp $< $@ - git-status: git-commit cp $< $@ @@@ -563,6 -562,10 +564,6 @@@ git-http-push$X: revision.o http.o http $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ $(LIBS) $(CURL_LIBCURL) $(EXPAT_LIBEXPAT) -git-rev-list$X: rev-list.o $(LIB_FILE) - $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \ - $(LIBS) $(OPENSSL_LIBSSL) - init-db.o: init-db.c $(CC) -c $(ALL_CFLAGS) \ -DDEFAULT_GIT_TEMPLATE_DIR='"$(template_dir_SQ)"' $*.c @@@ -606,7 -609,7 +607,7 @@@ test-date$X: test-date.c date.o ctype. $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) test-date.c date.o ctype.o test-delta$X: test-delta.c diff-delta.o patch-delta.o - $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $^ -lz + $(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $^ check: for i in *.c; do sparse $(ALL_CFLAGS) $(SPARSE_FLAGS) $$i || exit; done diff --combined builtin.h index bb63f0729a,cf5de3b931..7744f7d2f6 --- a/builtin.h +++ b/builtin.h @@@ -19,9 -19,6 +19,10 @@@ extern int cmd_version(int argc, const extern int cmd_whatchanged(int argc, const char **argv, char **envp); extern int cmd_show(int argc, const char **argv, char **envp); extern int cmd_log(int argc, const char **argv, char **envp); +extern int cmd_diff(int argc, const char **argv, char **envp); +extern int cmd_count_objects(int argc, const char **argv, char **envp); + +extern int cmd_push(int argc, const char **argv, char **envp); + extern int cmd_grep(int argc, const char **argv, char **envp); #endif diff --combined git.c index 49ba5189d9,893bddd768..a94d9ee5a7 --- a/git.c +++ b/git.c @@@ -46,9 -46,7 +46,10 @@@ static void handle_internal_command(in { "log", cmd_log }, { "whatchanged", cmd_whatchanged }, { "show", cmd_show }, + { "push", cmd_push }, + { "count-objects", cmd_count_objects }, + { "diff", cmd_diff }, + { "grep", cmd_grep }, }; int i;