Commit graph

25753 commits

Author SHA1 Message Date
Junio C Hamano 0a2a5d889d Merge branch 'jc/require-work-tree-exists'
* jc/require-work-tree-exists:
  require-work-tree wants more than what its name says
2011-05-26 10:31:47 -07:00
Junio C Hamano 1dcfb2ac65 Sync with 1.7.5.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 10:30:28 -07:00
Junio C Hamano 3c3e0b3c41 Git 1.7.5.3
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 10:29:29 -07:00
Junio C Hamano 5a6d82d086 Merge branch 'maint-1.7.4' into maint
* maint-1.7.4:
2011-05-26 10:29:24 -07:00
Junio C Hamano bac9c06ba0 Merge branch 'jk/git-connection-deadlock-fix' into maint-1.7.4
* jk/git-connection-deadlock-fix:
  test core.gitproxy configuration
  send-pack: avoid deadlock on git:// push with failed pack-objects
  connect: let callers know if connection is a socket
  connect: treat generic proxy processes like ssh processes

Conflicts:
	connect.c
2011-05-26 10:28:10 -07:00
Junio C Hamano 34df9fe36a Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint-1.7.4
* js/maint-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt
  send-pack: unbreak push over stateless rpc
  send-pack: avoid deadlock when pack-object dies early
2011-05-26 10:27:55 -07:00
Junio C Hamano 420147290d Merge branch 'jk/maint-upload-pack-shallow' into maint-1.7.4
* jk/maint-upload-pack-shallow:
  upload-pack: start pack-objects before async rev-list
2011-05-26 10:27:29 -07:00
Junio C Hamano d9ac3e41c3 Merge branch 'jm/maint-diff-words-with-sbe' into maint
* jm/maint-diff-words-with-sbe:
  do not read beyond end of malloc'd buffer
2011-05-26 09:43:00 -07:00
Junio C Hamano 05318994e7 Merge branch 'kk/maint-prefix-in-config-mak' into maint
* kk/maint-prefix-in-config-mak:
  Honor $(prefix) set in config.mak* when defining ETC_GIT*
  Revert "Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir"
  Honor $(prefix) set in config.mak* when defining ETC_GIT* and sysconfdir
2011-05-26 09:42:12 -07:00
Junio C Hamano 5f8937db39 Merge branch 'mg/diff-uiconfig-doc' into maint
* mg/diff-uiconfig-doc:
  config.txt,diff-options.txt: porcelain vs. plumbing for color.diff
2011-05-26 09:41:11 -07:00
Junio C Hamano b73f3d2c7d Merge branch 'ft/gitweb-tar-with-gzip-n' into maint
* ft/gitweb-tar-with-gzip-n:
  gitweb: supply '-n' to gzip for identical output
2011-05-26 09:40:50 -07:00
Junio C Hamano 7eacaeffd7 Merge branch 'ss/doc-svn' into maint
* ss/doc-svn:
  remove noise and inaccuracies from git-svn docs
2011-05-26 09:39:40 -07:00
Junio C Hamano 63c11eb4ed Merge branch 'jn/format-patch-doc' into maint
* jn/format-patch-doc:
  Documentation/format-patch: suggest Toggle Word Wrap add-on for Thunderbird
  Documentation: publicize hints for sending patches with GMail
  Documentation: publicize KMail hints for sending patches inline
  Documentation: hints for sending patches inline with Thunderbird
  Documentation: explain how to check for patch corruption
2011-05-26 09:39:33 -07:00
Junio C Hamano ea8ec091fa Merge branch 'jc/maint-pathspec-stdin-and-cmdline' into maint
* jc/maint-pathspec-stdin-and-cmdline:
  setup_revisions(): take pathspec from command line and --stdin correctly
2011-05-26 09:38:44 -07:00
Junio C Hamano 0e66f8722c Merge branch 'jk/cherry-pick-root-with-resolve' into maint
* jk/cherry-pick-root-with-resolve:
  t3503: test cherry picking and reverting root commits
  revert: allow reverting a root commit
  cherry-pick: handle root commits with external strategies
2011-05-26 09:37:41 -07:00
Junio C Hamano 93446aa760 Merge branch 'rg/copy-gecos-username' into maint
* rg/copy-gecos-username:
  copy_gecos: fix not adding nlen to len when processing "&"
2011-05-26 09:37:04 -07:00
Junio C Hamano 9e0ec12728 Merge branch 'fc/completion-zsh' into maint
* fc/completion-zsh:
  git-completion: fix regression in zsh support
