Skip to content

Commit

Permalink
Sync with 1.7.11.7
Browse files Browse the repository at this point in the history
  • Loading branch information
Junio C Hamano committed Sep 15, 2012
2 parents e70d163 + bafc478 commit c336bc1
Show file tree
Hide file tree
Showing 13 changed files with 147 additions and 14 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,7 @@
/test-mktemp
/test-parse-options
/test-path-utils
/test-regex
/test-revision-walking
/test-run-command
/test-sha1
Expand Down
46 changes: 46 additions & 0 deletions Documentation/RelNotes/1.7.11.7.txt
Original file line number Diff line number Diff line change
@@ -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.
12 changes: 12 additions & 0 deletions Documentation/git-checkout.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion Documentation/git.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
19 changes: 18 additions & 1 deletion Documentation/gitcli.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
17 changes: 16 additions & 1 deletion builtin/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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, '@');
Expand Down
2 changes: 1 addition & 1 deletion builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
17 changes: 9 additions & 8 deletions gitk-git/gitk
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -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} }
Expand Down Expand Up @@ -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]] {
Expand All @@ -10611,6 +10611,7 @@ proc changedrefs {} {
}
}
}
catch {unset cached_tagcontent}
catch {unset cached_dtags}
catch {unset cached_atags}
catch {unset cached_dheads}
Expand Down Expand Up @@ -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
Expand All @@ -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)"
}
Expand Down
6 changes: 4 additions & 2 deletions ident.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 == '>') {
Expand Down
5 changes: 5 additions & 0 deletions t/t0070-fundamental.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 12 additions & 0 deletions t/t7007-show.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
20 changes: 20 additions & 0 deletions test-regex.c
Original file line number Diff line number Diff line change
@@ -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);
}

0 comments on commit c336bc1

Please sign in to comment.