gitweb.git
Merge branch 'tr/add-i-no-escape' into maintJunio C Hamano Tue, 31 May 2011 19:02:04 +0000 (12:02 -0700)

Merge branch 'tr/add-i-no-escape' into maint

* tr/add-i-no-escape:
add -i: ignore terminal escape sequences

Merge branch 'vh/config-interactive-singlekey-doc'... Junio C Hamano Tue, 31 May 2011 19:01:06 +0000 (12:01 -0700)

Merge branch 'vh/config-interactive-singlekey-doc' into maint

* vh/config-interactive-singlekey-doc:
git-reset.txt: better docs for '--patch'
git-checkout.txt: better docs for '--patch'
git-stash.txt: better docs for '--patch'
git-add.txt: document 'interactive.singlekey'
config.txt: 'interactive.singlekey; is used by...

Merge branch 'ml/test-readme' into maintJunio C Hamano Tue, 31 May 2011 19:00:43 +0000 (12:00 -0700)

Merge branch 'ml/test-readme' into maint

* ml/test-readme:
t/README: unify documentation of test function args

Merge branch 'ab/i18n-fixup' into maintJunio C Hamano Tue, 31 May 2011 19:00:27 +0000 (12:00 -0700)

Merge branch 'ab/i18n-fixup' into maint

* ab/i18n-fixup: (24 commits)
i18n: use test_i18n{cmp,grep} in t7600, t7607, t7611 and t7811
i18n: use test_i18n{grep,cmp} in t7508
i18n: use test_i18ngrep in t7506
i18n: use test_i18ngrep and test_i18ncmp in t7502
i18n: use test_i18ngrep in t7501
i18n: use test_i18ncmp in t7500
i18n: use test_i18ngrep in t7201
i18n: use test_i18ncmp and test_i18ngrep in t7102 and t7110
i18n: use test_i18ncmp and test_i18ngrep in t5541, t6040, t6120, t7004, t7012 and t7060
i18n: use test_i18ncmp and test_i18ngrep in t3700, t4001 and t4014
i18n: use test_i18ncmp and test_i18ngrep in t3203, t3501 and t3507
i18n: use test_i18ngrep in t2020, t2204, t3030, and t3200
i18n: use test_i18ngrep in lib-httpd and t2019
i18n: do not overuse C_LOCALE_OUTPUT (grep)
i18n: use test_i18ncmp in t1200 and t2200
i18n: .git file is not a human readable message (t5601)
i18n: do not overuse C_LOCALE_OUTPUT
i18n: mark init-db messages for translation
i18n: mark checkout plural warning for translation
i18n: mark checkout --detach messages for translation
...

Merge branch 'jc/rename-degrade-cc-to-c' into maintJunio C Hamano Tue, 31 May 2011 19:00:02 +0000 (12:00 -0700)

Merge branch 'jc/rename-degrade-cc-to-c' into maint

* jc/rename-degrade-cc-to-c:
diffcore-rename: fall back to -C when -C -C busts the rename limit
diffcore-rename: record filepair for rename src
diffcore-rename: refactor "too many candidates" logic
builtin/diff.c: remove duplicated call to diff_result_code()

Merge branch 'rr/doc-content-type' into maintJunio C Hamano Tue, 31 May 2011 18:59:39 +0000 (11:59 -0700)

Merge branch 'rr/doc-content-type' into maint

* rr/doc-content-type:
Documentation: Allow custom diff tools to be specified in 'diff.tool'
Documentation: Add diff.<driver>.* to config
Documentation: Move diff.<driver>.* from config.txt to diff-config.txt
Documentation: Add filter.<driver>.* to config

config.c: Remove unused git_config_global() functionRamsay Jones Tue, 31 May 2011 17:23:42 +0000 (18:23 +0100)

config.c: Remove unused git_config_global() function

Commit 8f323c00 (drop support for GIT_CONFIG_NOGLOBAL, 15-03-2011)
removed the git_config_global() function, among other things, since
it is no longer required. Unfortunately, this function has since
been unintentionally restored by a faulty conflict resolution.

Remove it.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: futureproof "stop feeding the backend early"... Junio C Hamano Tue, 31 May 2011 16:14:17 +0000 (09:14 -0700)

diff: futureproof "stop feeding the backend early" logic

Refactor the "do not stop feeding the backend early" logic into a small
helper function and use it in both run_diff_files() and diff_tree() that
has the stop-early optimization. We may later add other types of diffcore
transformation that require to look at the whole result like diff-filter
does, and having the logic in a single place is essential for longer term
maintainability.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff_tree: disable QUICK optimization with diff filterJeff King Tue, 31 May 2011 15:33:56 +0000 (11:33 -0400)