2011-05-26 09:36:33 -07:00
Junio C Hamano 5590fe762f Merge branch 'jk/git-connection-deadlock-fix' into maint
* jk/git-connection-deadlock-fix:
  test core.gitproxy configuration
  send-pack: avoid deadlock on git:// push with failed pack-objects
  connect: let callers know if connection is a socket
  connect: treat generic proxy processes like ssh processes

Conflicts:
	connect.c
2011-05-26 09:33:25 -07:00
Junio C Hamano f09937de96 Merge branch 'js/maint-send-pack-stateless-rpc-deadlock-fix' into maint
* js/maint-send-pack-stateless-rpc-deadlock-fix:
  sideband_demux(): fix decl-after-stmt
  send-pack: unbreak push over stateless rpc
  send-pack: avoid deadlock when pack-object dies early
2011-05-26 09:32:14 -07:00
Junio C Hamano a02cf90144 compat/fnmatch/fnmatch.c: give a fall-back definition for NULL
Somebody tried to compile fnmatch.c compatibility file on Interix and got
an error because no header included in the file on that platform defined
NULL.  It usually comes from stddef.h and indirectly from other headers
like string.h, unistd.h, stdio.h, stdlib.h, etc., but with the way we
compile this file from our Makefile, inclusion of the header files that
are expected to define NULL in fnmatch.c do not happen because they are
protected with "#ifdef STDC_HEADERS", etc. which we do not pass.

As the least-impact workaround, give a fall-back definition when none of
the headers define NULL.

Noticed-by: Markus Duft <mduft@gentoo.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-26 09:25:47 -07:00
Junio C Hamano 46bf76ac31 Merge branch 'svn-fe-maint' of git://repo.or.cz/git/jrn into maint
* 'svn-fe-maint' of git://repo.or.cz/git/jrn:
  Revert "t0081 (line-buffer): add buffering tests"
2011-05-26 08:52:11 -07:00
Junio C Hamano 5cfe4256d9 Merge branch 'jc/bigfile'
* jc/bigfile:
  Bigfile: teach "git add" to send a large file straight to a pack
  index_fd(): split into two helper functions
  index_fd(): turn write_object and format_check arguments into one flag
2011-05-25 16:23:26 -07:00
Junio C Hamano 84da3e21dc Merge branch 'js/log-abbrev-commit-config'
* js/log-abbrev-commit-config:
  Add log.abbrevCommit config variable
  "git log -h": typofix misspelled 'suppress'
2011-05-25 16:23:22 -07:00
Junio C Hamano 6741c2e64a Merge branch 'maint'
* maint:
  init/clone: remove short option -L and document --separate-git-dir
2011-05-25 15:25:44 -07:00
Jens Lehmann ea5070c91f Teach read-tree the -n|--dry-run option
The option can be used to check if read-tree with the same set of other
options like "-m" and "-u" would succeed without actually changing either
the index or the working tree.

The relevant tests in the t10?? range were extended to do a read-tree -n
before the real read-tree to make sure neither the index nor any local
files were changed with -n and the same exit code as without -n is
returned. The helper functions added for that purpose reside in the new
t/lib-read-tree.sh file.

The only exception is #13 in t1004 ("unlinking an un-unlink-able
symlink"). As this is an issue of wrong directory permissions it is not
detected with -n.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 15:04:25 -07:00
Jens Lehmann 2c9078d05b unpack-trees: add the dry_run flag to unpack_trees_options
Until now there was no way to test if unpack_trees() with update=1 would
succeed without really updating the work tree. The reason for that is that
setting update to 0 does skip the tests for new files and deactivates the
sparse handling, thereby making that unsuitable as a dry run.

Add the new dry_run flag to struct unpack_trees_options unpack_trees().
Setting that together with the update flag will check if the work tree
update would be successful without doing it for real.

The only class of problems that is not detected at the moment are file
system conditions like ENOSPC or missing permissions. Also the index
entries of updated files are not as they would be after a real checkout
because lstat() isn't run as the files aren't updated for real.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 14:32:02 -07:00
Junio C Hamano a6253d1077 userformat_find_requirements(): find requirement for the correct format
This function was introduced in 5b16360 (pretty: Initialize notes if %N is
used, 2010-04-13) to check what kind of information the "log --format=..."
user format string wants. The function can be passed a NULL instead of a
format string to ask it to check user_format variable kept by an earlier
call to save_user_format().

