Code

git.git
12 years agoEnsure git ls-tree exits with a non-zero exit code if read_tree_recursive fails.
Jon Seymour [Sun, 24 Jul 2011 14:59:14 +0000 (00:59 +1000)]
Ensure git ls-tree exits with a non-zero exit code if read_tree_recursive fails.

In the case of a corrupt repository, git ls-tree may report an error but
presently it exits with a code of 0.

This change uses the return code of read_tree_recursive instead.

Improved-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agotests: print failed test numbers at the end of the test run
Jens Lehmann [Sun, 24 Jul 2011 13:35:54 +0000 (15:35 +0200)]
tests: print failed test numbers at the end of the test run

On modern multi-core processors "make test" is often run in multiple jobs.
If one of them fails the test run does stop, but the concurrently running
tests finish their run. It is rather easy to find out which test failed by
doing a "ls -d t/trash*". But that only works when you don't use the "-i"
option to "make test" because you want to get an overview of all failing
tests. In that case all thrash directories are deleted end and the
information which tests failed is lost.

If one or more tests failed, print a list of them before the test summary:

failed test(s): t1000 t6500

fixed   0
success 7638
failed  3
broken  49
total   7723

This makes it possible to just run the test suite with -i and collect all
failed test scripts at the end for further examination.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoAdd a test to check that git ls-tree sets non-zero exit code on error.
Jon Seymour [Sun, 24 Jul 2011 14:59:13 +0000 (00:59 +1000)]
Add a test to check that git ls-tree sets non-zero exit code on error.

Expected to fail at this commit, fixed by subsequent commit.

Additional tests of adhoc or uncategorised nature should be added to this
file.

Improved-by: Jens Lehmann <Jens.Lehmann@web.de>
Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodoc/fast-import: clarify notemodify command
Dmitry Ivankov [Wed, 13 Jul 2011 17:10:53 +0000 (23:10 +0600)]
doc/fast-import: clarify notemodify command

The "notemodify" fast-import command was introduced in commit a8dd2e7
(fast-import: Add support for importing commit notes, 2009-10-09)
The commit log has slightly different description than the added
documentation. The latter is somewhat confusing. "notemodify" is a
subcommand of "commit" command used to add a note for some commit.
Does this note annotate the commit produced by the "commit" command
or a commit given by it's committish parameter? Which notes tree
does it write notes to?

The exact meaning could be deduced with old description and some
notes machinery knowledge. But let's make it more obvious. This
command is used in a context like "commit refs/notes/test" to
add or rewrite an annotation for a committish parameter. So the
advised way to add notes in a fast-import stream is:
1) import some commits (optional)
2) prepare a "commit" to the notes tree:
2.1) choose notes ref, committer, log message, etc.
2.2) create annotations with "notemodify", where each can refer to
a commit being annotated via a branch name, import mark reference,
sha1 and other expressions specified in the Documentation.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoreset: give better reflog messages
Jeff King [Fri, 22 Jul 2011 16:12:23 +0000 (10:12 -0600)]
reset: give better reflog messages

The reset command creates its reflog entry from argv.
However, it does so after having run parse_options, which
means the only thing left in argv is any non-option
arguments. Thus you would end up with confusing reflog
entries like:

  $ git reset --hard HEAD^
  $ git reset --soft HEAD@{1}
  $ git log -2 -g --oneline
  8e46cad HEAD@{0}: HEAD@{1}: updating HEAD
  1eb9486 HEAD@{1}: HEAD^: updating HEAD

However, we must also consider that some scripts may set
GIT_REFLOG_ACTION before calling reset, and we need to show
their reflog action (with our text appended). For example:

  rebase -i (squash): updating HEAD