diff_tree: disable QUICK optimization with diff filter

We stop looking for changes early with QUICK, so our diff
queue contains only a subset of the changes. However, we
don't apply diff filters until later; it will appear at that
point as though there are no changes matching our filter,
when in reality we simply didn't keep looking for changes
long enough.

Commit 2cfe8a6 (diff --quiet: disable optimization when
--diff-filter=X is used, 2011-03-16) fixes this in some
cases by disabling the optimization when a filter is
present. However, it only tweaked run_diff_files, missing
the similar case in diff_tree. Thus the fix worked only for
diffing the working tree and index, but not between trees.

Noticed by Yasushi SHOJI.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/fmt-req-fix'Junio C Hamano Tue, 31 May 2011 03:19:21 +0000 (20:19 -0700)

Merge branch 'jc/fmt-req-fix'

* jc/fmt-req-fix:
userformat_find_requirements(): find requirement for the correct format

Merge branch 'jk/maint-config-alias-fix'Junio C Hamano Tue, 31 May 2011 03:19:14 +0000 (20:19 -0700)

Merge branch 'jk/maint-config-alias-fix'

* jk/maint-config-alias-fix:
handle_options(): do not miscount how many arguments were used
config: always parse GIT_CONFIG_PARAMETERS during git_config
git_config: don't peek at global config_parameters
config: make environment parsing routines static

Conflicts:
config.c

Documentation: do not misinterpret refspecs as bold... Jonathan Nieder Mon, 30 May 2011 15:52:56 +0000 (10:52 -0500)

Documentation: do not misinterpret refspecs as bold text

In v1.7.3.3~2 (Documentation: do not misinterpret pull refspec as bold
text, 2010-12-03) many uses of asterisks in expressions like
"refs/heads/*:refs/svn/origin/branches/*" were escaped as {asterisk}
to avoid being treated as delimiters for bold text, but these two were
missed.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: make zero-length subject prefixes prettierJeff King Mon, 30 May 2011 14:19:05 +0000 (10:19 -0400)

format-patch: make zero-length subject prefixes prettier

If you give a zero-length subject prefix to format-patch
(e.g., "format-patch --subject-prefix="), we will print the
ugly:

Subject: [ 1/2] your subject here

because we always insert a space between the prefix and
numbering. Requiring the user to provide the space in their
prefix would be more flexible, but would break existing
usage. This patch provides a DWIM and suppresses the space
for zero-length prefixes, under the assumption that nobody
actually wants "[ 1/2]".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-sh-i18n--envsubst: add SYNOPSIS section to the... Ævar Arnfjörð Bjarmason Sun, 29 May 2011 11:00:35 +0000 (11:00 +0000)

git-sh-i18n--envsubst: add SYNOPSIS section to the documentation

Change the documentation for the git-sh-i18n--envsubst program to
include a SYNOPSIS section. Include the invocation of the program from
git-sh-i18n.sh.

Not having a SYNOPSIS section caused the "doc" target to fail on
Centos 5.5 with asciidoc 8.2.5, while building with 8.6.4 on Debian
works just fine.

The relevant error was:

ERROR: git-sh-i18n--envsubst.txt: line 9: second section must be named SYNOPSIS

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint'Junio C Hamano Mon, 30 May 2011 07:09:55 +0000 (00:09 -0700)

Merge branch 'maint'

* maint:
git-submodule.sh: separate parens by a space to avoid confusing some shells
Documentation/technical/api-diff.txt: correct name of diff_unmerge()
read_gitfile_gently: use ssize_t to hold read result
remove tests of always-false condition
rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'

Merge branch 'jm/maint-misc-fix' into maintJunio C Hamano Mon, 30 May 2011 07:09:41 +0000 (00:09 -0700)

Merge branch 'jm/maint-misc-fix' into maint

* jm/maint-misc-fix:
read_gitfile_gently: use ssize_t to hold read result
remove tests of always-false condition
rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'

Merge branch 'bc/maint-submodule-fix-parked' into maintJunio C Hamano Mon, 30 May 2011 07:09:36 +0000 (00:09 -0700)

Merge branch 'bc/maint-submodule-fix-parked' into maint

* bc/maint-submodule-fix-parked:
git-submodule.sh: separate parens by a space to avoid confusing some shells

Merge branch 'bc/maint-api-doc-parked' into maintJunio C Hamano Mon, 30 May 2011 07:03:52 +0000 (00:03 -0700)