But it unconditionally checked user_format and not the string it was
given.  The only caller introduced by the change passes NULL, which
kept the bug unnoticed, until a new GCC noticed that there is an
assignment to fmt that is never used.

Noticed-by: Chris Wilson's compiler
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Jeff King <peff@peff.net>
2011-05-25 13:08:10 -07:00
Jakub Narebski f612a71cc9 gitweb: Refactor reading and parsing config file into read_config_file
Beside being obvious reduction of duplicated code, this is enables us
to easily call site-wide config file in per-installation config file.

The actual update to documentation is left for next commit, because of
possible exclusive alternative (possible other next commit) of always
reading system-wide config file and relying on per-instalation config
file overriding system-wide defaults.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Acked-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 12:36:43 -07:00
Michael J Gruber 600a6a68c0 sh-18n: quell "unused variable" warning
show_variables is set but never used. Comment it out rather than remove it so
that the relation with upstream remains clear.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 09:35:59 -07:00
Nguyen Thai Ngoc Duy 09ffc706e4 init/clone: remove short option -L and document --separate-git-dir
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-25 09:30:26 -07:00
Junio C Hamano 73546c085d handle_options(): do not miscount how many arguments were used
The handle_options() function advances the base of the argument array and
returns the number of arguments it used. The caller in handle_alias()
wants to reallocate the argv array it passes to this function, and
attempts to do so by subtracting the returned value to compensate for the
change handle_options() makes to the new_argv.

But handle_options() did not correctly count when "-c <config=value>" is
given, causing a wrong pointer to be passed to realloc().

Fix it by saving the original argv at the beginning of handle_options(),
and return the difference between the final value of argv, which will
relieve the places that move the array pointer from the additional burden
of keeping track of "handled" counter.

Noticed-by: Kazuki Tsujimoto
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 16:25:46 -07:00
Jeff King 06eb708f33 config: always parse GIT_CONFIG_PARAMETERS during git_config
Previously we parsed GIT_CONFIG_PARAMETERS lazily into a
linked list, and then checked that list during future
invocations of git_config. However, that ignores the fact
that the environment variable could change during our run
(e.g., because we parse more "-c" as part of an alias).

Instead, let's just re-parse the environment variable each
time. It's generally not very big, and it's no more work
than parsing the config files, anyway.

As a bonus, we can ditch all of the linked list storage code
entirely, making the code much simpler.

The test unfortunately still does not pass because of an
unrelated bug in handle_options.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 16:25:36 -07:00
Jeff King 5a0c9eeb89 git_config: don't peek at global config_parameters
The config_parameters list in config.c is an implementation
detail of git_config_from_parameters; instead, that function
should tell us whether it found anything.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 16:20:56 -07:00
Jeff King 3ddf0968c2 config: make environment parsing routines static
Nobody outside of git_config_from_parameters should need
to use the GIT_CONFIG_PARAMETERS parsing functions, so let's
make them private.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 16:20:48 -07:00
Jeff King 55601c6a45 doc: discuss textconv versus external diff drivers
We already talk about how to use each one and how they work,
but it is a reasonable question to wonder why one might use
one over the other.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 15:57:03 -07:00
Junio C Hamano e2eb527345 require-work-tree wants more than what its name says
Somebody tried "git pull" from a random place completely outside the work
tree, while exporting GIT_DIR and GIT_WORK_TREE that are set to correct
places, e.g.

    GIT_WORK_TREE=$HOME/git.git
    GIT_DIR=$GIT_WORK_TREE/.git
    export GIT_WORK_TREE GIT_DIR
    cd /tmp
    git pull

At the beginning of git-pull, we check "require-work-tree" and then
"cd-to-toplevel".  I _think_ the original intention when I wrote the
command was "we MUST have a work tree, our $(cwd) might not be at the
top-level directory of it", and no stronger than that.  That check is a
very sensible thing to do before doing cd-to-toplevel.  We check that the
place we would want to go exists, and then go there.

But the implementation of require_work_tree we have today is quite
different.  I don't have energy to dig the history, but currently it says:

    test "$(git rev-parse --is-inside-work-tree 2>/dev/null)" = true ||
    die "fatal: $0 cannot be used without a working tree."

Which is completely bogus.  Even though we may happen to be just outside
of it right now, we may have a working tree that we can cd_to_toplevel
back to.

Add a function "require_work_tree_exists" that implements the check
this function originally intended (this is so that third-party scripts
that rely on the current behaviour do not have to get broken).