On top of that, we also set the ORIG_HEAD reflog action
(even though it doesn't generally exist). In that case, the
reset argument is somewhat meaningless, as it has nothing to
do with what's in ORIG_HEAD.

This patch changes the reset reflog code to show:

  $GIT_REFLOG_ACTION: updating {HEAD,ORIG_HEAD}

as before, but only if GIT_REFLOG_ACTION is set. Otherwise,
show:

   reset: moving to $rev

for HEAD, and:

   reset: updating ORIG_HEAD

for ORIG_HEAD (this is still somewhat superfluous, since we
are in the ORIG_HEAD reflog, obviously, but at least we now
mention which command was used to update it).

While we're at it, we can clean up the code a bit:

 - Use strbufs to make the message.

 - Use the "rev" parameter instead of showing all options.
   This makes more sense, since it is the only thing
   impacting the writing of the ref.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: minor grammatical fix in rev-list-options.txt
Jack Nagel [Fri, 22 Jul 2011 01:33:15 +0000 (20:33 -0500)]
Documentation: minor grammatical fix in rev-list-options.txt

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: git-filter-branch honors replacement refs
Peter Collingbourne [Thu, 21 Jul 2011 15:10:52 +0000 (16:10 +0100)]
Documentation: git-filter-branch honors replacement refs

Make it clear that git-filter-branch will honor and make permanent
replacement refs as well as grafts.

Signed-off-by: Peter Collingbourne <peter@pcc.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoremote-curl: Add a format check to parsing of info/refs
Julian Phillips [Sat, 16 Jul 2011 18:23:51 +0000 (19:23 +0100)]
remote-curl: Add a format check to parsing of info/refs

When parsing info/refs, no checks were applied that the file was in
the requried format.  Since the file is read from a remote webserver,
this isn't guarenteed to be true.  Add a check that the file at least
only contains lines that consist of 40 characters followed by a tab
and then the ref name.

Signed-off-by: Julian Phillips <julian@quantumfyre.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-config: Remove extra whitespaces
Pavan Kumar Sunkara [Sat, 16 Jul 2011 21:55:52 +0000 (03:25 +0530)]
git-config: Remove extra whitespaces

Remove extra whitespaces introduced by commits
01ebb9dc and fc1905bb

Signed-off-by: Pavan Kumar Sunkara <pavan.sss1991@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agotests: cleanup binary test vector files
Vitaliy Ivanov [Tue, 19 Jul 2011 17:21:47 +0000 (20:21 +0300)]
tests: cleanup binary test vector files

The test4012.png test vector file that was originally used for t4012 to
check operations on binary files was later reused in other tests, making
it no longer consistent to name it after a specific test. Rename it to more
generic "test-binary-1.png".

While at it, rename test9200b to "test-binary-2.png" (even though it is
only used by t9200).

Signed-off-by: Vitaliy Ivanov <vitalivanov@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDo not log unless all connect() attempts fail
Dave Zarzycki [Tue, 12 Jul 2011 16:28:34 +0000 (09:28 -0700)]
Do not log unless all connect() attempts fail

IPv6 hosts are often unreachable on the primarily IPv4 Internet and
therefore we shouldn't print an error if there are still other hosts we
can try to connect() to. This helps "git fetch --quiet" stay quiet.

Signed-off-by: Dave Zarzycki <zarzycki@apple.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorebase: clarify "restore the original branch"
Martin von Zweigbergk [Thu, 14 Jul 2011 03:47:06 +0000 (23:47 -0400)]
rebase: clarify "restore the original branch"

The description for 'git rebase --abort' currently says:

    Restore the original branch and abort the rebase operation.

The "restore" can be misinterpreted to imply that the original branch
was somehow in a broken state during the rebase operation. It is also
not completely clear what "the original branch" is --- is it the
branch that was checked out before the rebase operation was called or
is the the branch that is being rebased (it is the latter)? Although
both issues are made clear in the DESCRIPTION section, let us also
make the entry in the OPTIONS secion more clear.

Also remove the term "rebasing process" from the usage text, since the
user already knows that the text is about "git rebase".

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoreset [<commit>] paths...: do not mishandle unmerged paths
Junio C Hamano [Thu, 14 Jul 2011 04:36:29 +0000 (21:36 -0700)]
reset [<commit>] paths...: do not mishandle unmerged paths

Because "diff --cached HEAD" showed an incorrect blob object name on the
LHS of the diff, we ended up updating the index entry with bogus value,
not what we read from the tree.

Noticed by John Nowak.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: clearly specify what refs are honored by core.logAllRefUpdates
Bert Wesarg [Mon, 11 Jul 2011 09:14:18 +0000 (11:14 +0200)]
Documentation: clearly specify what refs are honored by core.logAllRefUpdates

The documentation for logging updates in git-update-ref, doesn't make it
clear that only a specific subset of refs are honored by this variable.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoget_pwd_cwd(): Do not trust st_dev/st_ino blindly
Johannes Schindelin [Sat, 9 Jul 2011 17:38:08 +0000 (19:38 +0200)]
get_pwd_cwd(): Do not trust st_dev/st_ino blindly

10c4c88 (Allow add_path() to add non-existent directories to the path,
2008-07-21) introduced get_pwd_cwd() function in order to favor $PWD when
getenv("PWD") and getcwd() refer to the same directory but are different
strings (e.g. the former gives a nicer looking name via a symbolic link to
an uglier looking automounted path). The function tried to determine if
two directories are the same by running stat(2) on both and comparing
ino/dev fields.

Unfortunately, stat() does not fill any ino or dev fields in msysgit.  But
there is a telltale: both ino and dev are 0 when they are not filled
correctly, so let's be extra cautious.

This happens to fix a bug in "get-receive-pack working_directory/" when
the GIT_DIR would not be set correctly due to absolute_path(".")
returning the wrong value.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agohelp_unknown_cmd: do not propose an "unknown" cmd
Michael Schubert [Fri, 8 Jul 2011 10:08:49 +0000 (12:08 +0200)]
help_unknown_cmd: do not propose an "unknown" cmd

When executing an external shell script like `git foo` with a bad
shebang, e.g. "#!/usr/bin/not/existing", execvp returns 127 (ENOENT).

Since help_unknown_cmd proposes the use of all external commands similar
to the name of the "unknown" command, it suggests the just failed command
again. Stop it and give some advice to the user.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge commit 'v1.7.6' into jc/checkout-reflog-fix
Junio C Hamano [Wed, 6 Jul 2011 22:38:28 +0000 (15:38 -0700)]
Merge commit 'v1.7.6' into jc/checkout-reflog-fix

* commit 'v1.7.6': (3211 commits)
  Git 1.7.6
  completion: replace core.abbrevguard to core.abbrev
  Git 1.7.6-rc3
  Documentation: git diff --check respects core.whitespace
  gitweb: 'pickaxe' and 'grep' features requires 'search' to be enabled
  t7810: avoid unportable use of "echo"
  plug a few coverity-spotted leaks
  builtin/gc.c: add missing newline in message
  tests: link shell libraries into valgrind directory
  t/Makefile: pass test opts to valgrind target properly
  sh-i18n--envsubst.c: do not #include getopt.h
  Fix typo: existant->existent
  Git 1.7.6-rc2
  gitweb: do not misparse nonnumeric content tag files that contain a digit
  Git 1.7.6-rc1
  fetch: do not leak a refspec
  t3703: skip more tests using colons in file names on Windows
  gitweb: Fix usability of $prevent_xss
  gitweb: Move "Requirements" up in gitweb/INSTALL
  gitweb: Describe CSSMIN and JSMIN in gitweb/INSTALL
  ...

12 years agoMerge commit 'v1.7.0' into jc/checkout-reflog-fix
Junio C Hamano [Wed, 6 Jul 2011 22:38:18 +0000 (15:38 -0700)]
Merge commit 'v1.7.0' into jc/checkout-reflog-fix

* commit 'v1.7.0': (4188 commits)
  Git 1.7.0
  Fix typo in 1.6.6.2 release notes
  Re-fix check-ref-format documentation mark-up
  archive documentation: attributes are taken from the tree by default
  Documentation: minor fixes to RelNotes-1.7.0
  bash: support 'git am's new '--continue' option
  filter-branch: Fix error message for --prune-empty --commit-filter
  am: switch --resolved to --continue
  Update draft release notes to 1.7.0 one more time
  Git 1.6.6.2
  t8003: check exit code of command and error message separately
  check-ref-format documentation: fix enumeration mark-up
  Documentation: quote braces in {upstream} notation
  t3902: Protect against OS X normalization
  blame: prevent a segv when -L given start > EOF
  git-push: document all the status flags used in the output
  Fix parsing of imap.preformattedHTML and imap.sslverify
  git-add documentation: Fix shell quoting example
  Revert "pack-objects: fix pack generation when using pack_size_limit"
  archive: simplify archive format guessing
  ...

12 years agoMerge commit 'v1.6.0' into jc/checkout-reflog-fix
Junio C Hamano [Wed, 6 Jul 2011 22:37:42 +0000 (15:37 -0700)]
Merge commit 'v1.6.0' into jc/checkout-reflog-fix

* commit 'v1.6.0': (2063 commits)
  GIT 1.6.0
  git-p4: chdir now properly sets PWD environment variable in msysGit
  Improve error output of git-rebase
  t9300: replace '!' with test_must_fail
  Git.pm: Make File::Spec and File::Temp requirement lazy
  Documentation: document the pager.* configuration setting
  git-stash: improve synopsis in help and manual page
  Makefile: building git in cygwin 1.7.0
  git-am: ignore --binary option
  bash-completion: Add non-command git help files to bash-completion
  Fix t3700 on filesystems which do not support question marks in names
  Utilise our new p4_read_pipe and p4_write_pipe wrappers
  Add p4 read_pipe and write_pipe wrappers
  bash completion: Add '--merge' long option for 'git log'
  bash completion: Add completion for 'git mergetool'
  git format-patch documentation: clarify what --cover-letter does
  bash completion: 'git apply' should use 'fix' not 'strip'
  t5304-prune: adjust file mtime based on system time rather than file mtime
  test-parse-options: use appropriate cast in length_callback
  Fix escaping of glob special characters in pathspecs
  ...

Conflicts:
builtin-checkout.c

12 years agocheckout: do not write bogus reflog entry out
Junio C Hamano [Wed, 6 Jul 2011 22:14:43 +0000 (15:14 -0700)]
checkout: do not write bogus reflog entry out

As resolve_ref() returns a static buffer that is local to the function,
the caller needs to be sure that it will not have any other calls to the
function before it uses the returned value, or store it away with a
strdup().  The code used old.path to record which branch it used to be on,
so that it can say between which branches the switch took place in the
reflog, but sometimes it failed to do so.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: use [verse] for SYNOPSIS sections
Martin von Zweigbergk [Sat, 2 Jul 2011 02:38:26 +0000 (22:38 -0400)]
Documentation: use [verse] for SYNOPSIS sections

The SYNOPSIS sections of most commands that span several lines already
use [verse] to retain line breaks. Most commands that don't span
several lines seem not to use [verse]. In the HTML output, [verse]
does not only preserve line breaks, but also makes the section
indented, which causes a slight inconsistency between commands that
use [verse] and those that don't. Use [verse] in all SYNOPSIS sections
for consistency.

Also remove the blank lines from git-fetch.txt and git-rebase.txt to
align with the other man pages. In the case of git-rebase.txt, which
already uses [verse], the blank line makes the [verse] not apply to
the last line, so removing the blank line also makes the formatting
within the document more consistent.

While at it, add single quotes to 'git cvsimport' for consistency with
other commands.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodocs: document --textconv diff option
Jeff King [Wed, 6 Jul 2011 15:13:30 +0000 (11:13 -0400)]
docs: document --textconv diff option

This has been there since textconv existed, but was never
documented. There is some overlap with what's in
gitattributes(5), but it's important to warn in both places
that textconv diffs probably can't be applied.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agomergetool: check return value from read
Junio C Hamano [Fri, 1 Jul 2011 23:11:16 +0000 (16:11 -0700)]
mergetool: check return value from read

The process may not even have the standard input open in which case it
will get stuck in an infinite loop to prompt and read nothing.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogitweb: Serve */*+xml 'blob_plain' as text/plain with $prevent_xss
Jakub Narebski [Thu, 30 Jun 2011 09:39:21 +0000 (11:39 +0200)]
gitweb: Serve */*+xml 'blob_plain' as text/plain with $prevent_xss

Enhance usability of 'blob_plain' view protection against XSS attacks
(enabled by setting $prevent_xss to true) by serving contents inline
as safe 'text/plain' mimetype where possible, instead of serving with
"Content-Disposition: attachment" to make sure they don't run in
gitweb's security domain.

This patch broadens downgrading to 'text/plain' further, to any
*/*+xml mimetype.  This includes:

  application/xhtml+xml    (*.xhtml, *.xht)
  application/atom+xml     (*.atom)
  application/rss+xml      (*.rss)
  application/mathml+xm    (*.mathml)
  application/docbook+xml  (*.docbook)
  image/svg+xml            (*.svg, *.svgz)

Probably most useful is serving XHTML files as text/plain in
'blob_plain' view, directly viewable.

Because file with 'image/svg+xml' mimetype can be compressed SVGZ
file, we have to check if */*+xml really is text file, via '-T $fd'.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogitweb: Serve text/* 'blob_plain' as text/plain with $prevent_xss
Jakub Narebski [Thu, 30 Jun 2011 09:39:20 +0000 (11:39 +0200)]
gitweb: Serve text/* 'blob_plain' as text/plain with $prevent_xss

One of mechanism enabled by setting $prevent_xss to true is 'blob_plain'
view protection.  With XSS prevention on, blobs of all types except a
few known safe ones are served with "Content-Disposition: attachment" to
make sure they don't run in our security domain.

Instead of serving text/* type files, except text/plain (and including
text/html), as attachements, downgrade it to text/plain.  This way HTML
pages in 'blob_plain' (raw) view would be displayed in browser, but
safely as a source, and not asked to be saved.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-submodule.sh: preserve stdin for the command spawned by foreach
Brandon Casey [Thu, 30 Jun 2011 00:34:58 +0000 (19:34 -0500)]
git-submodule.sh: preserve stdin for the command spawned by foreach

The user-supplied command spawned by 'submodule foreach' loses its
connection to the original standard input.  Instead, it is connected to the
output of a pipe within the git-submodule script.  The user-supplied
command supplied to 'submodule foreach' is spawned within a while loop
which is being piped into.  Due to the way shells implement piping output
to a while loop, a subshell is created with its standard input attached to
the output of the pipe.  This results in all of the commands executed
within the while loop to have their stdins modified in the same way,
including the user-supplied command.

This can cause a problem if the command requires reading from stdin or if
it changes its behavior based on whether stdin is a tty or not.  For
example, this problem was noticed when trying to execute the following:

   git submodule foreach git shortlog --since=two.weeks.ago

which printed a message about entering the first submodule and produced no
further output and exited with a status of zero.  In this case, shortlog
detected that it was not connected to a tty, and since no revision was
supplied as an argument, it attempted to read the list of revisions from
standard input.  Instead, it slurped up the list of submodules that was
being piped to the enclosing while loop and caused that loop to end early
without processing the remaining submodules.

Work around this behavior by saving the original standard input file
descriptor before the while loop, and restoring it when spawning the
user-supplied command.

This fixes the tests in t7407.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agot/t7407: demonstrate that the command called by 'submodule foreach' loses stdin
Brandon Casey [Thu, 30 Jun 2011 00:34:57 +0000 (19:34 -0500)]
t/t7407: demonstrate that the command called by 'submodule foreach' loses stdin

The user-supplied command spawned by 'submodule foreach' loses its
connection to the original standard input.  Instead, it is connected to the
output of a pipe within the git-submodule script.  This can cause a problem
if the command requires reading from stdin or if it changes its behavior
based on whether stdin is a tty or not (e.g. git shortlog).  Demonstrate
this flaw.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge git://bogomips.org/git-svn into maint
Junio C Hamano [Wed, 29 Jun 2011 23:42:41 +0000 (16:42 -0700)]
Merge git://bogomips.org/git-svn into maint

* git://bogomips.org/git-svn:
  git-svn: Correctly handle root commits in mergeinfo ranges
  git-svn: Disambiguate rev-list arguments to improve error message
  git-svn: Demonstrate a bug with root commits in mergeinfo ranges

12 years agoMerge branch 'maint-1.7.5' into maint
Junio C Hamano [Wed, 29 Jun 2011 23:41:55 +0000 (16:41 -0700)]
Merge branch 'maint-1.7.5' into maint

* maint-1.7.5:
  test: skip clean-up when running under --immediate mode
  "branch -d" can remove more than one branches

12 years agotest: skip clean-up when running under --immediate mode
Junio C Hamano [Mon, 27 Jun 2011 18:02:22 +0000 (11:02 -0700)]
test: skip clean-up when running under --immediate mode

Some tests try to be too careful about cleaning themselves up and
do

    test_expect_success description '
        set-up some test refs and/or configuration &&
        test_when_finished "revert the above changes" &&
the real test
    '

Which is nice to make sure that a potential failure would not have
unexpected interaction with the next test. This however interferes when
"the real test" fails and we want to see what is going on, by running the
test with --immediate mode and descending into its trash directory after
the test stops. The precondition to run the real test and cause it to fail
is all gone after the clean-up procedure defined by test_when_finished is
done.

Update test_run_ which is the workhorse of running a test script
called from test_expect_success and test_expect_failure, so that we do not
run clean-up script defined with test_when_finished when a test that is
expected to succeed fails under the --immediate mode.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
Acked-by: Jeff King <peff@peff.net>
12 years ago"branch -d" can remove more than one branches
Junio C Hamano [Mon, 27 Jun 2011 22:04:32 +0000 (15:04 -0700)]
"branch -d" can remove more than one branches

Since 03feddd (git-check-ref-format: reject funny ref names, 2005-10-13),
"git branch -d" can take more than one branch names to remove.

The documentation was correct, but the usage string was not.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation/i18n: quote double-dash for AsciiDoc
Jonathan Nieder [Wed, 29 Jun 2011 05:36:48 +0000 (00:36 -0500)]
Documentation/i18n: quote double-dash for AsciiDoc

As explained in v1.7.3-rc0~13^2 (Work around em-dash handling in newer
AsciiDoc, 2010-08-23), if double dashes in names of commands are not
escaped, AsciiDoc renders them as em dashes.

While fixing that, spell the command name as "git sh-i18n--envsubst"
(2 words) instead of emphasizing the name of the binary (one
hyphenated name) and format it in italics.

The double-dash in the title should be escaped, too, to avoid spurious
em dashes in the header:

  .TH "GIT\-SH\-I18N\(emENVSUB" "1" "06/26/2011" "Git 1\&.7\&.6" "Git Manual"

AsciiDoc 8.6.4 with DocBook XSL 1.76.0-RC1 copes fine and writes
"GIT\-SH\-I18N\-\-ENVSUB" even without this change, which is why it
was missed before.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'jn/maint-doc-dashdash' into jn/doc-dashdash
Junio C Hamano [Wed, 29 Jun 2011 16:25:51 +0000 (09:25 -0700)]
Merge branch 'jn/maint-doc-dashdash' into jn/doc-dashdash

* jn/maint-doc-dashdash:
  Documentation: quote double-dash for AsciiDoc

12 years agoDocumentation: quote double-dash for AsciiDoc
Jonathan Nieder [Wed, 29 Jun 2011 05:35:10 +0000 (00:35 -0500)]
Documentation: quote double-dash for AsciiDoc

AsciiDoc versions since 5.0.6 treat a double-dash surrounded by spaces
(outside of verbatim environments) as a request to insert an em dash.
Such versions also treat the three-character sequence "\--", when not
followed by another dash, as a request to insert two literal minus
signs.  Thus from time to time there have been patches to add
backslashes to AsciiDoc markup to escape double-dashes that are meant
to be represent '--' characters used literally on the command line;
see v1.4.0-rc1~174, Fix up docs where "--" isn't displayed correctly,
2006-05-05, for example.

AsciiDoc 6.0.3 (2005-04-20) made life harder by also treating
double-dashes without surrounding whitespace as markup for an em dash,
though only when formatting for backends other than the manpages
(e.g., HTML).  Many pages needed to be changed to use a backslash
before the "--" in names of command-line flags like "--add" (see
v0.99.6~37, Update tutorial, 2005-08-30).

AsciiDoc 8.3.0 (2008-11-29) refined the em-dash rule to avoid that
requirement.  Double-dashes without surrounding spaces are not
rendered as em dashes any more unless bordered on both sides by
alphanumeric characters.  The unescaped markup for option names (e.g.,
"--add") works fine, and many instances of this style have leaked into
Documentation/; git's HTML documentation contains many spurious em
dashes when formatted by an older toolchain.  (This patch will not
change that.)

The upshot: "--" as an isolated word and in phrases like "git
web--browse" must be escaped if it is not to be rendered as an em dash
by current asciidoc.  Use "\--" to avoid such misformatting in
sentences in which "--" represents a literal double-minus command line
argument that separates options and revs from pathspecs, and use
"{litdd}" in cases where the double-dash is embedded in the command
name.  The latter is just for consistency with v1.7.3-rc0~13^2 (Work
around em-dash handling in newer AsciiDoc, 2010-08-23).

List of lines to fix found by grepping manpages for "(em".

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
Improved-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-svn: Correctly handle root commits in mergeinfo ranges
Michael Haggerty [Sat, 18 Jun 2011 06:48:00 +0000 (08:48 +0200)]
git-svn: Correctly handle root commits in mergeinfo ranges

If the bottom of a mergeinfo range is a commit that maps to a git root
commit, then it doesn't have a parent.  In such a case, use git commit
range "$top_commit" rather than "$bottom_commit^..$top_commit".

[ew: line-wrap at 80 columns]

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
12 years agogit-svn: Disambiguate rev-list arguments to improve error message
Michael Haggerty [Sat, 18 Jun 2011 06:47:59 +0000 (08:47 +0200)]
git-svn: Disambiguate rev-list arguments to improve error message

Add "--" in the "git rev-list" command line so that if there is a bug
and the revisions cannot be found, the error message is a bit less
cryptic.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
12 years agogit-svn: Demonstrate a bug with root commits in mergeinfo ranges
Michael Haggerty [Sat, 18 Jun 2011 06:47:58 +0000 (08:47 +0200)]
git-svn: Demonstrate a bug with root commits in mergeinfo ranges

If a svn:mergeinfo range starts at a commit that was converted as a
git root commit (e.g., r1 or a branch that was created out of thin
air), then there is an error when git-svn tries to run

    git rev-list "$bottom_commit^..$top_commit"

because $bottom_commit (the git commit corresponding to r1) has no
parent.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Eric Wong <normalperson@yhbt.net>
12 years agosubmodule add: always initialize .git/config entry
Jens Lehmann [Sat, 25 Jun 2011 23:26:02 +0000 (01:26 +0200)]
submodule add: always initialize .git/config entry

When "git submodule add $path" is run to add a subdirectory $path to the
superproject, and $path is already the top of the working tree of the
submodule repository, the command created submodule.$path.url entry in the
configuration file in the superproject. However, when adding a repository
$URL that is outside the respository of the superproject to $path that
does not exist (yet) with "git submodule add $URL $path", the command
forgot to set it up.

The user is expressing the interest in the submodule and wants to keep a
checkout, the "submodule add" command should consistently set up the
submodule.$path.url entry in either case.

As a result "git submodule init" can't simply skip the initialization of
those submodules for which it finds an url entry in the git./config
anymore. That lead to problems when adding a submodule (which now sets the
url), add the "update" setting to .gitmodules and expect init to copy that
into .git/config like it is done in t7406. So change init to only then
copy the "url" and "update" entries when they don't exist yet in the
.git/config and do nothing otherwise.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agosubmodule sync: do not auto-vivify uninteresting submodule
Junio C Hamano [Sat, 25 Jun 2011 20:41:25 +0000 (22:41 +0200)]
submodule sync: do not auto-vivify uninteresting submodule

Earlier 33f072f (submodule sync: Update "submodule.<name>.url" for empty
directories, 2010-10-08) attempted to fix a bug where "git submodule sync"
command does not update the URL if the current superproject does not have
a checkout of the submodule.

However, it did so by unconditionally registering submodule.$name.url to
every submodule in the project, even the ones that the user has never
showed interest in at all by running 'git submodule init' command. This
caused subsequent 'git submodule update' to start cloning/updating submodules
that are not interesting to the user at all.

Update the code so that the URL is updated from the .gitmodules file only
for submodules that already have submodule.$name.url entries, i.e. the
ones the user has showed interested in having a checkout.

Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.6 v1.7.6
Junio C Hamano [Sun, 26 Jun 2011 19:41:16 +0000 (12:41 -0700)]
Git 1.7.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint'
Junio C Hamano [Sun, 26 Jun 2011 19:09:11 +0000 (12:09 -0700)]
Merge branch 'maint'

* maint:
  completion: replace core.abbrevguard to core.abbrev

12 years agoMerge branch 'maint-1.7.4' into maint
Junio C Hamano [Fri, 24 Jun 2011 16:40:02 +0000 (09:40 -0700)]
Merge branch 'maint-1.7.4' into maint

* maint-1.7.4:
  completion: replace core.abbrevguard to core.abbrev

12 years agocompletion: replace core.abbrevguard to core.abbrev
Namhyung Kim [Fri, 24 Jun 2011 06:17:42 +0000 (15:17 +0900)]
completion: replace core.abbrevguard to core.abbrev

The core.abbrevguard config variable had removed and
now core.abbrev has been used instead. Teach it.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoglossary: clarify description of HEAD
Junio C Hamano [Thu, 23 Jun 2011 16:48:49 +0000 (09:48 -0700)]
glossary: clarify description of HEAD

HEAD on a branch does reference a commit via the branch ref it refers to.
The main difference of a detached HEAD is that it _directly_ refers to
a commit.  Clarify this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoglossary: update description of head and ref
Junio C Hamano [Thu, 23 Jun 2011 16:47:28 +0000 (09:47 -0700)]
glossary: update description of head and ref

Reword them to avoid sounding as if loose refs are the only ones in the world.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoglossary: update description of "tag"
Junio C Hamano [Thu, 23 Jun 2011 16:38:48 +0000 (09:38 -0700)]
glossary: update description of "tag"

It is an unimportant implementation detail that ref namespaces are
implemented as subdirectories of $GIT_DIR/refs. What is more important
is that tags are in refs/tags hierarchy in the ref namespace.

Also note that a tag can point at an object of arbitrary type, not limited
to commit.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit.txt: de-emphasize the implementation detail of a ref
Junio C Hamano [Thu, 23 Jun 2011 16:35:10 +0000 (09:35 -0700)]
git.txt: de-emphasize the implementation detail of a ref

It is an unimportant implementation detail that branches and tags are
stored somewhere under $GIT_DIR/refs directory, or the name of the commit
that will become the parent of the next commit is stored in $GIT_DIR/HEAD.

What is more important is that branches live in refs/heads and tags live
in refs/tags hierarchy in the ref namespace, and HEAD means the tip of the
current branch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocheck-ref-format doc: de-emphasize the implementation detail of a ref
Junio C Hamano [Thu, 23 Jun 2011 16:31:19 +0000 (09:31 -0700)]
check-ref-format doc: de-emphasize the implementation detail of a ref

It is an unimportant implementation detail that branches and tags are
stored somewhere under $GIT_DIR/refs directory. What is more important
is that branches live in refs/heads and tags live in refs/tags hierarchy
in the ref namespace.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-remote.txt: avoid sounding as if loose refs are the only ones in the world
Junio C Hamano [Thu, 23 Jun 2011 15:33:05 +0000 (08:33 -0700)]
git-remote.txt: avoid sounding as if loose refs are the only ones in the world

It was correct to say "The file $GIT_DIR/refs/heads/master stores the
commit object name at the tip of the master branch" in the older days,
but not anymore, as refs can be packed into $GIT_DIR/packed-refs file.

Update the document to talk in terms of a more abstract concept "ref" and
"symbolic ref" where we are not describing the underlying implementation
detail.

This on purpose leaves two instances of $GIT_DIR/ in the git-remote
documentation; they do talk about $GIT_DIR/remotes/ and $GIT_DIR/branches/
file hierarchy that used to be the place to store configuration around
remotes before the configuration mechanism took them over.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit-remote.txt: fix wrong remote refspec
Namhyung Kim [Thu, 23 Jun 2011 08:12:04 +0000 (17:12 +0900)]
git-remote.txt: fix wrong remote refspec

$GIT_DIR/remotes/<name>/<branch> should be
$GIT_DIR/refs/remotes/<name>/<branch>.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoGit 1.7.6-rc3 v1.7.6-rc3
Junio C Hamano [Wed, 22 Jun 2011 23:13:16 +0000 (16:13 -0700)]
Git 1.7.6-rc3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint'
Junio C Hamano [Wed, 22 Jun 2011 21:01:18 +0000 (14:01 -0700)]
Merge branch 'maint'

* maint:
  Documentation: git diff --check respects core.whitespace

12 years agoMakefile: Track changes to LDFLAGS and relink when necessary
Fredrik Kuivinen [Wed, 22 Jun 2011 10:50:56 +0000 (12:50 +0200)]
Makefile: Track changes to LDFLAGS and relink when necessary

Some profiling tools (e.g., google-perftools and mutrace) work by
linking in a new library into the executables. When using these tools
it is convenient to only relink instead of doing a full make clean;
make cycle.

This change complements the auto-detection of changes to CFLAGS that
we already have. Tracking of more variables that affect the build can
be added when the need arise.

Signed-off-by: Fredrik Kuivinen <frekui@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoDocumentation: git diff --check respects core.whitespace
Christof Krüger [Wed, 22 Jun 2011 15:33:02 +0000 (17:33 +0200)]
Documentation: git diff --check respects core.whitespace

Fix documentation on "git diff --check" by adopting the description from
"git apply --whitespace".

Signed-off-by: Christof Krüger <git@christof-krueger.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoconfig: use strbuf_split_str instead of a temporary strbuf
Jeff King [Thu, 9 Jun 2011 15:55:09 +0000 (11:55 -0400)]
config: use strbuf_split_str instead of a temporary strbuf

This saves an allocation and copy, and also fixes a minor
memory leak.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agostrbuf: allow strbuf_split to work on non-strbufs
Jeff King [Thu, 9 Jun 2011 15:54:58 +0000 (11:54 -0400)]
strbuf: allow strbuf_split to work on non-strbufs

The strbuf_split function takes a strbuf as input, and
outputs a list of strbufs. However, there is no reason that
the input has to be a strbuf, and not an arbitrary buffer.

This patch adds strbuf_split_buf for a length-delimited
buffer, and strbuf_split_str for NUL-terminated strings.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoconfig: avoid segfault when parsing command-line config
Jeff King [Thu, 9 Jun 2011 15:52:43 +0000 (11:52 -0400)]
config: avoid segfault when parsing command-line config

We already check for an empty key on the left side of an
equals, but we would segfault if there was no content at
all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoconfig: die on error in command-line config
Jeff King [Thu, 9 Jun 2011 15:52:32 +0000 (11:52 -0400)]
config: die on error in command-line config

The error handling for git_config is somewhat confusing. We
collect errors from running git_config_from_file on the
various config files and carefully pass them back up. But
the two odd things are:

  1. We actually die on most errors in git_config_from_file.
     In fact, the only error we actually pass back up is if
     fopen() fails on the file.

  2. Most callers of git_config do not check the error
     return at all, but will continue if git_config reports
     an error.

When the code for "git -c core.foo=bar" was added, it
dutifully passed errors up the call stack, only for them to
be eventually ignored. This makes it inconsistent with the
file-parsing code, which will die when it sees malformed
config. And it's somewhat unsafe, because it means an error
in parsing a typo like:

  git -c clean.requireforce=ture clean

will continue the command, ignoring the config the user
tried to give.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agofix "git -c" parsing of values with equals signs
Jeff King [Thu, 9 Jun 2011 15:51:36 +0000 (11:51 -0400)]
fix "git -c" parsing of values with equals signs

If you do something like:

  git -c core.foo="value with = in it" ...

we would split your option on "=" into three fields and
throw away the third one. With this patch we correctly take
everything after the first "=" as the value (keys cannot
have an equals sign in them, so the parsing is unambiguous).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agostrbuf_split: add a max parameter
Jeff King [Thu, 9 Jun 2011 15:51:22 +0000 (11:51 -0400)]
strbuf_split: add a max parameter

Sometimes when splitting, you only want a limited number of
fields, and for the final field to contain "everything
else", even if it includes the delimiter.

This patch introduces strbuf_split_max, which provides a
"max number of fields" parameter; it behaves similarly to
perl's "split" with a 3rd field.

The existing 2-argument form of strbuf_split is retained for
compatibility and ease-of-use.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Tue, 21 Jun 2011 21:56:59 +0000 (14:56 -0700)]
Merge branch 'maint'

* maint:
  gitweb: 'pickaxe' and 'grep' features requires 'search' to be enabled

13 years agogitweb: 'pickaxe' and 'grep' features requires 'search' to be enabled
Jakub Narebski [Tue, 21 Jun 2011 06:41:16 +0000 (08:41 +0200)]
gitweb: 'pickaxe' and 'grep' features requires 'search' to be enabled

Both 'pickaxe' (searching changes) and 'grep' (searching files)
require basic 'search' feature to be enabled to work.  Enabling
e.g. only 'pickaxe' won't work.

Add a comment about this.

Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'mk/grep-pcre'
Junio C Hamano [Mon, 20 Jun 2011 21:49:44 +0000 (14:49 -0700)]
Merge branch 'mk/grep-pcre'

* mk/grep-pcre:
  t7810: avoid unportable use of "echo"

13 years agot7810: avoid unportable use of "echo"
Junio C Hamano [Mon, 20 Jun 2011 21:49:34 +0000 (14:49 -0700)]
t7810: avoid unportable use of "echo"

Michael J Gruber noticed that under /bin/dash this test failed
(as is expected -- \n in the string can be interpreted by the
command), while it passed with bash.  We probably could work it
around by using backquote in front of it, but it is safer and
more readable to avoid "echo" altogether in a case like this.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoplug a few coverity-spotted leaks
Jim Meyering [Mon, 20 Jun 2011 07:40:06 +0000 (09:40 +0200)]
plug a few coverity-spotted leaks

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agocygwin: trust executable bit by default
Junio C Hamano [Mon, 20 Jun 2011 19:31:59 +0000 (12:31 -0700)]
cygwin: trust executable bit by default

Earlier 7974843 (compat/cygwin.c: make runtime detection of lstat/stat
lessor impact, 2008-10-23) fixed the low-level "do we use cygwin specific
hacks for stat/lstat?" logic not to call into git_default_config() from
random codepaths that are typically very late in the program, to prevent
the call from potentially overwriting other variables that are initialized
from the configuration.

However, it forgot that on Cygwin, trust-executable-bit should default to
true.

Noticed by J6t, confirmed by Ramsay Jones, and the brown paper bag is on
Gitster's head.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofetch: Also fetch submodules in subdirectories in on-demand mode
Jens Lehmann [Mon, 20 Jun 2011 18:18:03 +0000 (20:18 +0200)]
fetch: Also fetch submodules in subdirectories in on-demand mode

When on-demand mode was active examining the new commits just fetched in
the superproject (to check if they record commits for submodules which are
not downloaded yet) wasn't done recursively. Because of that fetch did not
recursively fetch submodules living in subdirectories even when it should
have.

Fix that by adding the RECURSIVE flag to the diff_options used to check
the new commits and avoid future regressions in this area by moving a
submodule in t5526 into a subdirectory.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotag: accept multiple patterns for --list
Jeff King [Mon, 20 Jun 2011 16:59:28 +0000 (12:59 -0400)]
tag: accept multiple patterns for --list

Until now, "git tag -l foo* bar*" would silently ignore the
second argument, showing only refs starting with "foo". It's
not just unfriendly not to take a second pattern; we
actually generated subtly wrong results (from the user's
perspective) because some of the requested tags were
omitted.

This patch allows an arbitrary number of patterns on the
command line; if any of them matches, the ref is shown.

While we're tweaking the documentation, let's also make it
clear that the pattern is fnmatch.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'di/no-no-existant'
Junio C Hamano [Sun, 19 Jun 2011 23:01:54 +0000 (16:01 -0700)]
Merge branch 'di/no-no-existant'

* di/no-no-existant:
  Fix typo: existant->existent

13 years agoMerge branch 'maint'
Junio C Hamano [Sun, 19 Jun 2011 23:01:51 +0000 (16:01 -0700)]
Merge branch 'maint'

* maint:
  builtin/gc.c: add missing newline in message

13 years agobuiltin/gc.c: add missing newline in message
Andreas Schwab [Sun, 19 Jun 2011 08:03:26 +0000 (10:03 +0200)]
builtin/gc.c: add missing newline in message

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agorebase -i -p: include non-first-parent commits in todo list
Andrew Wong [Sat, 18 Jun 2011 22:12:01 +0000 (18:12 -0400)]
rebase -i -p: include non-first-parent commits in todo list

Consider this graph:

        D---E    (topic, HEAD)
       /   /
  A---B---C      (master)
   \
    F            (topic2)

and the following three commands:
  1. git rebase -i -p A
  2. git rebase -i -p --onto F A
  3. git rebase -i -p B

Currently, (1) and (2) will pick B, D, C, and E onto A and F,
respectively.  However, (3) will only pick D and E onto B, but not C,
which is inconsistent with (1) and (2).  As a result, we cannot modify C
during the interactive-rebase.

The current behavior also creates a bug if we do:
  4. git rebase -i -p C

In (4), E is never picked.  And since interactive-rebase resets "HEAD"
to "onto" before picking any commits, D and E are lost after the
interactive-rebase.

This patch fixes the inconsistency and bug by ensuring that all children
of upstream are always picked.  This essentially reverts the commit:
  d80d6bc146232d81f1bb4bc58e5d89263fd228d4

When compiling the todo list, commits reachable from "upstream" should
never be skipped under any conditions.  Otherwise, we lose the ability
to modify them like (3), and create a bug like (4).

Two of the tests contain a scenario like (3).  Since the new behavior
added more commits for picking, these tests need to be updated to
account for the additional pick lines.  A new test has also been added
for (4).

Signed-off-by: Andrew Wong <andrew.kw.w@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotests: link shell libraries into valgrind directory
Jeff King [Fri, 17 Jun 2011 20:36:32 +0000 (16:36 -0400)]
tests: link shell libraries into valgrind directory

When we run tests under valgrind, we symlink anything
executable that starts with git-* or test-* into a special
valgrind bin directory, and then make that our
GIT_EXEC_PATH.

However, shell libraries like git-sh-setup do not have the
executable bit marked, and did not get symlinked.  This
means that any test looking for shell libraries in our
exec-path would fail to find them, even though that is a
fine thing to do when testing against a regular git build
(or in a git install, for that matter).

t2300 demonstrated this problem. The fix is to symlink these
shell libraries directly into the valgrind directory.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/Makefile: pass test opts to valgrind target properly
Jeff King [Fri, 17 Jun 2011 08:29:57 +0000 (04:29 -0400)]
t/Makefile: pass test opts to valgrind target properly

The valgrind target just reinvokes make with GIT_TEST_OPTS
set to "--valgrind". However, it does this using an
environment variable, which means GIT_TEST_OPTS in your
config.mak would override it, and "make valgrind" would
simply run the test suite without valgrind on.

Instead, we should pass GIT_TEST_OPTS on the command-line,
overriding what's in config.mak, and take care to append to
whatever the user has there already.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'ab/i18n-scripts-basic'
Junio C Hamano [Fri, 17 Jun 2011 18:40:32 +0000 (11:40 -0700)]
Merge branch 'ab/i18n-scripts-basic'

* ab/i18n-scripts-basic:
  sh-i18n--envsubst.c: do not #include getopt.h

13 years agosh-i18n--envsubst.c: do not #include getopt.h
Brandon Casey [Fri, 17 Jun 2011 18:19:26 +0000 (11:19 -0700)]
sh-i18n--envsubst.c: do not #include getopt.h

The getopt.h header file is not used.  It's inclusion is left over from the
original version of this source.  Additionally, getopt.h does not exist on
all platforms (SunOS 5.7) and will cause a compilation failure.  So, let's
remove it.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix typo: existant->existent
Dmitry Ivankov [Thu, 16 Jun 2011 13:42:48 +0000 (19:42 +0600)]
Fix typo: existant->existent

refs.c had a error message "Trying to write ref with nonexistant object".
And no tests relied on the wrong spelling.
Also typo was present in some test scripts internals, these tests still pass.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.6-rc2 v1.7.6-rc2
Junio C Hamano [Thu, 16 Jun 2011 16:21:36 +0000 (09:21 -0700)]
Git 1.7.6-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agot/gitweb-lib.sh: skip gitweb tests when perl dependencies are not met
Junio C Hamano [Wed, 15 Jun 2011 16:54:15 +0000 (09:54 -0700)]
t/gitweb-lib.sh: skip gitweb tests when perl dependencies are not met

Linus noticed that we go ahead testing gitweb and fail miserably on a
box with Perl but not perl-CGI library. We already have a code to detect
lack of Perl and refrain from testing gitweb in t/gitweb-lib.sh (by the
way, shouldn't it be called t/lib-gitweb.sh?), so let's extend it
to cover this case as well.

Acked-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agotag: speed up --contains calculation
Jeff King [Sat, 11 Jun 2011 19:04:08 +0000 (19:04 +0000)]
tag: speed up --contains calculation

When we want to know if commit A contains commit B (or any
one of a set of commits, B through Z), we generally
calculate the merge bases and see if B is a merge base of A
(or for a set, if any of the commits B through Z have that
property).

When we are going to check a series of commits A1 through An
to see whether each contains B (e.g., because we are
deciding which tags to show with "git tag --contains"), we
do a series of merge base calculations. This can be very
expensive, as we repeat a lot of traversal work.

Instead, let's leverage the fact that we are going to use
the same --contains list for each tag, and mark areas of the
commit graph is definitely containing those commits, or
definitely not containing those commits. Later tags can then
stop traversing as soon as they see a previously calculated
answer.

This sped up "git tag --contains HEAD~200" in the linux-2.6
repository from:

  real    0m15.417s
  user    0m15.197s
  sys     0m0.220s

to:

  real    0m5.329s
  user    0m5.144s
  sys     0m0.184s

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: allow feeding more than 4GB in one go
Junio C Hamano [Fri, 10 Jun 2011 19:15:17 +0000 (12:15 -0700)]
zlib: allow feeding more than 4GB in one go

Update zlib_post_call() that adjusts the wrapper's notion of avail_in and
avail_out to what came back from zlib, so that the callers can feed
buffers larger than than 4GB to the API.

When underlying inflate/deflate stopped processing because we fed a buffer
larger than 4GB limit, detect that case, update the state variables, and
let the zlib function work another round.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: zlib can only process 4GB at a time
Junio C Hamano [Fri, 10 Jun 2011 18:52:15 +0000 (11:52 -0700)]
zlib: zlib can only process 4GB at a time

The size of objects we read from the repository and data we try to put
into the repository are represented in "unsigned long", so that on larger
architectures we can handle objects that weigh more than 4GB.

But the interface defined in zlib.h to communicate with inflate/deflate
limits avail_in (how many bytes of input are we calling zlib with) and
avail_out (how many bytes of output from zlib are we ready to accept)
fields effectively to 4GB by defining their type to be uInt.

In many places in our code, we allocate a large buffer (e.g. mmap'ing a
large loose object file) and tell zlib its size by assigning the size to
avail_in field of the stream, but that will truncate the high octets of
the real size. The worst part of this story is that we often pass around
z_stream (the state object used by zlib) to keep track of the number of
used bytes in input/output buffer by inspecting these two fields, which
practically limits our callchain to the same 4GB limit.

Wrap z_stream in another structure git_zstream that can express avail_in
and avail_out in unsigned long. For now, just die() when the caller gives
a size that cannot be given to a single zlib call. In later patches in the
series, we would make git_inflate() and git_deflate() internally loop to
give callers an illusion that our "improved" version of zlib interface can
operate on a buffer larger than 4GB in one go.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: wrap deflateBound() too
Junio C Hamano [Fri, 10 Jun 2011 18:18:17 +0000 (11:18 -0700)]
zlib: wrap deflateBound() too

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: wrap deflate side of the API
Junio C Hamano [Fri, 10 Jun 2011 17:55:10 +0000 (10:55 -0700)]
zlib: wrap deflate side of the API

Wrap deflateInit, deflate, and deflateEnd for everybody, and the sole use
of deflateInit2 in remote-curl.c to tell the library to use gzip header
and trailer in git_deflate_init_gzip().

There is only one caller that cares about the status from deflateEnd().
Introduce git_deflate_end_gently() to let that sole caller retrieve the
status and act on it (i.e. die) for now, but we would probably want to
make inflate_end/deflate_end die when they ran out of memory and get
rid of the _gently() kind.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: wrap inflateInit2 used to accept only for gzip format
Junio C Hamano [Fri, 10 Jun 2011 17:45:29 +0000 (10:45 -0700)]
zlib: wrap inflateInit2 used to accept only for gzip format

http-backend.c uses inflateInit2() to tell the library that it wants to
accept only gzip format. Wrap it in a helper function so that readers do
not have to wonder what the magic numbers 15 and 16 are for.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib: wrap remaining calls to direct inflate/inflateEnd
Junio C Hamano [Fri, 10 Jun 2011 17:39:27 +0000 (10:39 -0700)]
zlib: wrap remaining calls to direct inflate/inflateEnd

Two callsites in http-backend.c to inflate() and inflateEnd()
were not using git_ prefixed versions.  After this, running

    $ find all objects -print | xargs nm -ugo | grep inflate

shows only zlib.c makes direct calls to zlib for inflate operation,
except for a singlecall to inflateInit2 in http-backend.c

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agozlib wrapper: refactor error message formatter
Junio C Hamano [Fri, 10 Jun 2011 17:31:34 +0000 (10:31 -0700)]
zlib wrapper: refactor error message formatter

Before refactoring the main part of the wrappers, first move the
logic to convert error status that come back from zlib to string
to a helper function.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agogitweb: do not misparse nonnumeric content tag files that contain a digit
Jonathan Nieder [Thu, 9 Jun 2011 07:08:57 +0000 (02:08 -0500)]
gitweb: do not misparse nonnumeric content tag files that contain a digit

v1.7.6-rc0~27^2~4 (gitweb: Change the way "content tags" ('ctags') are
handled, 2011-04-29) tried to make gitweb's tag cloud feature more
intuitive for webmasters by checking whether the ctags/<label> under
a project's .git dir contains a number (representing the strength of
association to <label>) before treating it as one.

With that change, after putting '$feature{'ctags'}{'default'} = [1];'
in your $GITWEB_CONFIG, you could do

echo Linux >.git/ctags/linux

and gitweb would treat that as a request to tag the current repository
with the Linux tag, instead of the previous behavior of writing an
error page embedded in the projects list that triggers error messages
from Chromium and Firefox about malformed XML.

Unfortunately the pattern (\d+) used to match numbers is too loose,
and the "XML declaration allowed only at the start of the document"
error can still be experienced if you write "Linux-2.6" in place of
"Linux" in the example above.  Fix it by tightening the pattern to
^\d+$.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoGit 1.7.6-rc1 v1.7.6-rc1
Junio C Hamano [Thu, 9 Jun 2011 01:29:48 +0000 (18:29 -0700)]
Git 1.7.6-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'maint'
Junio C Hamano [Thu, 9 Jun 2011 01:13:39 +0000 (18:13 -0700)]
Merge branch 'maint'

* maint:
  fetch: do not leak a refspec

13 years agoDocument the underlying protocol used by shallow repositories and --depth commands.
Alex Neronskiy [Wed, 8 Jun 2011 22:11:51 +0000 (15:11 -0700)]
Document the underlying protocol used by shallow repositories and --depth commands.

Explain the exchange that occurs between a client and server when
the client is requesting shallow history and/or is already using
a shallow repository.

Signed-off-by: Alex Neronskiy <zakmagnus@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoFix documentation of fetch-pack that implies that the client can disconnect after...
Alex Neronskiy [Wed, 8 Jun 2011 22:11:50 +0000 (15:11 -0700)]
Fix documentation of fetch-pack that implies that the client can disconnect after sending wants.

Specify conditions under which the client can terminate the connection
early. Previously, an unintended behavior was possible which could
confuse servers.

Based-on-patch-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Alex Neronskiy <zakmagnus@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agofetch: do not leak a refspec
Jim Meyering [Wed, 8 Jun 2011 20:06:33 +0000 (22:06 +0200)]
fetch: do not leak a refspec

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosha1_file.c: "legacy" is really the current format
Junio C Hamano [Wed, 8 Jun 2011 18:29:01 +0000 (11:29 -0700)]
sha1_file.c: "legacy" is really the current format

Every time I look at the read-loose-object codepath, legacy_loose_object()
function makes my brain go through mental contortion. When we were playing
with the experimental loose object format, it may have made sense to call
the traditional format "legacy", in the hope that the experimental one
will some day replace it to become official, but it never happened.

This renames the function (and negates its return value) to detect if we
are looking at the experimental format, and move the code around in its
caller which used to do "if we are looing at legacy, do this special case,
otherwise the normal case is this". The codepath to read from the loose
objects in experimental format is the "unlikely" case.

Someday after Git 2.0, we should drop the support of this format.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jc/magic-pathspec'
Junio C Hamano [Tue, 7 Jun 2011 15:32:42 +0000 (08:32 -0700)]
Merge branch 'jc/magic-pathspec'

* jc/magic-pathspec:
  t3703: skip more tests using colons in file names on Windows

13 years agot3703: skip more tests using colons in file names on Windows
Alex Riesen [Tue, 7 Jun 2011 09:49:44 +0000 (11:49 +0200)]
t3703: skip more tests using colons in file names on Windows

Use the same test and prerequisite as introduced in similar
fix in 650af7ae8bdf92bd92df2.

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosubmodule add: clean up duplicated code
Jens Lehmann [Mon, 6 Jun 2011 19:58:43 +0000 (21:58 +0200)]
submodule add: clean up duplicated code

In cmd_add() the switch statement used to resolve a relative url was
present twice. Remove the second one and use the realrepo variable set
by the first one (lines 194 ff.) instead.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosubmodule add: allow relative repository path even when no url is set
Jens Lehmann [Mon, 6 Jun 2011 19:58:04 +0000 (21:58 +0200)]
submodule add: allow relative repository path even when no url is set

Adding a submodule with a relative repository path did only succeed when
the superproject's default remote was set. But when that is unset, the
superproject is its own authoritative upstream, so lets use its working
directory as upstream instead.

This allows users to set up a new superpoject where the submodules urls
are configured relative to the superproject's upstream while its default
remote can be configured later.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agosubmodule add: test failure when url is not configured in superproject
Jens Lehmann [Mon, 6 Jun 2011 19:57:01 +0000 (21:57 +0200)]
submodule add: test failure when url is not configured in superproject

This documents the current behavior (submodule add with the url set in the
superproject is already tested in t7403, t7406, t7407 and t7506).

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
13 years agoMerge branch 'jn/mime-type-with-params'
Junio C Hamano [Mon, 6 Jun 2011 18:40:22 +0000 (11:40 -0700)]
Merge branch 'jn/mime-type-with-params'

* jn/mime-type-with-params:
  gitweb: Fix usability of $prevent_xss