From: Junio C Hamano Date: Sat, 18 Mar 2006 22:58:20 +0000 (-0800) Subject: Merge branch 'master' into next X-Git-Tag: v1.3.0-rc1~19 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b7986ce884a6c23e3776658904879df1d6193668?hp=-c Merge branch 'master' into next * master: Makefile: Add TAGS and tags targets ls-files: Don't require exclude files to end with a newline. --- b7986ce884a6c23e3776658904879df1d6193668 diff --combined Makefile index 0bdf03b7de,8d45378b68..236bac1f25 --- a/Makefile +++ b/Makefile @@@ -190,7 -190,7 +190,7 @@@ PYMODULES = LIB_FILE=libgit.a LIB_H = \ - blob.h cache.h commit.h count-delta.h csum-file.h delta.h \ + blob.h cache.h commit.h csum-file.h delta.h \ diff.h object.h pack.h pkt-line.h quote.h refs.h \ run-command.h strbuf.h tag.h tree.h git-compat-util.h revision.h @@@ -200,7 -200,7 +200,7 @@@ DIFF_OBJS = diffcore-delta.o LIB_OBJS = \ - blob.o commit.o connect.o count-delta.o csum-file.o \ + blob.o commit.o connect.o csum-file.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 \ @@@ -553,6 -553,13 +553,13 @@@ $(LIB_FILE): $(LIB_OBJS doc: $(MAKE) -C Documentation all + TAGS: + rm -f TAGS + find . -name '*.[hcS]' -print | xargs etags -a + + tags: + rm -f tags + find . -name '*.[hcS]' -print | xargs ctags -a ### Testing rules @@@ -617,7 -624,7 +624,7 @@@ rpm: dis clean: rm -f *.o mozilla-sha1/*.o arm/*.o ppc/*.o compat/*.o $(LIB_FILE) rm -f $(ALL_PROGRAMS) git$X - rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h + rm -f *.spec *.pyc *.pyo */*.pyc */*.pyo common-cmds.h TAGS tags rm -rf $(GIT_TARNAME) rm -f $(GIT_TARNAME).tar.gz git-core_$(GIT_VERSION)-*.tar.gz $(MAKE) -C Documentation/ clean @@@ -626,5 -633,5 +633,5 @@@ rm -f GIT-VERSION-FILE .PHONY: all install clean strip - .PHONY: .FORCE-GIT-VERSION-FILE + .PHONY: .FORCE-GIT-VERSION-FILE TAGS tags diff --combined ls-files.c index 585f6a7ff2,e42119c5ee..3a17e5d8e0 --- a/ls-files.c +++ b/ls-files.c @@@ -11,7 -11,6 +11,7 @@@ #include "cache.h" #include "quote.h" +static int abbrev = 0; static int show_deleted = 0; static int show_cached = 0; static int show_others = 0; @@@ -93,11 -92,12 +93,12 @@@ static int add_excludes_from_file_1(con close(fd); return 0; } - buf = xmalloc(size); + buf = xmalloc(size+1); if (read(fd, buf, size) != size) goto err; close(fd); + buf[size++] = '\n'; entry = buf; for (i = 0; i < size; i++) { if (buf[i] == '\n') { @@@ -489,8 -489,7 +490,8 @@@ static void show_ce_entry(const char *t printf("%s%06o %s %d\t", tag, ntohl(ce->ce_mode), - sha1_to_hex(ce->sha1), + abbrev ? find_unique_abbrev(ce->sha1,abbrev) + : sha1_to_hex(ce->sha1), ce_stage(ce)); write_name_quoted("", 0, ce->name + offset, line_terminator, stdout); @@@ -631,8 -630,7 +632,8 @@@ static void verify_pathspec(void static const char ls_files_usage[] = "git-ls-files [-z] [-t] [-v] (--[cached|deleted|others|stage|unmerged|killed|modified])* " "[ --ignored ] [--exclude=] [--exclude-from=] " - "[ --exclude-per-directory= ] [--full-name] [--] []*"; + "[ --exclude-per-directory= ] [--full-name] [--abbrev] " + "[--] []*"; int main(int argc, const char **argv) { @@@ -739,18 -737,6 +740,18 @@@ error_unmatch = 1; continue; } + if (!strncmp(arg, "--abbrev=", 9)) { + abbrev = strtoul(arg+9, NULL, 10); + if (abbrev && abbrev < MINIMUM_ABBREV) + abbrev = MINIMUM_ABBREV; + else if (abbrev > 40) + abbrev = 40; + continue; + } + if (!strcmp(arg, "--abbrev")) { + abbrev = DEFAULT_ABBREV; + continue; + } if (*arg == '-') usage(ls_files_usage); break;