From: Junio C Hamano Date: Mon, 25 Mar 2013 20:46:42 +0000 (-0700) Subject: Merge branch 'maint-1.8.1' into maint X-Git-Tag: v1.8.2.1~47 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/f7b1ad870c46c53685ef83efbfd7d9ca1983a191?ds=inline;hp=-c Merge branch 'maint-1.8.1' into maint * maint-1.8.1: bundle: Add colons to list headings in "verify" bundle: Fix "verify" output if history is complete Documentation: filter-branch env-filter example git-filter-branch.txt: clarify ident variables usage git-compat-util.h: Provide missing netdb.h definitions describe: Document --match pattern format Documentation/githooks: Explain pre-rebase parameters update-index: list supported idx versions and their features diff-options: unconfuse description of --color read-cache.c: use INDEX_FORMAT_{LB,UB} in verify_hdr() index-format.txt: mention of v4 is missing in some places --- f7b1ad870c46c53685ef83efbfd7d9ca1983a191 diff --combined Documentation/diff-options.txt index 869d965a3b,bbfe8f8f35..104579dc75 --- a/Documentation/diff-options.txt +++ b/Documentation/diff-options.txt @@@ -55,26 -55,6 +55,26 @@@ endif::git-format-patch[ --histogram:: Generate a diff using the "histogram diff" algorithm. +--diff-algorithm={patience|minimal|histogram|myers}:: + Choose a diff algorithm. The variants are as follows: ++ +-- +`default`, `myers`;; + The basic greedy diff algorithm. Currently, this is the default. +`minimal`;; + Spend extra time to make sure the smallest possible diff is + produced. +`patience`;; + Use "patience diff" algorithm when generating patches. +`histogram`;; + This algorithm extends the patience algorithm to "support + low-occurrence common elements". +-- ++ +For instance, if you configured diff.algorithm variable to a +non-default value and want to use the default one, then you +have to use `--diff-algorithm=default` option. + --stat[=[,[,]]]:: Generate a diffstat. By default, as much space as necessary will be used for the filename part, and the rest for the graph @@@ -195,8 -175,8 +195,8 @@@ any of those replacements occurred --color[=]:: Show colored diff. - The value must be `always` (the default for ``), `never`, or `auto`. - The default value is `never`. + `--color` (i.e. without '=') is the same as `--color=always`. + '' can be one of `always`, `never`, or `auto`. ifdef::git-diff[] It can be changed by the `color.ui` and `color.diff` configuration settings. @@@ -303,7 -283,7 +303,7 @@@ few lines that happen to match textuall single deletion of everything old followed by a single insertion of everything new, and the number `m` controls this aspect of the -B option (defaults to 60%). `-B/70%` specifies that less than 30% of the -original should remain in the result for git to consider it a total +original should remain in the result for Git to consider it a total rewrite (i.e. otherwise the resulting patch will be a series of deletion and insertion mixed together with context lines). + @@@ -327,7 -307,7 +327,7 @@@ ifdef::git-log[ endif::git-log[] If `n` is specified, it is a threshold on the similarity index (i.e. amount of addition/deletions compared to the - file's size). For example, `-M90%` means git should consider a + file's size). For example, `-M90%` means Git should consider a delete/add pair to be a rename if more than 90% of the file hasn't changed. Without a `%` sign, the number is to be read as a fraction, with a decimal point before it. I.e., `-M5` becomes diff --combined Documentation/git-describe.txt index 32da244fd5,711040d2f1..3c81e85ec5 --- a/Documentation/git-describe.txt +++ b/Documentation/git-describe.txt @@@ -81,8 -81,9 +81,9 @@@ OPTION that points at object deadbee....). --match :: - Only consider tags matching the given pattern (can be used to avoid - leaking private tags made from the repository). + Only consider tags matching the given `glob(7)` pattern, + excluding the "refs/tags/" prefix. This can be used to avoid + leaking private tags from the repository. --always:: Show uniquely abbreviated commit object as fallback. @@@ -131,7 -132,7 +132,7 @@@ closest tagname without any suffix Note that the suffix you get if you type these commands today may be longer than what Linus saw above when he ran these commands, as your -git repository may have new commits whose object names begin with +Git repository may have new commits whose object names begin with 975b that did not exist back then, and "-g975b" suffix alone may not be sufficient to disambiguate these commits. diff --combined Documentation/git-filter-branch.txt index dfd12c94e4,69a40b2107..e4c8e82660 --- a/Documentation/git-filter-branch.txt +++ b/Documentation/git-filter-branch.txt @@@ -18,7 -18,7 +18,7 @@@ SYNOPSI DESCRIPTION ----------- -Lets you rewrite git revision history by rewriting the branches mentioned +Lets you rewrite Git revision history by rewriting the branches mentioned in the , applying custom filters on each revision. Those filters can modify each tree (e.g. removing a file or running a perl rewrite on all files) or information about each commit. @@@ -29,7 -29,7 +29,7 @@@ The command will only rewrite the _posi command line (e.g. if you pass 'a..b', only 'b' will be rewritten). If you specify no filters, the commits will be recommitted without any changes, which would normally have no effect. Nevertheless, this may be -useful in the future for compensating for some git bugs or such, +useful in the future for compensating for some Git bugs or such, therefore such a usage is permitted. *NOTE*: This command honors `.git/info/grafts` file and refs in @@@ -64,8 -64,11 +64,11 @@@ argument is always evaluated in the she Prior to that, the $GIT_COMMIT environment variable will be set to contain the id of the commit being rewritten. Also, GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_AUTHOR_DATE, GIT_COMMITTER_NAME, GIT_COMMITTER_EMAIL, - and GIT_COMMITTER_DATE are set according to the current commit. The values - of these variables after the filters have run, are used for the new commit. + and GIT_COMMITTER_DATE are taken from the current commit and exported to + the environment, in order to affect the author and committer identities of + the replacement commit created by linkgit:git-commit-tree[1] after the + filters have run. + If any evaluation of returns a non-zero exit status, the whole operation will be aborted. @@@ -329,6 -332,26 +332,26 @@@ git filter-branch --msg-filter ' HEAD~10..HEAD -------------------------------------------------------- + The `--env-filter` option can be used to modify committer and/or author + identity. For example, if you found out that your commits have the wrong + identity due to a misconfigured user.email, you can make a correction, + before publishing the project, like this: + + -------------------------------------------------------- + git filter-branch --env-filter ' + if test "$GIT_AUTHOR_EMAIL" = "root@localhost" + then + GIT_AUTHOR_EMAIL=john@example.com + export GIT_AUTHOR_EMAIL + fi + if test "$GIT_COMMITTER_EMAIL" = "root@localhost" + then + GIT_COMMITTER_EMAIL=john@example.com + export GIT_COMMITTER_EMAIL + fi + ' -- --all + -------------------------------------------------------- + To restrict rewriting to only part of the history, specify a revision range in addition to the new branch name. The new branch name will point to the top-most revision that a 'git rev-list' of this range @@@ -374,7 -397,7 +397,7 @@@ git-filter-branch is often used to get usually with some combination of `--index-filter` and `--subdirectory-filter`. People expect the resulting repository to be smaller than the original, but you need a few more steps to -actually make it smaller, because git tries hard not to lose your +actually make it smaller, because Git tries hard not to lose your objects until you tell it to. First make sure that: * You really removed all variants of a filename, if a blob was moved diff --combined Documentation/git-update-index.txt index 77a912d4ea,dd36d13285..c92775829b --- a/Documentation/git-update-index.txt +++ b/Documentation/git-update-index.txt @@@ -82,10 -82,10 +82,10 @@@ OPTION When these flags are specified, the object names recorded for the paths are not updated. Instead, these options set and unset the "assume unchanged" bit for the - paths. When the "assume unchanged" bit is on, git stops + paths. When the "assume unchanged" bit is on, Git stops checking the working tree files for possible modifications, so you need to manually unset the bit to - tell git when you change the working tree file. This is + tell Git when you change the working tree file. This is sometimes helpful when working with a big project on a filesystem that has very slow lstat(2) system call (e.g. cifs). @@@ -145,7 -145,15 +145,15 @@@ you will need to handle the situation m --index-version :: Write the resulting index out in the named on-disk format version. - The current default version is 2. + Supported versions are 2, 3 and 4. The current default version is 2 + or 3, depending on whether extra features are used, such as + `git add -N`. + + + Version 4 performs a simple pathname compression that reduces index + size by 30%-50% on large repositories, which results in faster load + time. Version 4 is relatively young (first released in in 1.8.0 in + October 2012). Other Git implementations such as JGit and libgit2 + may not support it yet. -z:: Only meaningful with `--stdin` or `--index-info`; paths are @@@ -253,18 -261,18 +261,18 @@@ $ git ls-files - Using ``assume unchanged'' bit ------------------------------ -Many operations in git depend on your filesystem to have an +Many operations in Git depend on your filesystem to have an efficient `lstat(2)` implementation, so that `st_mtime` information for working tree files can be cheaply checked to see if the file contents have changed from the version recorded in the index file. Unfortunately, some filesystems have inefficient `lstat(2)`. If your filesystem is one of them, you can set "assume unchanged" bit to paths you have not changed to -cause git not to do this check. Note that setting this bit on a -path does not mean git will check the contents of the file to -see if it has changed -- it makes git to omit any checking and +cause Git not to do this check. Note that setting this bit on a +path does not mean Git will check the contents of the file to +see if it has changed -- it makes Git to omit any checking and assume it has *not* changed. When you make changes to working -tree files, you have to explicitly tell git about it by dropping +tree files, you have to explicitly tell Git about it by dropping "assume unchanged" bit, either before or after you modify them. In order to set "assume unchanged" bit, use `--assume-unchanged` @@@ -274,7 -282,7 +282,7 @@@ have the "assume unchanged" bit set, us The command looks at `core.ignorestat` configuration variable. When this is true, paths updated with `git update-index paths...` and -paths updated with other git commands that update both index and +paths updated with other Git commands that update both index and working tree (e.g. 'git apply --index', 'git checkout-index -u', and 'git read-tree -u') are automatically marked as "assume unchanged". Note that "assume unchanged" bit is *not* set if diff --combined Documentation/githooks.txt index eab9b356cd,4eed86b2a4..dc6693fe48 --- a/Documentation/githooks.txt +++ b/Documentation/githooks.txt @@@ -3,7 -3,7 +3,7 @@@ githooks(5 NAME ---- -githooks - Hooks used by git +githooks - Hooks used by Git SYNOPSIS -------- @@@ -108,7 -108,7 +108,7 @@@ it is not suppressed by the `--no-verif means a failure of the hook and aborts the commit. It should not be used as replacement for pre-commit hook. -The sample `prepare-commit-msg` hook that comes with git comments +The sample `prepare-commit-msg` hook that comes with Git comments out the `Conflicts:` part of a merge's commit message. commit-msg @@@ -140,9 -140,11 +140,11 @@@ the outcome of 'git commit' pre-rebase ~~~~~~~~~~ - This hook is called by 'git rebase' and can be used to prevent a branch - from getting rebased. - + This hook is called by 'git rebase' and can be used to prevent a + branch from getting rebased. The hook may be called with one or + two parameters. The first parameter is the upstream from which + the series was forked. The second parameter is the branch being + rebased, and is not set when rebasing the current branch. post-checkout ~~~~~~~~~~~~~ @@@ -176,35 -178,6 +178,35 @@@ save and restore any form of metadata a (eg: permissions/ownership, ACLS, etc). See contrib/hooks/setgitperms.perl for an example of how to do this. +pre-push +~~~~~~~~ + +This hook is called by 'git push' and can be used to prevent a push from taking +place. The hook is called with two parameters which provide the name and +location of the destination remote, if a named remote is not being used both +values will be the same. + +Information about what is to be pushed is provided on the hook's standard +input with lines of the form: + + SP SP SP LF + +For instance, if the command +git push origin master:foreign+ were run the +hook would receive a line like the following: + + refs/heads/master 67890 refs/heads/foreign 12345 + +although the full, 40-character SHA1s would be supplied. If the foreign ref +does not yet exist the `` will be 40 `0`. If a ref is to be +deleted, the `` will be supplied as `(delete)` and the `` will be 40 `0`. If the local commit was specified by something other +than a name which could be expanded (such as `HEAD~`, or a SHA1) it will be +supplied as it was originally given. + +If this hook exits with a non-zero status, 'git push' will abort without +pushing anything. Information about why the push is rejected may be sent +to the user by writing to standard error. + [[pre-receive]] pre-receive ~~~~~~~~~~~ @@@ -304,7 -277,7 +306,7 @@@ for the user The default 'post-receive' hook is empty, but there is a sample script `post-receive-email` provided in the `contrib/hooks` -directory in git distribution, which implements sending commit +directory in Git distribution, which implements sending commit emails. [[post-update]] @@@ -332,7 -305,7 +334,7 @@@ them When enabled, the default 'post-update' hook runs 'git update-server-info' to keep the information used by dumb transports (e.g., HTTP) up-to-date. If you are publishing -a git repository that is accessible via HTTP, you should +a Git repository that is accessible via HTTP, you should probably enable this hook. Both standard output and standard error output are forwarded to diff --combined Documentation/technical/index-format.txt index 27c716b15f,dcd51b97d9..0810251f5a --- a/Documentation/technical/index-format.txt +++ b/Documentation/technical/index-format.txt @@@ -1,7 -1,7 +1,7 @@@ -GIT index format +Git index format ================ -== The git index file has the following format +== The Git index file has the following format All binary numbers are in network byte order. Version 2 is described here unless stated otherwise. @@@ -12,7 -12,7 +12,7 @@@ The signature is { 'D', 'I', 'R', 'C' } (stands for "dircache") 4-byte version number: - The current supported versions are 2 and 3. + The current supported versions are 2, 3 and 4. 32-bit number of index entries. @@@ -21,9 -21,9 +21,9 @@@ - Extensions Extensions are identified by signature. Optional extensions can - be ignored if GIT does not understand them. + be ignored if Git does not understand them. - GIT currently supports cached tree and resolve undo extensions. + Git currently supports cached tree and resolve undo extensions. 4-byte extension signature. If the first byte is 'A'..'Z' the extension is optional and can be ignored. @@@ -93,8 -93,8 +93,8 @@@ 12-bit name length if the length is less than 0xFFF; otherwise 0xFFF is stored in this field. - (Version 3) A 16-bit field, only applicable if the "extended flag" - above is 1, split into (high to low bits). + (Version 3 or later) A 16-bit field, only applicable if the + "extended flag" above is 1, split into (high to low bits). 1-bit reserved for future diff --combined git-compat-util.h index b636e0dd0c,9c01e9bc2e..e715285e7c --- a/git-compat-util.h +++ b/git-compat-util.h @@@ -75,7 -75,7 +75,7 @@@ # endif #elif !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__USLC__) && \ !defined(_M_UNIX) && !defined(__sgi) && !defined(__DragonFly__) && \ - !defined(__TANDEM) + !defined(__TANDEM) && !defined(__QNX__) #define _XOPEN_SOURCE 600 /* glibc2 and AIX 5.3L need 500, OpenBSD needs 600 for S_ISLNK() */ #define _XOPEN_SOURCE_EXTENDED 1 /* AIX 5.3L needs this */ #endif @@@ -99,22 -99,18 +99,22 @@@ #include #include #include -#ifdef __TANDEM /* or HAVE_STRINGS_H or !NO_STRINGS_H? */ +#ifdef HAVE_STRINGS_H #include /* for strcasecmp() */ #endif #include #include +#ifdef NEEDS_SYS_PARAM_H #include +#endif #include #include #include #include #include +#ifndef USE_WILDMATCH #include +#endif #include #include #include @@@ -213,6 -209,17 +213,17 @@@ extern char *gitbasename(char *) #include #endif + /* On most systems would have given us this, but + * not on some systems (e.g. z/OS). + */ + #ifndef NI_MAXHOST + #define NI_MAXHOST 1025 + #endif + + #ifndef NI_MAXSERV + #define NI_MAXSERV 32 + #endif + /* On most systems would have given us this, but * not on some systems (e.g. GNU/Hurd). */ @@@ -282,17 -289,6 +293,17 @@@ #include "compat/bswap.h" +#ifdef USE_WILDMATCH +#include "wildmatch.h" +#define FNM_PATHNAME WM_PATHNAME +#define FNM_CASEFOLD WM_CASEFOLD +#define FNM_NOMATCH WM_NOMATCH +static inline int fnmatch(const char *pattern, const char *string, int flags) +{ + return wildmatch(pattern, string, flags, NULL); +} +#endif + /* General helper functions */ extern void vreportf(const char *prefix, const char *err, va_list params); extern void vwritef(int fd, const char *prefix, const char *err, va_list params); @@@ -303,17 -299,6 +314,17 @@@ extern NORETURN void die_errno(const ch extern int error(const char *err, ...) __attribute__((format (printf, 1, 2))); extern void warning(const char *err, ...) __attribute__((format (printf, 1, 2))); +/* + * Let callers be aware of the constant return value; this can help + * gcc with -Wuninitialized analysis. We restrict this trick to gcc, though, + * because some compilers may not support variadic macros. Since we're only + * trying to help gcc, anyway, it's OK; other compilers will fall back to + * using the function as usual. + */ +#if defined(__GNUC__) && ! defined(__clang__) +#define error(...) (error(__VA_ARGS__), -1) +#endif + extern void set_die_routine(NORETURN_PTR void (*routine)(const char *err, va_list params)); extern void set_error_routine(void (*routine)(const char *err, va_list params)); @@@ -421,6 -406,11 +432,6 @@@ extern uintmax_t gitstrtoumax(const cha extern intmax_t gitstrtoimax(const char *, char **, int); #endif -#ifdef NO_STRTOK_R -#define strtok_r gitstrtok_r -extern char *gitstrtok_r(char *s, const char *delim, char **save_ptr); -#endif - #ifdef NO_HSTRERROR #define hstrerror githstrerror extern const char *githstrerror(int herror); @@@ -432,10 -422,6 +443,10 @@@ void *gitmemmem(const void *haystack, s const void *needle, size_t needlelen); #endif +#ifdef NO_GETPAGESIZE +#define getpagesize() sysconf(_SC_PAGESIZE) +#endif + #ifdef FREAD_READS_DIRECTORIES #ifdef fopen #undef fopen @@@ -536,19 -522,13 +547,19 @@@ extern const char tolower_trans_tbl[256 #undef isupper #undef tolower #undef toupper -extern unsigned char sane_ctype[256]; +#undef iscntrl +#undef ispunct +#undef isxdigit + +extern const unsigned char sane_ctype[256]; #define GIT_SPACE 0x01 #define GIT_DIGIT 0x02 #define GIT_ALPHA 0x04 #define GIT_GLOB_SPECIAL 0x08 #define GIT_REGEX_SPECIAL 0x10 #define GIT_PATHSPEC_MAGIC 0x20 +#define GIT_CNTRL 0x40 +#define GIT_PUNCT 0x80 #define sane_istest(x,mask) ((sane_ctype[(unsigned char)(x)] & (mask)) != 0) #define isascii(x) (((x) & ~0x7f) == 0) #define isspace(x) sane_istest(x,GIT_SPACE) @@@ -560,10 -540,6 +571,10 @@@ #define isupper(x) sane_iscase(x, 0) #define is_glob_special(x) sane_istest(x,GIT_GLOB_SPECIAL) #define is_regex_special(x) sane_istest(x,GIT_GLOB_SPECIAL | GIT_REGEX_SPECIAL) +#define iscntrl(x) (sane_istest(x,GIT_CNTRL)) +#define ispunct(x) sane_istest(x, GIT_PUNCT | GIT_REGEX_SPECIAL | \ + GIT_GLOB_SPECIAL | GIT_PATHSPEC_MAGIC) +#define isxdigit(x) (hexval_table[x] != -1) #define tolower(x) sane_case((unsigned char)(x), 0x20) #define toupper(x) sane_case((unsigned char)(x), 0) #define is_pathspec_magic(x) sane_istest(x,GIT_PATHSPEC_MAGIC) diff --combined read-cache.c index 827ae55c50,5cddbc325f..670a06bc79 --- a/read-cache.c +++ b/read-cache.c @@@ -197,25 -197,21 +197,25 @@@ static int ce_match_stat_basic(struct c } if (ce->ce_mtime.sec != (unsigned int)st->st_mtime) changed |= MTIME_CHANGED; - if (trust_ctime && ce->ce_ctime.sec != (unsigned int)st->st_ctime) + if (trust_ctime && check_stat && + ce->ce_ctime.sec != (unsigned int)st->st_ctime) changed |= CTIME_CHANGED; #ifdef USE_NSEC - if (ce->ce_mtime.nsec != ST_MTIME_NSEC(*st)) + if (check_stat && ce->ce_mtime.nsec != ST_MTIME_NSEC(*st)) changed |= MTIME_CHANGED; - if (trust_ctime && ce->ce_ctime.nsec != ST_CTIME_NSEC(*st)) + if (trust_ctime && check_stat && + ce->ce_ctime.nsec != ST_CTIME_NSEC(*st)) changed |= CTIME_CHANGED; #endif - if (ce->ce_uid != (unsigned int) st->st_uid || - ce->ce_gid != (unsigned int) st->st_gid) - changed |= OWNER_CHANGED; - if (ce->ce_ino != (unsigned int) st->st_ino) - changed |= INODE_CHANGED; + if (check_stat) { + if (ce->ce_uid != (unsigned int) st->st_uid || + ce->ce_gid != (unsigned int) st->st_gid) + changed |= OWNER_CHANGED; + if (ce->ce_ino != (unsigned int) st->st_ino) + changed |= INODE_CHANGED; + } #ifdef USE_STDEV /* @@@ -223,8 -219,8 +223,8 @@@ * clients will have different views of what "device" * the filesystem is on */ - if (ce->ce_dev != (unsigned int) st->st_dev) - changed |= INODE_CHANGED; + if (check_stat && ce->ce_dev != (unsigned int) st->st_dev) + changed |= INODE_CHANGED; #endif if (ce->ce_size != (unsigned int) st->st_size) @@@ -1260,7 -1256,7 +1260,7 @@@ static int verify_hdr(struct cache_head if (hdr->hdr_signature != htonl(CACHE_SIGNATURE)) return error("bad signature"); hdr_version = ntohl(hdr->hdr_version); - if (hdr_version < 2 || 4 < hdr_version) + if (hdr_version < INDEX_FORMAT_LB || INDEX_FORMAT_UB < hdr_version) return error("bad index version %d", hdr_version); git_SHA1_Init(&c); git_SHA1_Update(&c, hdr, size - 20);