For now, update _no_ in-tree scripts, not even "git pull", as nobody on
the list seems to really care about the above corner case workflow that
triggered this. Scripts can be updated after vetting that they do want the
"we want to make sure the place we are going to go actually exists"
semantics.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:34:40 -07:00
Jakub Narebski 2e987f9240 gitweb: Make JavaScript ability to adjust timezones configurable
Configure JavaScript-based ability to select common timezone for git
dates via %feature mechanism, namely 'javascript-timezone' feature.

The following settings are configurable:
* default timezone (defaults to 'local' i.e. browser timezone);
  this also can function as a way to disable this ability,
  by setting it to false-ish value (undef or '')
* name of cookie to store user's choice of timezone
* class name to mark dates

NOTE: This is a bit of abuse of %feature system, which can store only
sequence of values, rather than dictionary (hash); usually but not
always only a single value is used.

Based-on-code-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Helped-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:45 -07:00
John 'Warthog9' Hawley 2ae8da2552 gitweb.js: Add UI for selecting common timezone to display dates
This will modify HTML, add CSS rules and add DOM event handlers so
that clicking on any date (the common part, not the localtime part)
will display a drop down menu to choose the timezone to change to.

Currently menu displays only the following timezones:

  utc
  local
  -1200
  -1100
  ...
  +1100
  +1200
  +1300
  +1400

In timezone selection menu each timezone is +1hr to the previous.  The
code is capable of handling fractional timezones, but those have not
been added to the menu.

All changes are saved to a cookie, so page changes and closing /
reopening browser retains the last known timezone setting used.

[jn: Changed from innerHTML to DOM, moved to event delegation for
onclick to trigger menu, added close button and cookie refreshing]

Helped-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:45 -07:00
John 'Warthog9' Hawley 291e52bd19 gitweb: JavaScript ability to adjust time based on timezone
This patch is based on Kevin Cernekee's <cernekee@gmail.com>
patch series entitled "gitweb: introduce localtime feature".  While
Kevin's patch changed the server side output so that the timezone
was output from gitweb itself, this has a number of drawbacks, in
particular with respect to gitweb-caching.

This patch takes the same basic goal, display the appropriate times in
a given common timezone, and implements it in JavaScript.  This
requires adding / using a new class, "datetime", to be able to find
elements to be adjusted from JavaScript.  Appropriate dates are
wrapped in a span with this class.

Timezone to be used can be retrieved from "gitweb_tz" cookie, though
currently there is no way to set / manipulate this cookie from gitweb;
this is left for later commit.

Valid timezones, currently, are: "utc", "local" (which means that
timezone is taken from browser), and "+/-ZZZZ" numeric timezone as in
RFC-2822.  Default timezone is "local" (currently not configurable,
left for later commit).

Fallback (should JavaScript not be enabled) is to treat dates as they
have been and display them, only, in UTC.

Pages affected:
* 'summary' view, "last change" field (commit time from latest change)
* 'log' view, author time
* 'commit' and 'commitdiff' views, author/committer time
* 'tag' view, tagger time

Based-on-code-from: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:45 -07:00
Jakub Narebski ce71b07632 gitweb: Unify the way long timestamp is displayed
format_timestamp_html loses its "-localtime => 1" option, and now
always print the local time (in author/comitter/tagger local
timezone), with "atnight" warning if needed.

This means that both 'summary' and 'log' views now display localtime.
In the case of 'log' view this can be thought as an improvement, as
now one can easily see which commits in a series are made "atnight"
and should be examined closer.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:45 -07:00
Jakub Narebski 256b7b4883 gitweb: Refactor generating of long dates into format_timestamp_html
It is pure refactoring and doesn't change gitweb output, though this
could potentially affect 'summary', 'log', and 'commit'-like views
('commit', 'commitdiff', 'tag').

Remove print_local_time and format_local_time, as their use is now
replaced (indirectly) by using format_timestamp_html.

While at it improve whitespace formatting.

Inspired-by-code-by: Kevin Cernekee <cernekee@gmail.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:45 -07:00
Jakub Narebski 1cae3ee70d gitweb.js: Provide getElementsByClassName method (if it not exists)
The code is simplified and does not support full specification of
native getElementsByClassName method, but implements just subset that
would be enough for gitweb, supporting only single class name.

Signed-off-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:45 -07:00
Jakub Narebski fcce886bfb gitweb.js: Introduce code to handle cookies from JavaScript
Introduced gitweb/static/js/cookies.js file provides functions for
setting, getting and deleting cookies.

