From a135f214e371311f13807da637d492fd9642a2e3 Mon Sep 17 00:00:00 2001 From: Felipe Contreras Date: Sat, 7 Apr 2012 03:29:38 +0300 Subject: gitk: Avoid Meta1-F5 Meta1-F5 is commonly mapped by window managers and what not. Use Shift-F5 instead. Signed-off-by: Felipe Contreras Signed-off-by: Paul Mackerras --- gitk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gitk b/gitk index 22270ce46..9bba9aa8d 100755 --- a/gitk +++ b/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 . updatecommits - bind . <$M1B-F5> reloadcommits + bind . reloadcommits bind . showrefs bind . {newview 0} catch { bind . {newview 0} } -- cgit v1.2.1 From f9c75d858d85449a8a6f635bef4b5bd003edd764 Mon Sep 17 00:00:00 2001 From: Jeff King Date: Tue, 28 Aug 2012 17:29:34 -0400 Subject: log: fix --quiet synonym for -s Originally the "--quiet" option was parsed by the diff-option parser into the internal QUICK option. This had the effect of silencing diff output from the log (which was not intended, but happened to work and people started to use it). But it also had other odd side effects at the diff level (for example, it would suppress the second commit in "git show A B"). To fix this, commit 1c40c36 converted log to parse-options and handled the "quiet" option separately, not passing it on to the diff code. However, it simply ignored the option, which was a regression for people using it as a synonym for "-s". Commit 01771a8 then fixed that by interpreting the option to add DIFF_FORMAT_NO_OUTPUT to the list of output formats. However, that commit did not fix it in all cases. It sets the flag after setup_revisions is called. Naively, this makes sense because you would expect the setup_revisions parser to overwrite our output format flag if "-p" or another output format flag is seen. However, that is not how the NO_OUTPUT flag works. We actually store it in the bit-field as just another format. At the end of setup_revisions, we call diff_setup_done, which post-processes the bitfield and clears any other formats if we have set NO_OUTPUT. By setting the flag after setup_revisions is done, diff_setup_done does not have a chance to make this tweak, and we end up with other format options still set. As a result, the flag would have no effect in "git log -p --quiet" or "git show --quiet". Fix it by setting the format flag before the call to setup_revisions. Signed-off-by: Jeff King Signed-off-by: Junio C Hamano --- builtin/log.c | 2 +- t/t7007-show.sh | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/builtin/log.c b/builtin/log.c index 54f24e208..a8249d3c0 100644 --- a/builtin/log.c +++ b/builtin/log.c @@ -108,9 +108,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/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 -- cgit v1.2.1 From e27ddb64568412b75035a05366c9f091153155ed Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 31 Aug 2012 14:54:18 -0700 Subject: split_ident_line(): make best effort when parsing author/committer line Commits made by ancient version of Git allowed committer without human readable name, like this (00213b17c in the kernel history): tree 6947dba41f8b0e7fe7bccd41a4840d6de6a27079 parent 352dd1df32e672be4cff71132eb9c06a257872fe author Petr Baudis 1135223044 +0100 committer 1136151043 +0100 kconfig: Remove support for lxdialog --checklist ... Signed-off-by: Petr Baudis Signed-off-by: Sam Ravnborg When fed such a commit, --format='%ci' fails to parse it, and gives back an empty string. Update the split_ident_line() to be a bit more lenient when parsing, but make sure the caller that wants to pick up sane value from its return value does its own validation. Signed-off-by: Junio C Hamano --- builtin/commit.c | 17 ++++++++++++++++- ident.c | 6 ++++-- 2 files changed, 20 insertions(+), 3 deletions(-) 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/ident.c b/ident.c index 443c0751b..484e0a980 100644 --- a/ident.c +++ b/ident.c @@ -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 == '>') { -- cgit v1.2.1 From c91841594c2f08bec0c8b2d46da27add18fb4854 Mon Sep 17 00:00:00 2001 From: Ramsay Jones Date: Sat, 1 Sep 2012 18:46:54 +0100 Subject: test-regex: Add a test to check for a bug in the regex routines Signed-off-by: Ramsay Jones Signed-off-by: Junio C Hamano --- .gitignore | 1 + Makefile | 1 + t/t0070-fundamental.sh | 5 +++++ test-regex.c | 20 ++++++++++++++++++++ 4 files changed, 27 insertions(+) create mode 100644 test-regex.c diff --git a/.gitignore b/.gitignore index 3b7680ea1..d284b058a 100644 --- a/.gitignore +++ b/.gitignore @@ -184,6 +184,7 @@ /test-obj-pool /test-parse-options /test-path-utils +/test-regex /test-run-command /test-sha1 /test-sigchain diff --git a/Makefile b/Makefile index e4f8e0ef0..d2b145b53 100644 --- a/Makefile +++ b/Makefile @@ -476,6 +476,7 @@ TEST_PROGRAMS_NEED_X += test-mktemp TEST_PROGRAMS_NEED_X += test-obj-pool 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-run-command TEST_PROGRAMS_NEED_X += test-sha1 TEST_PROGRAMS_NEED_X += test-sigchain 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/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 + +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); +} -- cgit v1.2.1 From caae319e49e236205d463de2ecf24ce5aae642ab Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 4 Sep 2012 08:28:27 -0700 Subject: Document file-glob for "git checkout -- '*.c'" Just like we give a similar example in "git add" documentation. Signed-off-by: Junio C Hamano --- Documentation/git-checkout.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt index 63a251612..5634efffa 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: -- cgit v1.2.1 From 9b5bdf5913f850d1fc72c4219f794e2de549957f Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 8 Sep 2012 12:03:13 -0700 Subject: gitk: Teach "Reread references" to reload tags Tag contents, once read, are forever cached in memory. This makes gitk unable to notice when tag contents change. Allow users to cause a reload of the tag contents by using the "File->Reread references" action. Reported-by: Tim McCormack Suggested-by: Junio C Hamano Signed-off-by: David Aguilar Signed-off-by: Junio C Hamano --- gitk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gitk b/gitk index 9bba9aa8d..a12482262 100755 --- a/gitk +++ b/gitk @@ -10599,7 +10599,7 @@ proc movedhead {hid head} { } proc changedrefs {} { - global cached_dheads cached_dtags cached_atags + global cached_dheads cached_dtags cached_atags tagcontents global arctags archeads arcnos arcout idheads idtags foreach id [concat [array names idheads] [array names idtags]] { @@ -10611,6 +10611,7 @@ proc changedrefs {} { } } } + catch {unset tagcontents} catch {unset cached_dtags} catch {unset cached_atags} catch {unset cached_dheads} -- cgit v1.2.1 From 587277fea3bf3bfc4302480178bd88a277a69f05 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Sat, 8 Sep 2012 12:53:16 -0700 Subject: gitk: Rename 'tagcontents' to 'cached_tagcontent' Name the 'tagcontents' variable similarly to the rest of the variables cleared in the changedrefs() function. This makes the naming consistent and provides a hint that it should be cleared when reloading gitk's cache. Suggested-by: Junio C Hamano Signed-off-by: David Aguilar Signed-off-by: Junio C Hamano --- gitk | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gitk b/gitk index a12482262..6f24f53d2 100755 --- a/gitk +++ b/gitk @@ -10599,7 +10599,7 @@ proc movedhead {hid head} { } proc changedrefs {} { - global cached_dheads cached_dtags cached_atags tagcontents + 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,7 +10611,7 @@ proc changedrefs {} { } } } - catch {unset tagcontents} + catch {unset cached_tagcontent} catch {unset cached_dtags} catch {unset cached_atags} catch {unset cached_dheads} @@ -10664,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 @@ -10673,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)" } -- cgit v1.2.1 From 008566e0f8ef9751c43197f40ac08d3bdfce78a7 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Mon, 10 Sep 2012 12:47:38 -0700 Subject: gitcli: formatting fix The paragraph to encourage use of "--" in scripts belongs to the bullet point that describes the behaviour for a command line without the explicit "--" disambiguation; it is not a supporting explanation for the entire bulletted list, and it is wrong to make it a separate paragraph outside the list. Signed-off-by: Junio C Hamano --- Documentation/gitcli.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt index ea17f7a53..c4edf042d 100644 --- a/Documentation/gitcli.txt +++ b/Documentation/gitcli.txt @@ -37,7 +37,7 @@ 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. -- cgit v1.2.1 From 8300016e0ab6959c4b45f64ec585832726430fc7 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 7 Sep 2012 13:49:15 -0700 Subject: gitcli: contrast wildcard given to shell and to git People who are not used to working with shell may intellectually understand how the command line argument is massaged by the shell but still have a hard time visualizing the difference between letting the shell expand fileglobs and having Git see the fileglob to use as a pathspec. Signed-off-by: Junio C Hamano --- Documentation/gitcli.txt | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/Documentation/gitcli.txt b/Documentation/gitcli.txt index c4edf042d..00b840322 100644 --- a/Documentation/gitcli.txt +++ b/Documentation/gitcli.txt @@ -42,6 +42,23 @@ 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: -- cgit v1.2.1 From bafc478f1618534fcb85bedc0fa224bd2d462441 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 14 Sep 2012 20:57:23 -0700 Subject: Git 1.7.11.7 Signed-off-by: Junio C Hamano --- Documentation/RelNotes/1.7.11.7.txt | 46 +++++++++++++++++++++++++++++++++++++ Documentation/git.txt | 3 ++- GIT-VERSION-GEN | 2 +- RelNotes | 2 +- 4 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 Documentation/RelNotes/1.7.11.7.txt 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.txt b/Documentation/git.txt index 165d13ad2..65c37c454 100644 --- a/Documentation/git.txt +++ b/Documentation/git.txt @@ -44,9 +44,10 @@ unreleased) version of git, that is available from 'master' branch of the `git.git` repository. Documentation for older releases are available here: -* 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/GIT-VERSION-GEN b/GIT-VERSION-GEN index 754b94e0d..28f12902a 100755 --- a/GIT-VERSION-GEN +++ b/GIT-VERSION-GEN @@ -1,7 +1,7 @@ #!/bin/sh GVF=GIT-VERSION-FILE -DEF_VER=v1.7.11.6 +DEF_VER=v1.7.11.7 LF=' ' diff --git a/RelNotes b/RelNotes index d04f1ae46..6205f6cd4 120000 --- a/RelNotes +++ b/RelNotes @@ -1 +1 @@ -Documentation/RelNotes/1.7.11.6.txt \ No newline at end of file +Documentation/RelNotes/1.7.11.7.txt \ No newline at end of file -- cgit v1.2.1