From: Junio C Hamano Date: Sun, 20 Mar 2011 06:24:42 +0000 (-0700) Subject: Merge branch 'ab/i18n-basic' X-Git-Tag: v1.7.5-rc0~54 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/1e239079f704b840778c263f35f1e299565d4a49?ds=inline;hp=-c Merge branch 'ab/i18n-basic' * ab/i18n-basic: i18n: "make distclean" should clean up after "make pot" i18n: Makefile: "pot" target to extract messages marked for translation i18n: add stub Q_() wrapper for ngettext i18n: do not poison translations unless GIT_GETTEXT_POISON envvar is set i18n: add GETTEXT_POISON to simulate unfriendly translator i18n: add no-op _() and N_() wrappers commit, status: use status_printf{,_ln,_more} helpers commit: refer to commit template as s->fp wt-status: add helpers for printing wt-status lines Conflicts: builtin/commit.c --- 1e239079f704b840778c263f35f1e299565d4a49 diff --combined Makefile index 5c2b797554,749783511c..654d8ac7e1 --- a/Makefile +++ b/Makefile @@@ -216,6 -216,11 +216,11 @@@ all: # # Define NO_REGEX if you have no or inferior regex support in your C library. # + # Define GETTEXT_POISON if you are debugging the choice of strings marked + # for translation. In a GETTEXT_POISON build, you can turn all strings marked + # for translation into gibberish by setting the GIT_GETTEXT_POISON variable + # (to any value) in your environment. + # # Define JSMIN to point to JavaScript minifier that functions as # a filter to have gitweb.js minified. # @@@ -316,6 -321,7 +321,7 @@@ INSTALL = instal RPMBUILD = rpmbuild TCL_PATH = tclsh TCLTK_PATH = wish + XGETTEXT = xgettext PTHREAD_LIBS = -lpthread PTHREAD_CFLAGS = GCOV = gcov @@@ -515,6 -521,7 +521,7 @@@ LIB_H += diff. LIB_H += dir.h LIB_H += exec_cmd.h LIB_H += fsck.h + LIB_H += gettext.h LIB_H += git-compat-util.h LIB_H += graph.h LIB_H += grep.h @@@ -1042,7 -1049,6 +1049,7 @@@ ifeq ($(uname_S),HP-UX NO_UNSETENV = YesPlease NO_HSTRERROR = YesPlease NO_SYS_SELECT_H = YesPlease + NO_FNMATCH_CASEFOLD = YesPlease SNPRINTF_RETURNS_BOGUS = YesPlease NO_NSEC = YesPlease ifeq ($(uname_R),B.11.00) @@@ -1370,6 -1376,10 +1377,10 @@@ endi ifdef NO_SYMLINK_HEAD BASIC_CFLAGS += -DNO_SYMLINK_HEAD endif + ifdef GETTEXT_POISON + LIB_OBJS += gettext.o + BASIC_CFLAGS += -DGETTEXT_POISON + endif ifdef NO_STRCASESTR COMPAT_CFLAGS += -DNO_STRCASESTR COMPAT_OBJS += compat/strcasestr.o @@@ -1581,6 -1591,7 +1592,7 @@@ ifndef QUIET_BUILT_IN = @echo ' ' BUILTIN $@; QUIET_GEN = @echo ' ' GEN $@; QUIET_LNCP = @echo ' ' LN/CP $@; + QUIET_XGETTEXT = @echo ' ' XGETTEXT $@; QUIET_GCOV = @echo ' ' GCOV $@; QUIET_SUBDIR0 = +@subdir= QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ @@@ -2048,6 -2059,20 +2060,20 @@@ info pdf: $(MAKE) -C Documentation pdf + XGETTEXT_FLAGS = \ + --force-po \ + --add-comments \ + --msgid-bugs-address="Git Mailing List " \ + --from-code=UTF-8 + XGETTEXT_FLAGS_C = $(XGETTEXT_FLAGS) --keyword=_ --keyword=N_ --language=C + LOCALIZED_C := $(C_OBJ:o=c) + + po/git.pot: $(LOCALIZED_C) + $(QUIET_XGETTEXT)$(XGETTEXT) -o$@+ $(XGETTEXT_FLAGS_C) $(LOCALIZED_C) && \ + mv $@+ $@ + + pot: po/git.pot + $(ETAGS_TARGET): FORCE $(RM) $(ETAGS_TARGET) $(FIND) . -name '*.[hcS]' -print | xargs etags -a -o $(ETAGS_TARGET) @@@ -2089,6 -2114,7 +2115,7 @@@ endi ifdef GIT_TEST_CMP_USE_COPIED_CONTEXT @echo GIT_TEST_CMP_USE_COPIED_CONTEXT=YesPlease >>$@ endif + @echo GETTEXT_POISON=\''$(subst ','\'',$(subst ','\'',$(GETTEXT_POISON)))'\' >>$@ ### Detect Tck/Tk interpreter path changes ifndef NO_TCLTK @@@ -2314,6 -2340,7 +2341,7 @@@ dist-doc distclean: clean $(RM) configure + $(RM) po/git.pot clean: $(RM) *.o block-sha1/*.o ppc/*.o compat/*.o compat/*/*.o xdiff/*.o vcs-svn/*.o \ diff --combined cache.h index fad2117bf9,8188169ac6..be6ce7237d --- a/cache.h +++ b/cache.h @@@ -5,6 -5,7 +5,7 @@@ #include "strbuf.h" #include "hash.h" #include "advice.h" + #include "gettext.h" #include SHA1_HEADER #ifndef git_SHA_CTX @@@ -500,23 -501,8 +501,23 @@@ extern int index_name_is_other(const st extern int ie_match_stat(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); extern int ie_modified(const struct index_state *, struct cache_entry *, struct stat *, unsigned int); -extern int ce_path_match(const struct cache_entry *ce, const char **pathspec); -extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path); +struct pathspec { + const char **raw; /* get_pathspec() result, not freed by free_pathspec() */ + int nr; + unsigned int has_wildcard:1; + unsigned int recursive:1; + int max_depth; + struct pathspec_item { + const char *match; + int len; + unsigned int has_wildcard:1; + } *items; +}; + +extern int init_pathspec(struct pathspec *, const char **); +extern void free_pathspec(struct pathspec *); +extern int ce_path_match(const struct cache_entry *ce, const struct pathspec *pathspec); +extern int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object, enum object_type type, const char *path, int format_check); extern int index_path(unsigned char *sha1, const char *path, struct stat *st, int write_object); extern void fill_stat_cache_info(struct cache_entry *ce, struct stat *st); @@@ -560,6 -546,7 +561,6 @@@ extern int assume_unchanged extern int prefer_symlink_refs; extern int log_all_ref_updates; extern int warn_ambiguous_refs; -extern int unique_abbrev_extra_length; extern int shared_repository; extern const char *apply_default_whitespace; extern const char *apply_default_ignorewhitespace; @@@ -585,7 -572,7 +586,7 @@@ extern enum safe_crlf safe_crlf enum auto_crlf { AUTO_CRLF_FALSE = 0, AUTO_CRLF_TRUE = 1, - AUTO_CRLF_INPUT = -1, + AUTO_CRLF_INPUT = -1 }; extern enum auto_crlf auto_crlf; @@@ -622,7 -609,7 +623,7 @@@ enum rebase_setup_type enum push_default_type { PUSH_DEFAULT_NOTHING = 0, PUSH_DEFAULT_MATCHING, - PUSH_DEFAULT_TRACKING, + PUSH_DEFAULT_UPSTREAM, PUSH_DEFAULT_CURRENT }; @@@ -731,9 -718,9 +732,9 @@@ static inline int is_absolute_path(cons return path[0] == '/' || has_dos_drive_prefix(path); } int is_directory(const char *); -const char *make_absolute_path(const char *path); -const char *make_nonrelative_path(const char *path); -const char *make_relative_path(const char *abs, const char *base); +const char *real_path(const char *path); +const char *absolute_path(const char *path); +const char *relative_path(const char *abs, const char *base); int normalize_path_copy(char *dst, const char *src); int longest_ancestor_length(const char *path, const char *prefix_list); char *strip_path_suffix(const char *path, const char *suffix); @@@ -913,8 -900,7 +914,8 @@@ extern struct packed_git time_t mtime; int pack_fd; unsigned pack_local:1, - pack_keep:1; + pack_keep:1, + do_not_close:1; unsigned char sha1[20]; /* something like ".git/objects/pack/xxxxx.pack" */ char pack_name[FLEX_ARRAY]; /* more */ @@@ -1014,7 -1000,6 +1015,7 @@@ extern int git_config_maybe_bool(const extern int git_config_string(const char **, const char *, const char *); extern int git_config_pathname(const char **, const char *, const char *); extern int git_config_set(const char *, const char *); +extern int git_config_parse_key(const char *, char **, int *); extern int git_config_set_multivar(const char *, const char *, const char *, int); extern int git_config_rename_section(const char *, const char *); extern const char *git_etc_gitconfig(void); @@@ -1083,14 -1068,9 +1084,14 @@@ extern void alloc_report(void) /* trace.c */ __attribute__((format (printf, 1, 2))) extern void trace_printf(const char *format, ...); +extern void trace_vprintf(const char *key, const char *format, va_list ap); __attribute__((format (printf, 2, 3))) extern void trace_argv_printf(const char **argv, const char *format, ...); extern void trace_repo_setup(const char *prefix); +extern int trace_want(const char *key); +extern void trace_strbuf(const char *key, const struct strbuf *buf); + +void packet_trace_identity(const char *prog); /* convert.c */ /* returns 1 if *dst was used */