Code taken from subsection "Cookies in JavaScript" of "Professional
JavaScript for Web Developers" by Nicholas C. Zakas and from cookie
plugin for jQuery (dual licensed under the MIT and GPL licenses).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:44 -07:00
Jakub Narebski 54b1479a77 gitweb.js: Extract and improve datetime handling
Move formatDateISOLocal(epoch, timezone) function (and also helper
timezoneOffset(timezoneInfo) function it requires) from common-lib.js to
datetime.js

Add new functions:
* localTimezoneOffset - to get browser timezone offset in seconds
* localTimezoneInfo   - to get browser timezone in '(+|-)HHMM' format
* formatTimezoneInfo - turn offset in hours and minutes into '(+|-)HHMM'
* parseRFC2822Date - to parse RFC-2822 dates that gitweb uses into epoch
* formatDateRFC2882 - like formatDateISOLocal, only RFC-2822 format

All those functions are meant to be used in future commit
'gitweb: javascript ability to adjust time based on timezone'

An alternative would be to use e.g. Datejs (http://www.datejs.com)
library, or JavaScript framework that has date formatting (perhaps as
a plugin).

While at it escape '-' in character class inside tzRe regexp, as
recommended by JSLint (http://www.jslint.com).

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:44 -07:00
Jakub Narebski 4dfa207eec gitweb.js: Provide default values for padding in padLeftStr and padLeft
This means that one can use padLeft(4, 2) and it would be equivalent
to runing padLeft(4, 2, '0'), and it would return '04' i.e. '4' padded
with '0' to width 2, to be used e.g. in formatting date and time.

This should make those functions easier to use.  Current code doesn't
yet make use of this feature.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:44 -07:00
Jakub Narebski e2895de4d8 gitweb.js: Update and improve comments in JavaScript files
This consists of adding a few extra explanation, fixing descriptions
of functions to match names of parameters in code, adding a few
separators, and fixing spelling -- while at it spell 'neighbor' using
American spelling (and not as 'neighbour').

This is post-split cleanup.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:44 -07:00
Jakub Narebski 9a86dd5710 gitweb: Split JavaScript for maintability, combining on build
Split originally single gitweb.js file into smaller files, each
dealing with single issue / area of responsibility.  This move should
make gitweb's JavaScript code easier to maintain.

For better webapp performance it is recommended[1][2][3] to combine
JavaScript files.  Do it during build time (in gitweb/Makefile), by
straight concatenation of files into gitweb.js file (which is now
ignored as being generated).  This means that there are no changes to
gitweb script itself - it still uses gitweb.js or gitweb.min.js, but
now generated.

[1]: http://developer.yahoo.com/performance/rules.html
     "Minimize HTTP Requests" section
[2]: http://code.google.com/speed/articles/include-scripts-properly.html
     "1. Combine external JavaScript files"
[3]: http://javascript-reference.info/speed-up-your-javascript-load-time.htm
     "Combine Your Files" section.

See also new gitweb/static/js/README file.

Inspired-by-patch-by: John 'Warthog9' Hawley <warthog9@eaglescrag.net>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-24 11:22:44 -07:00
Michał Kiedrowicz f556e4af27 git-grep: Update tests (mainly for -P)
Add few more tests for "-P/--perl-regexp" option of "git grep".

While at it, add some generic tests for grep.extendedRegexp config option,
for detecting invalid regexep and check if "last one wins" rule works for
selecting regexp type.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-23 11:57:08 -07:00
Jonathan Nieder f143d9c695 userdiff/perl: tighten BEGIN/END block pattern to reject here-doc delimiters
A naive method of treating BEGIN/END blocks with a brace on the second
line as diff/grep funcname context involves also matching unrelated
lines that consist of all-caps letters:

	sub foo {
		print <<'EOF'
	text goes here
	...
	EOF
		... rest of foo ...
	}

That's not so great, because it means that "git diff" and "git grep
--show-function" would write "=EOF" or "@@ EOF" as context instead of
a more useful reminder like "@@ sub foo {".

To avoid this, tighten the pattern to only match the special block
names that perl accepts (namely BEGIN, END, INIT, CHECK, UNITCHECK,
AUTOLOAD, and DESTROY).  The list is taken from perl's toke.c.

Suggested-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-23 11:39:13 -07:00
Junio C Hamano 5df3e2b3ca Update 1.7.6 draft release notes
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-05-23 10:54:54 -07:00