Merge branch 'bc/maint-api-doc-parked' into maint

* bc/maint-api-doc-parked:
Documentation/technical/api-diff.txt: correct name of diff_unmerge()

Merge branch 'mk/grep-pcre'Junio C Hamano Mon, 30 May 2011 07:00:07 +0000 (00:00 -0700)

Merge branch 'mk/grep-pcre'

* mk/grep-pcre:
git-grep: Fix problems with recently added tests
git-grep: Update tests (mainly for -P)
Makefile: Pass USE_LIBPCRE down in GIT-BUILD-OPTIONS
git-grep: update tests now regexp type is "last one wins"
git-grep: do not die upon -F/-P when grep.extendedRegexp is set.
git-grep: Bail out when -P is used with -F or -E
grep: Add basic tests
configure: Check for libpcre
git-grep: Learn PCRE
grep: Extract compile_regexp_failed() from compile_regexp()
grep: Fix a typo in a comment
grep: Put calls to fixmatch() and regmatch() into patmatch()
contrib/completion: --line-number to git grep
Documentation: Add --line-number to git-grep synopsis

git-grep: Fix problems with recently added testsMichał Kiedrowicz Thu, 26 May 2011 22:43:59 +0000 (00:43 +0200)

git-grep: Fix problems with recently added tests

Brian Gernhardt reported that test 'git grep -E -F -G a\\+b' fails on
OS X 10.6.7. This is because I assumed \+ is part of BRE, which isn't
true on all platforms.

The easiest way to make this test pass is to just update expected
output, but that would make the test pointless. Its real purpose is to
check whether 'git grep -E -F -G' is different from 'git grep -E -G -F'.
To check that, let's change pattern to "a+b*c". This should return
different match for -G, -F and -E.

I also made two small tweaks to the tests. First, I added path "ab" to
all calls to future-proof tests. Second, I updated last two tests to
better show that 'git grep -P -E' is different from 'git grep -E -P'.

Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jc/notes-batch-removal'Junio C Hamano Mon, 30 May 2011 06:51:26 +0000 (23:51 -0700)

Merge branch 'jc/notes-batch-removal'

* jc/notes-batch-removal:
show: --ignore-missing
notes remove: --stdin reads from the standard input
notes remove: --ignore-missing
notes remove: allow removing more than one

Merge branch 'jk/haves-from-alternate-odb'Junio C Hamano Mon, 30 May 2011 06:51:22 +0000 (23:51 -0700)

Merge branch 'jk/haves-from-alternate-odb'

* jk/haves-from-alternate-odb:
receive-pack: eliminate duplicate .have refs
bisect: refactor sha1_array into a generic sha1 list
refactor refs_from_alternate_cb to allow passing extra data

Merge branch 'jn/run-command-error-failure' into maintJunio C Hamano Mon, 30 May 2011 02:08:51 +0000 (19:08 -0700)

Merge branch 'jn/run-command-error-failure' into maint

* jn/run-command-error-failure:
run-command: handle short writes and EINTR in die_child
tests: check error message from run_command

builtin/commit.c: set status_format _after_ option... Brandon Casey Thu, 26 May 2011 20:43:21 +0000 (13:43 -0700)

builtin/commit.c: set status_format _after_ option parsing

'git status' should use --porcelain output format when -z is given.
It was not doing so since the _effect_ of using -z, namely that
null_termination would be set, was being checked _before_ option parsing
was performed.

So, move the check so that it is performed after option parsing.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7508: demonstrate status's failure to use --porcelain... Brandon Casey Thu, 26 May 2011 20:43:20 +0000 (13:43 -0700)

t7508: demonstrate status's failure to use --porcelain format with -z

When 'git status' is supplied the -z switch, and no output format has been
selected, it is supposed to use the --porcelain format. This does not
happen. Instead, the standard long format is used. Add a test to
demonstrate this failure.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

log: --quiet should serve as synonym to -sJunio C Hamano Sat, 28 May 2011 19:25:24 +0000 (12:25 -0700)

log: --quiet should serve as synonym to -s

The previous commit simply hijacked --quiet and essentially made it into a
no-op. Instead, take it as a cue that the end user wants to omit the patch
output from commands that default to show patches, e.g. "show".

Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: write a reflog entry when finishingJeff King Fri, 27 May 2011 20:16:14 +0000 (16:16 -0400)

rebase: write a reflog entry when finishing

When we finish a rebase, our detached HEAD is at the final
result. We update the original branch ref with this result,
and then point the HEAD symbolic ref at the updated branch.
We write a reflog for the branch update, but not for the
update of HEAD.

