diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-09-14 21:20:40 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-09-14 21:20:40 -0700 |
commit | c336bc104c47cc9c2f7caf6bce468fe00a8f6850 (patch) | |
tree | 501143681bb20b9d4642e5029a77bec2d321482c | |
parent | e70d1632bdaf25a9ee528e78133cab319083eade (diff) | |
parent | bafc478f1618534fcb85bedc0fa224bd2d462441 (diff) | |
download | git-c336bc104c47cc9c2f7caf6bce468fe00a8f6850.tar.gz git-c336bc104c47cc9c2f7caf6bce468fe00a8f6850.tar.xz |
Sync with 1.7.11.7
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Documentation/RelNotes/1.7.11.7.txt | 46 | ||||
-rw-r--r-- | Documentation/git-checkout.txt | 12 | ||||
-rw-r--r-- | Documentation/git.txt | 3 | ||||
-rw-r--r-- | Documentation/gitcli.txt | 19 | ||||
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | builtin/commit.c | 17 | ||||
-rw-r--r-- | builtin/log.c | 2 | ||||
-rwxr-xr-x | gitk-git/gitk | 17 | ||||
-rw-r--r-- | ident.c | 6 | ||||
-rwxr-xr-x | t/t0070-fundamental.sh | 5 | ||||
-rwxr-xr-x | t/t7007-show.sh | 12 | ||||
-rw-r--r-- | test-regex.c | 20 |
13 files changed, 147 insertions, 14 deletions
diff --git a/.gitignore b/.gitignore index bb5c91e71..68fe46409 100644 --- a/.gitignore +++ b/.gitignore @@ -189,6 +189,7 @@ /test-mktemp /test-parse-options /test-path-utils +/test-regex /test-revision-walking /test-run-command /test-sha1 diff --git a/Documentation/RelNotes/1.7.11.7.txt b/Documentation/RelNotes/1.7.11.7.txt new file mode 100644 index 000000000..e7e79d999 --- /dev/null +++ b/Documentation/RelNotes/1.7.11.7.txt @@ -0,0 +1,46 @@ +Git v1.7.11.7 Release Notes +=========================== + +Fixes since v1.7.11.6 +--------------------- + + * The synopsis said "checkout [-B branch]" to make it clear the + branch name is a parameter to the option, but the heading for the + option description was "-B::", not "-B branch::", making the + documentation misleading. + + * Git ships with a fall-back regexp implementation for platforms with + buggy regexp library, but it was easy for people to keep using their + platform regexp. A new test has been added to check this. + + * "git apply -p0" did not parse pathnames on "diff --git" line + correctly. This caused patches that had pathnames in no other + places to be mistakenly rejected (most notably, binary patch that + does not rename nor change mode). Textual patches, renames or mode + changes have preimage and postimage pathnames in different places + in a form that can be parsed unambiguously and did not suffer from + this problem. + + * After "gitk" showed the contents of a tag, neither "Reread + references" nor "Reload" did not update what is shown as the + contents of it, when the user overwrote the tag with "git tag -f". + + * "git for-each-ref" did not currectly support more than one --sort + option. + + * "git log .." errored out saying it is both rev range and a path + when there is no disambiguating "--" is on the command line. + Update the command line parser to interpret ".." as a path in such + a case. + + * Pushing to smart HTTP server with recent Git fails without having + the username in the URL to force authentication, if the server is + configured to allow GET anonymously, while requiring authentication + for POST. + + * "git show --format='%ci'" did not give timestamp correctly for + commits created without human readable name on "committer" line. + (merge e27ddb6 jc/maint-ident-missing-human-name later to maint). + + * "git show --quiet" ought to be a synonym for "git show -s", but + wasn't. diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 11cc7f058..7958a4700 100644 --- a/Documentation/git-checkout.txt +++ b/Documentation/git-checkout.txt @@ -367,6 +367,18 @@ $ git checkout hello.c <3> <2> take a file out of another commit <3> restore hello.c from the index + +If you want to check out _all_ C source files out of the index, +you can say ++ +------------ +$ git checkout -- '*.c' +------------ ++ +Note the quotes around `*.c`. The file `hello.c` will also be +checked out, even though it is no longer in the working tree, +because the file globbing is used to match entries in the index +(not in the working tree by the shell). ++ If you have an unfortunate branch that is named `hello.c`, this step would be confused as an instruction to switch to that branch. You should instead write: diff --git a/Documentation/git.txt b/Documentation/git.txt index fab6e77e0..34d8a1bbd 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -48,9 +48,10 @@ Documentation for older releases are available here: * release notes for link:RelNotes/1.7.12.txt[1.7.12]. -* link:v1.7.11.6/git.html[documentation for release 1.7.11.6] +* link:v1.7.11.7/git.html[documentation for release 1.7.11.7] * release notes for + link:RelNotes/1.7.11.7.txt[1.7.11.7], link:RelNotes/1.7.11.6.txt[1.7.11.6], link:RelNotes/1.7.11.5.txt[1.7.11.5], link:RelNotes/1.7.11.4.txt[1.7.11.4], diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt index 3e72a5d68..f6ba90c2d 100644 --- a/Documentation/gitcli.txt +++ b/Documentation/gitcli.txt @@ -37,11 +37,28 @@ arguments. Here are the rules: file called HEAD in your work tree, `git diff HEAD` is ambiguous, and you have to say either `git diff HEAD --` or `git diff -- HEAD` to disambiguate. - ++ When writing a script that is expected to handle random user-input, it is a good practice to make it explicit which arguments are which by placing disambiguating `--` at appropriate places. + * Many commands allow wildcards in paths, but you need to protect + them from getting globbed by the shell. These two mean different + things: ++ +-------------------------------- +$ git checkout -- *.c +$ git checkout -- \*.c +-------------------------------- ++ +The former lets your shell expand the fileglob, and you are asking +the dot-C files in your working tree to be overwritten with the version +in the index. The latter passes the `*.c` to Git, and you are asking +the paths in the index that match the pattern to be checked out to your +working tree. After running `git add hello.c; rm hello.c`, you will _not_ +see `hello.c` in your working tree with the former, but with the latter +you will. + Here are the rules regarding the "flags" that you should follow when you are scripting git: @@ -496,6 +496,7 @@ TEST_PROGRAMS_NEED_X += test-mergesort TEST_PROGRAMS_NEED_X += test-mktemp TEST_PROGRAMS_NEED_X += test-parse-options TEST_PROGRAMS_NEED_X += test-path-utils +TEST_PROGRAMS_NEED_X += test-regex TEST_PROGRAMS_NEED_X += test-revision-walking TEST_PROGRAMS_NEED_X += test-run-command TEST_PROGRAMS_NEED_X += test-scrap-cache-tree diff --git a/builtin/commit.c b/builtin/commit.c index 20cef95d6..62028e7b4 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -478,6 +478,20 @@ static void export_one(const char *var, const char *s, const char *e, int hack) strbuf_release(&buf); } +static int sane_ident_split(struct ident_split *person) +{ + if (!person->name_begin || !person->name_end || + person->name_begin == person->name_end) + return 0; /* no human readable name */ + if (!person->mail_begin || !person->mail_end || + person->mail_begin == person->mail_end) + return 0; /* no usable mail */ + if (!person->date_begin || !person->date_end || + !person->tz_begin || !person->tz_end) + return 0; + return 1; +} + static void determine_author_info(struct strbuf *author_ident) { char *name, *email, *date; @@ -530,7 +544,8 @@ static void determine_author_info(struct strbuf *author_ident) if (force_date) date = force_date; strbuf_addstr(author_ident, fmt_ident(name, email, date, IDENT_STRICT)); - if (!split_ident_line(&author, author_ident->buf, author_ident->len)) { + if (!split_ident_line(&author, author_ident->buf, author_ident->len) && + sane_ident_split(&author)) { export_one("GIT_AUTHOR_NAME", author.name_begin, author.name_end, 0); export_one("GIT_AUTHOR_EMAIL", author.mail_begin, author.mail_end, 0); export_one("GIT_AUTHOR_DATE", author.date_begin, author.tz_end, '@'); diff --git a/builtin/log.c b/builtin/log.c index ecc279369..c22469cab 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -109,9 +109,9 @@ static void cmd_log_init_finish(int argc, const char **argv, const char *prefix, PARSE_OPT_KEEP_ARGV0 | PARSE_OPT_KEEP_UNKNOWN | PARSE_OPT_KEEP_DASHDASH); - argc = setup_revisions(argc, argv, rev, opt); if (quiet) rev->diffopt.output_format |= DIFF_FORMAT_NO_OUTPUT; + argc = setup_revisions(argc, argv, rev, opt); /* Any arguments at this point are not recognized */ if (argc > 1) diff --git a/gitk-git/gitk b/gitk-git/gitk index 22270ce46..6f24f53d2 100755 --- a/gitk-git/gitk +++ b/gitk-git/gitk @@ -2038,7 +2038,7 @@ proc makewindow {} { set file { mc "File" cascade { {mc "Update" command updatecommits -accelerator F5} - {mc "Reload" command reloadcommits -accelerator Meta1-F5} + {mc "Reload" command reloadcommits -accelerator Shift-F5} {mc "Reread references" command rereadrefs} {mc "List references" command showrefs -accelerator F2} {xx "" separator} @@ -2495,7 +2495,7 @@ proc makewindow {} { bindkey ? {dofind -1 1} bindkey f nextfile bind . <F5> updatecommits - bind . <$M1B-F5> reloadcommits + bind . <Shift-F5> reloadcommits bind . <F2> showrefs bind . <Shift-F4> {newview 0} catch { bind . <Shift-Key-XF86_Switch_VT_4> {newview 0} } @@ -10599,7 +10599,7 @@ proc movedhead {hid head} { } proc changedrefs {} { - global cached_dheads cached_dtags cached_atags + global cached_dheads cached_dtags cached_atags cached_tagcontent global arctags archeads arcnos arcout idheads idtags foreach id [concat [array names idheads] [array names idtags]] { @@ -10611,6 +10611,7 @@ proc changedrefs {} { } } } + catch {unset cached_tagcontent} catch {unset cached_dtags} catch {unset cached_atags} catch {unset cached_dheads} @@ -10663,7 +10664,7 @@ proc listrefs {id} { } proc showtag {tag isnew} { - global ctext tagcontents tagids linknum tagobjid + global ctext cached_tagcontent tagids linknum tagobjid if {$isnew} { addtohistory [list showtag $tag 0] savectextpos @@ -10672,13 +10673,13 @@ proc showtag {tag isnew} { clear_ctext settabs 0 set linknum 0 - if {![info exists tagcontents($tag)]} { + if {![info exists cached_tagcontent($tag)]} { catch { - set tagcontents($tag) [exec git cat-file tag $tag] + set cached_tagcontent($tag) [exec git cat-file tag $tag] } } - if {[info exists tagcontents($tag)]} { - set text $tagcontents($tag) + if {[info exists cached_tagcontent($tag)]} { + set text $cached_tagcontent($tag) } else { set text "[mc "Tag"]: $tag\n[mc "Id"]: $tagids($tag)" } @@ -210,8 +210,10 @@ int split_ident_line(struct ident_split *split, const char *line, int len) split->name_end = cp + 1; break; } - if (!split->name_end) - return status; + if (!split->name_end) { + /* no human readable name */ + split->name_end = split->name_begin; + } for (cp = split->mail_begin; cp < line + len; cp++) if (*cp == '>') { diff --git a/t/t0070-fundamental.sh b/t/t0070-fundamental.sh index 9bee8bfd2..da2c504e5 100755 --- a/t/t0070-fundamental.sh +++ b/t/t0070-fundamental.sh @@ -25,4 +25,9 @@ test_expect_success POSIXPERM 'mktemp to unwritable directory prints filename' ' grep "cannotwrite/test" err ' +test_expect_success 'check for a bug in the regex routines' ' + # if this test fails, re-build git with NO_REGEX=1 + test-regex +' + test_done diff --git a/t/t7007-show.sh b/t/t7007-show.sh index a40cd3630..e41fa00b8 100755 --- a/t/t7007-show.sh +++ b/t/t7007-show.sh @@ -108,4 +108,16 @@ test_expect_success 'showing range' ' test_cmp expect actual.filtered ' +test_expect_success '-s suppresses diff' ' + echo main3 >expect && + git show -s --format=%s main3 >actual && + test_cmp expect actual +' + +test_expect_success '--quiet suppresses diff' ' + echo main3 >expect && + git show --quiet --format=%s main3 >actual && + test_cmp expect actual +' + test_done diff --git a/test-regex.c b/test-regex.c new file mode 100644 index 000000000..b5bfd5413 --- /dev/null +++ b/test-regex.c @@ -0,0 +1,20 @@ +#include <git-compat-util.h> + +int main(int argc, char **argv) +{ + char *pat = "[^={} \t]+"; + char *str = "={}\nfred"; + regex_t r; + regmatch_t m[1]; + + if (regcomp(&r, pat, REG_EXTENDED | REG_NEWLINE)) + die("failed regcomp() for pattern '%s'", pat); + if (regexec(&r, str, 1, m, 0)) + die("no match of pattern '%s' to string '%s'", pat, str); + + /* http://sourceware.org/bugzilla/show_bug.cgi?id=3957 */ + if (m[0].rm_so == 3) /* matches '\n' when it should not */ + die("regex bug confirmed: re-build git with NO_REGEX=1"); + + exit(0); +} |