Because we're already at the final result on the detached
HEAD, moving to the branch actually doesn't change our
commit sha1 at all. So in that sense, a reflog entry would
be pointless.

However, humans do read reflogs, and an entry saying "rebase
finished: returning to refs/heads/master" can be helpful in
understanding what is going on.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: create HEAD reflog entry when abortingCsaba Henk Fri, 27 May 2011 20:13:02 +0000 (16:13 -0400)

rebase: create HEAD reflog entry when aborting

When we abort a rebase, we return to the original value of
HEAD. Failing to write a reflog entry means we create a
gap in the reflog (which can cause "git show
HEAD@{5.minutes.ago}" to issue a warning). Plus having the
extra entry makes the reflog easier to follow for a human.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config.mak.in: allow "configure --sysconfdir=/else... Junio C Hamano Thu, 5 May 2011 01:50:45 +0000 (18:50 -0700)

config.mak.in: allow "configure --sysconfdir=/else/where"

We do allow vanilla Makefile users to say make sysconfdir=/else/where
and config.mak can also be tweaked manually for the same effect. Give
the same configurablity to ./configure users as well.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs: fix some antique example outputJeff King Fri, 27 May 2011 02:33:15 +0000 (22:33 -0400)

docs: fix some antique example output

These diff-index and diff-tree sample outputs date back to
the first month of git's existence. The output format has
changed slightly since then, so let's have it match the
current output.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs: make sure literal "->" isn't converted to arrowJeff King Fri, 27 May 2011 02:32:41 +0000 (22:32 -0400)

docs: make sure literal "->" isn't converted to arrow

Recent versions of asciidoc will treat "->" as a
single-glyph arrow symbol, unless it is inside a literal
code block. This is a problem if we are discussing literal
output and want to show the ASCII characters.

Our usage falls into three categories:

1. Inside a code block. These can be left as-is.

2. Discussing literal output or code, but inside a
paragraph. This patch escapes these as "\->".

3. Using the arrow as a symbolic element, such as "use the
Edit->Account Settings menu". In this case, the
arrow symbol is preferable, so we leave it as-is.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs: update status --porcelain formatJeff King Fri, 27 May 2011 02:31:51 +0000 (22:31 -0400)

docs: update status --porcelain format

The --porcelain format was originally identical to the
--short format, but designed to be stable as the short
format changed. Since this was written, the short format
picked up a few incompatible niceties, but this description
was never changed.

Let's mention the differences. While we're at it, let's add
some sub-section headings to make the "output" section a
little easier to navigate.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

docs: minor grammar fixes to git-statusJeff King Fri, 27 May 2011 02:31:11 +0000 (22:31 -0400)

docs: minor grammar fixes to git-status

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: preserve subject newlines with -kJeff King Thu, 26 May 2011 22:28:17 +0000 (18:28 -0400)

format-patch: preserve subject newlines with -k

In older versions of git, we used rfc822 header folding to
indicate that the original subject line had multiple lines
in it. But since a1f6baa (format-patch: wrap long header
lines, 2011-02-23), we now use header folding whenever there
is a long line.

This means that "git am" cannot trust header folding as a
sign from format-patch that newlines should be preserved.
Instead, format-patch needs to signal more explicitly that
the newlines are significant. This patch does so by
rfc2047-encoding the newlines in the subject line. No
changes are needed on the "git am" end; it already decodes
the newlines properly.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clean up calling conventions for pretty.c functionsJeff King Thu, 26 May 2011 22:27:49 +0000 (18:27 -0400)

clean up calling conventions for pretty.c functions

We have a pretty_print_context representing the parameters
for a pretty-print session, but we did not use it uniformly.
As a result, functions kept growing more and more arguments.

Let's clean this up in a few ways:

1. All pretty-print pp_* functions now take a context.
This lets us reduce the number of arguments to these
functions, since we were just passing around the
context values separately.

2. The context argument now has a cmit_fmt field, which
was passed around separately. That's one less argument
per function.

3. The context argument always comes first, which makes
calling a little more uniform.

This drops lines from some callers, and adds lines in a few
places (because we need an extra line to set the context's
fmt field). Overall, we don't save many lines, but the lines
that are there are a lot simpler and more readable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pretty: add pp_commit_easy function for simple callersJeff King Thu, 26 May 2011 22:27:24 +0000 (18:27 -0400)

pretty: add pp_commit_easy function for simple callers

Many callers don't actually care about the pretty print
context at all; let's just give them a simple way of
pretty-printing a commit without having to create a context
struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-submodule.sh: separate parens by a space to avoid... Brandon Casey Thu, 26 May 2011 20:52:04 +0000 (13:52 -0700)

git-submodule.sh: separate parens by a space to avoid confusing some shells

Some shells interpret '(( ))' according to the rules for arithmetic
expansion. This may not follow POSIX, but is prevalent in commonly used
shells. Bash does not have a problem with this particular instance of
'((', likely because it is not followed by a '))', but the public domain
ksh does, and so does ksh on IRIX 6.5.

So, add a space between the parenthesis to avoid confusing these shells.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/technical/api-diff.txt: correct name... Brandon Casey Thu, 26 May 2011 20:46:56 +0000 (13:46 -0700)

Documentation/technical/api-diff.txt: correct name of diff_unmerge()

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mailinfo: always clean up rfc822 header foldingJeff King Thu, 26 May 2011 20:53:38 +0000 (16:53 -0400)

mailinfo: always clean up rfc822 header folding

Without the "-k" option, mailinfo will convert a folded
subject header like:

Subject: this is a
subject that doesn't
fit on one line

into a single line. With "-k", however, we assumed that
these newlines were significant and represented something
that the sending side would want us to preserve.

For messages created by format-patch, this assumption was
broken by a1f6baa (format-patch: wrap long header lines,
2011-02-23). For messages sent by arbitrary MUAs, this was
probably never a good assumption to make, as they may have
been folding subjects in accordance with rfc822's line
length recommendations all along.

This patch now joins folded lines with a single whitespace
character. This treats header folding purely as a syntactic
feature of the transport mechanism, not as something that
format-patch is trying to tell us about the original
subject.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: test subject handling in format-patch / am pipelineJeff King Thu, 26 May 2011 20:41:18 +0000 (16:41 -0400)

t: test subject handling in format-patch / am pipeline

Commit a1f6baa (format-patch: wrap long header lines,
2011-02-23) changed format-patch's behavior with respect to
long header lines, but made no accompanying changes to the
receiving side. It was thought that "git am" would handle
these folded subjects fine, but there is a regression when
using "am -k".

Let's add a test documenting this. While we're at it, let's
give more complete test coverage to document what should be
happening in each case. We test three types of subjects:
a short one, one long enough to require wrapping, and a
multiline subject. For each, we test these three
combinations:

format-patch | am
format-patch -k | am
format-patch -k | am -k

We don't bother testing "format-patch | am -k", which is
nonsense (you will be adding in [PATCH] cruft to each
subject).

This reveals the regression above (long subjects have
linebreaks introduced via "format-patch -k | am -k"),
as well as an existing non-optimal behavior (multiline
subjects are not preserved using "-k").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read_in_full: always report errorsJeff King Thu, 26 May 2011 16:30:27 +0000 (12:30 -0400)

read_in_full: always report errors

The read_in_full function repeatedly calls read() to fill a
buffer. If the first read() returns an error, we notify the
caller by returning the error. However, if we read some data
and then get an error on a subsequent read, we simply return
the amount of data that we did read, and the caller is
unaware of the error.

This makes the tradeoff that seeing the partial data is more
important than the fact that an error occurred. In practice,
this is generally not the case; we care more if an error
occurred, and should throw away any partial data.

I audited the current callers. In most cases, this will make
no difference at all, as they do:

if (read_in_full(fd, buf, size) != size)
error("short read");

However, it will help in a few cases:

1. In sha1_file.c:index_stream, we would fail to notice
errors in the incoming stream.

2. When reading symbolic refs in resolve_ref, we would
fail to notice errors and potentially use a truncated
ref name.

3. In various places, we will get much better error
messages. For example, callers of safe_read would
erroneously print "the remote end hung up unexpectedly"
instead of showing the read error.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote: allow "-t" with fetch mirrorsJeff King Thu, 26 May 2011 15:11:00 +0000 (11:11 -0400)

remote: allow "-t" with fetch mirrors

Commit 13fc2c1 (remote: disallow some nonsensical option
combinations, 2011-03-30) made it impossible to use "remote
add -t foo --mirror". The argument was that specifying
specific branches is useless because:

1. Push mirrors do not want a refspec at all.

2. The point of fetch mirroring is to use a broad refspec
like "refs/*", but using "-t" overrides that.

Point (1) is valid; "-t" with push mirrors is useless. But
point (2) ignored another side effect of using --mirror: it
fetches the refs directly into the refs/ namespace as they
are found upstream, instead of placing them in a
separate-remote layout.

So 13fc2c1 was overly constrictive, and disallowed
reasonable specific-branch mirroring, like:

git remote add -t heads/foo -t heads/bar --mirror=fetch

which makes the local "foo" and "bar" branches direct
mirrors of the remote, but does not fetch anything else.

This patch restores the original behavior, but only for
fetch mirrors.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

read_gitfile_gently: use ssize_t to hold read resultJeff King Thu, 26 May 2011 16:28:44 +0000 (12:28 -0400)

read_gitfile_gently: use ssize_t to hold read result

Otherwise, a negative error return becomes a very large read
value. We catch this in practice because we compare the
expected and actual numbers of bytes (and you are not likely
to be reading (size_t)-1 bytes), but this makes the
correctness a little more obvious.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remove tests of always-false conditionJim Meyering Thu, 26 May 2011 13:58:16 +0000 (15:58 +0200)

remove tests of always-false condition

* fsck.c (fsck_error_function): Don't test obj->sha1 == 0.
It can never be true, since that sha1 member is an array.
* transport.c (set_upstreams): Likewise for ref->new_sha1.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

plug a DIR buffer leak in rerere.cJim Meyering Thu, 26 May 2011 13:55:50 +0000 (15:55 +0200)

plug a DIR buffer leak in rerere.c

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rerere.c: diagnose a corrupt MERGE_RR when hitting... Jim Meyering Thu, 26 May 2011 13:54:18 +0000 (15:54 +0200)

rerere.c: diagnose a corrupt MERGE_RR when hitting EOF between TAB and '\0'

If we reach EOF after the SHA1-then-TAB, yet before the NUL that
terminates each file name, we would fill the file name buffer with \255
bytes resulting from the repeatedly-failing fgetc (returns EOF/-1) and
ultimately complain about "filename too long", because no NUL was
encountered.

Signed-off-by: Jim Meyering <jim@meyering.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update 1.7.6 draft release notesJunio C Hamano Thu, 26 May 2011 17:41:33 +0000 (10:41 -0700)

Update 1.7.6 draft release notes

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jn/userdiff-perl-updates'Junio C Hamano Thu, 26 May 2011 17:32:25 +0000 (10:32 -0700)

Merge branch 'jn/userdiff-perl-updates'

* jn/userdiff-perl-updates:
userdiff/perl: tighten BEGIN/END block pattern to reject here-doc delimiters
tests: make test_expect_code quieter on success
userdiff/perl: catch sub with brace on second line
userdiff/perl: match full line of POD headers
userdiff/perl: anchor "sub" and "package" patterns on the left
t4018 (funcname patterns): minor cleanups
t4018 (funcname patterns): make configuration easier to track
t4018 (funcname patterns): make .gitattributes state easier to track

Merge branch 'rg/no-gecos-in-pwent'Junio C Hamano Thu, 26 May 2011 17:32:19 +0000 (10:32 -0700)

Merge branch 'rg/no-gecos-in-pwent'

* rg/no-gecos-in-pwent:
ident: add NO_GECOS_IN_PWENT for systems without pw_gecos in struct passwd

Conflicts:
Makefile

Merge branch 'jk/fetch-mark-complete-optimization'Junio C Hamano Thu, 26 May 2011 17:32:11 +0000 (10:32 -0700)

Merge branch 'jk/fetch-mark-complete-optimization'

* jk/fetch-mark-complete-optimization:
fetch: avoid repeated commits in mark_complete

Merge branch 'jn/gitweb-js'Junio C Hamano Thu, 26 May 2011 17:31:57 +0000 (10:31 -0700)

Merge branch 'jn/gitweb-js'

* jn/gitweb-js:
gitweb: Make JavaScript ability to adjust timezones configurable
gitweb.js: Add UI for selecting common timezone to display dates
gitweb: JavaScript ability to adjust time based on timezone
gitweb: Unify the way long timestamp is displayed
gitweb: Refactor generating of long dates into format_timestamp_html
gitweb.js: Provide getElementsByClassName method (if it not exists)
gitweb.js: Introduce code to handle cookies from JavaScript
gitweb.js: Extract and improve datetime handling
gitweb.js: Provide default values for padding in padLeftStr and padLeft
gitweb.js: Update and improve comments in JavaScript files
gitweb: Split JavaScript for maintability, combining on build

Merge branch 'jn/ctags-more'Junio C Hamano Thu, 26 May 2011 17:31:53 +0000 (10:31 -0700)

Merge branch 'jn/ctags-more'

* jn/ctags-more:
gitweb: Optional grouping of projects by category
gitweb: Modularized git_get_project_description to be more generic
gitweb: Split git_project_list_body in two functions

Merge branch 'jc/require-work-tree-exists'Junio C Hamano Thu, 26 May 2011 17:31:47 +0000 (10:31 -0700)

Merge branch 'jc/require-work-tree-exists'

* jc/require-work-tree-exists:
require-work-tree wants more than what its name says

Sync with 1.7.5.3Junio C Hamano Thu, 26 May 2011 17:30:28 +0000 (10:30 -0700)

Sync with 1.7.5.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 1.7.5.3 v1.7.5.3Junio C Hamano Thu, 26 May 2011 16:45:29 +0000 (09:45 -0700)

Git 1.7.5.3

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'maint-1.7.4' into maintJunio C Hamano Thu, 26 May 2011 17:29:24 +0000 (10:29 -0700)

Merge branch 'maint-1.7.4' into maint

* maint-1.7.4:

Merge branch 'jk/git-connection-deadlock-fix' into... Junio C Hamano Thu, 26 May 2011 17:28:10 +0000 (10:28 -0700)

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

Merge branch 'js/maint-send-pack-stateless-rpc-deadlock... Junio C Hamano Thu, 26 May 2011 17:27:55 +0000 (10:27 -0700)

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

Merge branch 'jk/maint-upload-pack-shallow' into maint... Junio C Hamano Thu, 26 May 2011 17:27:29 +0000 (10:27 -0700)

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

Merge branch 'jm/maint-diff-words-with-sbe' into maintJunio C Hamano Thu, 26 May 2011 16:43:00 +0000 (09:43 -0700)

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

Merge branch 'kk/maint-prefix-in-config-mak' into maintJunio C Hamano Thu, 26 May 2011 16:42:12 +0000 (09:42 -0700)

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

Merge branch 'mg/diff-uiconfig-doc' into maintJunio C Hamano Thu, 26 May 2011 16:41:11 +0000 (09:41 -0700)

Merge branch 'mg/diff-uiconfig-doc' into maint

* mg/diff-uiconfig-doc:
config.txt,diff-options.txt: porcelain vs. plumbing for color.diff

Merge branch 'ft/gitweb-tar-with-gzip-n' into maintJunio C Hamano Thu, 26 May 2011 16:40:50 +0000 (09:40 -0700)

Merge branch 'ft/gitweb-tar-with-gzip-n' into maint

* ft/gitweb-tar-with-gzip-n:
gitweb: supply '-n' to gzip for identical output

Merge branch 'ss/doc-svn' into maintJunio C Hamano Thu, 26 May 2011 16:39:40 +0000 (09:39 -0700)

Merge branch 'ss/doc-svn' into maint

* ss/doc-svn:
remove noise and inaccuracies from git-svn docs

Merge branch 'jn/format-patch-doc' into maintJunio C Hamano Thu, 26 May 2011 16:39:33 +0000 (09:39 -0700)

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

Merge branch 'jc/maint-pathspec-stdin-and-cmdline'... Junio C Hamano Thu, 26 May 2011 16:38:44 +0000 (09:38 -0700)

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

Merge branch 'jk/cherry-pick-root-with-resolve' into... Junio C Hamano Thu, 26 May 2011 16:37:41 +0000 (09:37 -0700)

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

Merge branch 'rg/copy-gecos-username' into maintJunio C Hamano Thu, 26 May 2011 16:37:04 +0000 (09:37 -0700)

Merge branch 'rg/copy-gecos-username' into maint

* rg/copy-gecos-username:
copy_gecos: fix not adding nlen to len when processing "&"

Merge branch 'fc/completion-zsh' into maintJunio C Hamano Thu, 26 May 2011 16:36:33 +0000 (09:36 -0700)

Merge branch 'fc/completion-zsh' into maint

* fc/completion-zsh:
git-completion: fix regression in zsh support

Merge branch 'jk/git-connection-deadlock-fix' into... Junio C Hamano Thu, 26 May 2011 16:33:25 +0000 (09:33 -0700)

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

Merge branch 'js/maint-send-pack-stateless-rpc-deadlock... Junio C Hamano Thu, 26 May 2011 16:32:14 +0000 (09:32 -0700)

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

compat/fnmatch/fnmatch.c: give a fall-back definition... Junio C Hamano Thu, 26 May 2011 16:25:47 +0000 (09:25 -0700)

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>

Merge branch 'svn-fe-maint' of git://repo.or.cz/git... Junio C Hamano Thu, 26 May 2011 15:52:11 +0000 (08:52 -0700)

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"

Merge branch 'jc/bigfile'Junio C Hamano Wed, 25 May 2011 23:23:26 +0000 (16:23 -0700)

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

Merge branch 'js/log-abbrev-commit-config'Junio C Hamano Wed, 25 May 2011 23:23:22 +0000 (16:23 -0700)

Merge branch 'js/log-abbrev-commit-config'

* js/log-abbrev-commit-config:
Add log.abbrevCommit config variable
"git log -h": typofix misspelled 'suppress'

Merge branch 'maint'Junio C Hamano Wed, 25 May 2011 22:25:44 +0000 (15:25 -0700)

Merge branch 'maint'

* maint:
init/clone: remove short option -L and document --separate-git-dir

Teach read-tree the -n|--dry-run optionJens Lehmann Wed, 25 May 2011 20:10:41 +0000 (22:10 +0200)

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>

unpack-trees: add the dry_run flag to unpack_trees_optionsJens Lehmann Wed, 25 May 2011 20:07:51 +0000 (22:07 +0200)

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>

userformat_find_requirements(): find requirement for... Junio C Hamano Wed, 25 May 2011 19:23:44 +0000 (12:23 -0700)

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>

gitweb: Refactor reading and parsing config file into... Jakub Narebski Wed, 25 May 2011 16:35:26 +0000 (18:35 +0200)

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>

sh-18n: quell "unused variable" warningMichael J Gruber Wed, 25 May 2011 09:55:43 +0000 (11:55 +0200)

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>

init/clone: remove short option -L and document --separ... Nguyen Thai Ngoc Duy Tue, 24 May 2011 16:40:32 +0000 (23:40 +0700)

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>

handle_options(): do not miscount how many arguments... Junio C Hamano Tue, 24 May 2011 22:50:35 +0000 (18:50 -0400)

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>

config: always parse GIT_CONFIG_PARAMETERS during git_c... Jeff King Tue, 24 May 2011 22:49:55 +0000 (18:49 -0400)

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>

git_config: don't peek at global config_parametersJeff King Tue, 24 May 2011 22:49:45 +0000 (18:49 -0400)

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>

config: make environment parsing routines staticJeff King Tue, 24 May 2011 22:49:36 +0000 (18:49 -0400)

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>

doc: discuss textconv versus external diff driversJeff King Tue, 24 May 2011 19:45:27 +0000 (15:45 -0400)

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>

require-work-tree wants more than what its name saysJunio C Hamano Thu, 5 May 2011 02:11:18 +0000 (19:11 -0700)

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>

gitweb: Make JavaScript ability to adjust timezones... Jakub Narebski Thu, 28 Apr 2011 19:04:11 +0000 (21:04 +0200)

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>

gitweb.js: Add UI for selecting common timezone to... John 'Warthog9' Hawley Thu, 28 Apr 2011 19:04:10 +0000 (21:04 +0200)

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>

gitweb: JavaScript ability to adjust time based on... John 'Warthog9' Hawley Thu, 28 Apr 2011 19:04:09 +0000 (21:04 +0200)

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>

gitweb: Unify the way long timestamp is displayedJakub Narebski Thu, 28 Apr 2011 19:04:08 +0000 (21:04 +0200)

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>

gitweb: Refactor generating of long dates into format_t... Jakub Narebski Thu, 28 Apr 2011 19:04:07 +0000 (21:04 +0200)

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>

gitweb.js: Provide getElementsByClassName method (if... Jakub Narebski Thu, 28 Apr 2011 19:04:06 +0000 (21:04 +0200)

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>

gitweb.js: Introduce code to handle cookies from JavaScriptJakub Narebski Thu, 28 Apr 2011 19:04:05 +0000 (21:04 +0200)

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>

gitweb.js: Extract and improve datetime handlingJakub Narebski Thu, 28 Apr 2011 19:04:04 +0000 (21:04 +0200)

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>

gitweb.js: Provide default values for padding in padLef... Jakub Narebski Thu, 28 Apr 2011 19:04:03 +0000 (21:04 +0200)

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>

gitweb.js: Update and improve comments in JavaScript... Jakub Narebski Thu, 28 Apr 2011 19:04:02 +0000 (21:04 +0200)

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>

gitweb: Split JavaScript for maintability, combining... Jakub Narebski Thu, 28 Apr 2011 19:04:01 +0000 (21:04 +0200)

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>

git-grep: Update tests (mainly for -P)Michał Kiedrowicz Sun, 22 May 2011 11:37:28 +0000 (13:37 +0200)

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>