Commit graph

26117 commits

Author SHA1 Message Date
张忠山 927cd1fc94 gitweb: pass string after encoding in utf-8 to syntax highlighter
Otherwise the highlight filter would work on a corrupt byte sequence.

Signed-off-by: 张忠山 <zzs213@126.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 12:13:38 -07:00
Jon Jensen 0d7c01c991 Add option hooks.diffopts to customize change summary in post-receive-email
This makes it easy to customize the git diff-tree options, for example
to include -p to include inline diffs.

It defaults to the current options "--stat --summary --find-copies-harder"
and thus is backward-compatible.

Signed-off-by: Jon Jensen <jon@endpoint.com>
Improved-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 12:06:49 -07:00
Junio C Hamano 6a319e393b Merge branch 'maint'
* maint:
  add gitignore entry to description about how to write a builtin
  gitattributes: Reword "attribute macro" to "macro attribute"
  gitattributes: Clarify discussion of attribute macros
2011-08-03 14:16:17 -07:00
Heiko Voigt e9e0643fe6 add gitignore entry to description about how to write a builtin
If the author forgets the gitignore entry the built result will show up
as new file in the git working directory.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 11:44:23 -07:00
Tay Ray Chuan d24d905509 Makefile: some changes for http-related flag documentation
Rename git-http-pull to git-http-fetch. This was passed over in 215a7ad
(Big tool rename, Wed Sep 7 17:26:23 2005 -0700).

Also, distinguish between dumb and smart in flag docs, as the "warnings"
in NO_CURL and NO_EXPACT are no longer accurate given the introduction
of smart http(s).

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 11:24:28 -07:00
Tay Ray Chuan ec99c9a89a http.c: fix an invalid free()
Remove a free() on the static buffer returned by sha1_file_name().

While we're at it, replace xmalloc() calls on the structs
http_(object|pack)_request with xcalloc() so that pointers in the
structs get initialized to NULL. That way, free()'s are safe - for
example, a free() on the url string member when aborting.

This fixes an invalid free().

Reported-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Helped-by: Jeff King peff@peff.net
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 11:23:09 -07:00
Michael Haggerty 0922570c76 gitattributes: Reword "attribute macro" to "macro attribute"
The new wording makes it clearer that such a beast is an attribute in
addition to being a macro (as opposed to being only a macro that is
used for attributes).

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 10:32:54 -07:00
Michael Haggerty 98e8406632 gitattributes: Clarify discussion of attribute macros
In particular, make it clear that attribute macros are themselves
recorded as attributes in addition to setting other attributes.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 10:32:02 -07:00
Johannes Sixt 1b57e56c61 Skip archive --remote tests on Windows
These depend on a working git-upload-archive, which is broken on Windows,
because it depends on fork().

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 10:16:20 -07:00
Clemens Buchacher 8894d53580 commit: allow partial commits with relative paths
In order to do partial commits, git-commit overlays a tree on the
cache and checks pathspecs against the result. Currently, the
overlaying is done using "prefix" which prevents relative pathspecs
with ".." and absolute pathspec from matching when they refer to
files not under "prefix" and absent from the index, but still in
the tree (i.e.  files staged for removal).

The point of providing a prefix at all is performance optimization.
If we say there is no common prefix for the files of interest, then
we have to read the entire tree into the index.

But even if we cannot use the working directory as a prefix, we can
still figure out if there is a common prefix for all given paths,
and use that instead. The pathspec_prefix() routine from ls-files.c
does exactly that.

Any use of global variables is removed from pathspec_prefix() so
that it can be called from commit.c.

Reported-by: Reuben Thomas <rrt@sc3d.org>
Analyzed-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-02 14:20:35 -07:00
René Scharfe 317f63c21c grep: long context options
Take long option names for -A (--after-context), -B (--before-context)
and -C (--context) from GNU grep and add a similar long option name
for -W (--function-context).

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 16:11:50 -07:00
René Scharfe ba8ea7496f grep: add option to show whole function as context
Add a new option, -W, to show the whole surrounding function of a match.

It uses the same regular expressions as -p and diff to find the beginning
of sections.

Currently it will not display comments in front of a function, but those
that are following one.  Despite this shortcoming it is already useful,
e.g. to simply see a more complete applicable context or to extract whole
functions.

Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 16:09:15 -07:00
Ori Avtalion c98d1e4148 pull: remove extra space from reflog message
When executing "git pull" with no arguments, the reflog message was:
  "pull : Fast-forward"

Signed-off-by: Ori Avtalion <ori@avtalion.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 16:05:44 -07:00
Jens Lehmann 402e8a6d9a Documentation/submodule: add command references and update options
Reference the "git diff" and "git status" commands where they learned
functionality that in earlier git versions was only available through the
'summary' and 'status' subcommands of "git submodule".

The short option '-n' for '--summary-limit' was missing from the synopsis
and the --init option was missing from the "options" section, add those
there. And while at it, quote all options in backticks so they are
decorated properly in the output formats which support that.

Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 15:34:22 -07:00
Junio C Hamano e06130c54c Merge branch 'vi/make-test-vector-less-specific'
* vi/make-test-vector-less-specific:
  tests: cleanup binary test vector files
2011-08-01 15:00:38 -07:00
Junio C Hamano 8ab19bc5de Merge branch 'jk/clone-detached'
* jk/clone-detached:
  clone: always fetch remote HEAD
  make copy_ref globally available
  consider only branches in guess_remote_head
  t: add tests for cloning remotes with detached HEAD
2011-08-01 15:00:35 -07:00
Junio C Hamano b04f826bf6 Merge branch 'jc/streaming-filter'
* jc/streaming-filter:
  streaming: free git_istream upon closing
2011-08-01 15:00:29 -07:00
Junio C Hamano 59d9ba869e Merge branch 'sr/transport-helper-fix'
* sr/transport-helper-fix: (21 commits)
  transport-helper: die early on encountering deleted refs
  transport-helper: implement marks location as capability
  transport-helper: Use capname for refspec capability too
  transport-helper: change import semantics
  transport-helper: update ref status after push with export
  transport-helper: use the new done feature where possible
  transport-helper: check status code of finish_command
  transport-helper: factor out push_update_refs_status
  fast-export: support done feature
  fast-import: introduce 'done' command
  git-remote-testgit: fix error handling
  git-remote-testgit: only push for non-local repositories
  remote-curl: accept empty line as terminator
  remote-helpers: export GIT_DIR variable to helpers
  git_remote_helpers: push all refs during a non-local export
  transport-helper: don't feed bogus refs to export push
  git-remote-testgit: import non-HEAD refs
  t5800: document some non-functional parts of remote helpers
  t5800: use skip_all instead of prereq
  t5800: factor out some ref tests
  ...
2011-08-01 15:00:14 -07:00
Junio C Hamano 1df561fb48 Merge branch 'jc/maint-reset-unmerged-path'
* jc/maint-reset-unmerged-path:
  reset [<commit>] paths...: do not mishandle unmerged paths
2011-08-01 15:00:08 -07:00
Junio C Hamano 259bcfb6b9 Merge branch 'maint'
* maint:
  connect: correctly number ipv6 network adapter
2011-08-01 14:45:02 -07:00
Junio C Hamano 3503b8d0da Merge branch 'nk/ref-doc' into maint
* nk/ref-doc:
  glossary: clarify description of HEAD
  glossary: update description of head and ref
  glossary: update description of "tag"
  git.txt: de-emphasize the implementation detail of a ref
  check-ref-format doc: de-emphasize the implementation detail of a ref
  git-remote.txt: avoid sounding as if loose refs are the only ones in the world
  git-remote.txt: fix wrong remote refspec
2011-08-01 14:44:24 -07:00
Junio C Hamano 62607e4813 Merge branch 'jl/maint-fetch-recursive-fix' into maint
* jl/maint-fetch-recursive-fix:
  fetch: Also fetch submodules in subdirectories in on-demand mode
2011-08-01 14:44:17 -07:00
Junio C Hamano 6124690d5f Merge branch 'jc/maint-cygwin-trust-executable-bit-default' into maint
* jc/maint-cygwin-trust-executable-bit-default:
  cygwin: trust executable bit by default
2011-08-01 14:44:13 -07:00
Junio C Hamano d48929e1c3 Merge branch 'jc/legacy-loose-object' into maint
* jc/legacy-loose-object:
  sha1_file.c: "legacy" is really the current format
2011-08-01 14:43:58 -07:00
Junio C Hamano 3e8cd966e0 Merge branch 'an/shallow-doc' into maint
* an/shallow-doc:
  Document the underlying protocol used by shallow repositories and --depth commands.
  Fix documentation of fetch-pack that implies that the client can disconnect after sending wants.
2011-08-01 14:43:53 -07:00
Junio C Hamano 055f2c5d34 Merge branch 'jc/maint-1.7.3-checkout-describe' into maint
* jc/maint-1.7.3-checkout-describe:
  checkout -b <name>: correctly detect existing branch
2011-08-01 14:43:18 -07:00
Michael Schubert bf01d4a334 reflog: actually default to subcommand 'show'
The reflog manpage says:

	git reflog [show] [log-options] [<ref>]

the subcommand 'show' is the default "in the absence of any
subcommands". Currently this is only true if the user provided either
at least one option or no additional argument at all. For example:

	git reflog master

won't work. Change this by actually calling cmd_log_reflog in
absence of any subcommand.

Signed-off-by: Michael Schubert <mschub@elegosoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 10:52:34 -07:00
Erik Faye-Lund 7203a2d1ca connect: only log if all attempts failed (ipv4)
In 63a995b (Do not log unless all connect() attempts fail), a
mechanism to only log connection errors if all attempts failed
was introduced for the IPv6 code-path, but not for the IPv4 one.

Introduce a matching mechanism so IPv4-users also benefit from
this noise-reduction.

Move the call to socket after filling in sa, to make it more
apparent that errno can't change in between.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 10:49:45 -07:00
Junio C Hamano 9353e09afa Merge branch 'maint' into ef/ipv4-connect-error-report
* maint:
  connect: correctly number ipv6 network adapter
2011-08-01 10:49:40 -07:00
Erik Faye-Lund e08afecd7f connect: correctly number ipv6 network adapter
In ba50532, the variable 'cnt' was added to both the IPv6 and the
IPv4 version of git_tcp_connect_sock, intended to identify which
network adapter the connection failed on. But in the IPv6 version,
the variable was never increased, leaving it constantly at zero.

This behaviour isn't very useful, so let's fix it by increasing
the variable at every loop-iteration.

Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 10:47:36 -07:00
Pete Wyckoff 4e2e6ce450 git-p4: commit time should be most recent p4 change time
When importing a repo, the time on the initial commit had been
just "now".  But this causes problems when trying to share among
git-p4 repos that were created identically, although at different
times.  Instead, use the time in the top-most p4 change as the
time for the git import commit.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 10:24:20 -07:00
Pete Wyckoff eab30818a9 git-p4: one test missing config git-p4.skipSubmitEditCheck
Add this missing line in one of the tests.  Otherwise, on fast
machines, the following git-p4 commit will complain that nobody
edited the submission message.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 10:24:15 -07:00
Pete Wyckoff 83cf0fe49f git-p4: add missing && in test
Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 10:23:54 -07:00
Pete Wyckoff f40ae5cee6 git-p4: use test_when_finished in tests
Cleanup nicely when tests fail.  This avoids many duplicated
lines in the tests, and adds cleanup in a couple of tests that
did not have it.  When one fails, now all the rest will not
fail too.

Signed-off-by: Pete Wyckoff <pw@padd.com>
Acked-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 10:23:38 -07:00
Junio C Hamano b35acb5345 Merge branch 'maint'
* maint:
  Break down no-lstat() condition checks in verify_uptodate()
  t7400: fix bogus test failure with symlinked trash
  Documentation: clarify the invalidated tree entry format
2011-07-31 18:57:32 -07:00
Nguyễn Thái Ngọc Duy d5b6629904 Break down no-lstat() condition checks in verify_uptodate()
Make it easier to grok under what conditions we can skip lstat().

While at there, shorten ie_match_stat() line for the sake of my eyes.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-31 18:42:38 -07:00
Jeff King dd008b3b11 t7400: fix bogus test failure with symlinked trash
One of the tests in t7400 fails if the trash directory has a
symlink anywhere in its path. E.g.:

  $ mkdir /tmp/git-test
  $ mkdir /tmp/git-test/real
  $ ln -s real /tmp/git-test/link

  $ ./t7400-submodule-basic --root=/tmp/git-test/real
  ...
  # passed all 44 test(s)

  $ ./t7400-submodule-basic --root=/tmp/git-test/link
  ...
  not ok - 41 use superproject as upstream when path is relative and no url is set there

The failing test does:

  git submodule add ../repo relative &&
  ...
  git submodule sync relative &&
  test "$(git config submodule.relative.url)" = "$submodurl/repo"

where $submodurl comes from the $TRASH_DIRECTORY the user
gave us. However, git will resolve symlinks when converting
the relative path into an absolute one, leading them to be
textually different (even though they point to the same
directory).

Fix this by asking pwd to canonicalize the name of the trash
directory for us.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-31 18:40:34 -07:00
Jakub Narebski 14569cd810 gitweb: Git config keys are case insensitive, make config search too
"git config -z -l" that gitweb uses in git_parse_project_config() to
populate %config hash returns section and key names of config
variables in lowercase (they are case insensitive).  When checking
%config in git_get_project_config() we have to take it into account.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-31 18:39:19 -07:00
Carlos Martín Nieto e44b6df90c Documentation: clarify the invalidated tree entry format
When the entry_count is -1, the tree is invalidated and therefore has
not associated hash (or object name). Explicitly state that the next
entry starts after the newline.

Signed-off-by: Carlos Martín Nieto <cmn@elego.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-31 18:23:49 -07:00
Jens Lehmann 7e60407f7a submodule: update and add must honor --quiet flag
When using the --quiet flag "git submodule update" and "git submodule add"
didn't behave as the documentation stated. They printed progress output
from the clone, even though they should only print error messages.

Fix that by passing the -q flag to git clone in module_clone() when the
GIT_QUIET variable is set. Two tests in t7400 have been modified to test
that behavior.

Reported-by: Daniel Holtmann-Rice <flyingtabmow@gmail.com>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-28 12:48:26 -07:00
Jon Seymour 04f89259a6 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>
2011-07-25 10:50:11 -07:00
Junio C Hamano 4db0d0d1ba Merge branch 'maint'
* maint:
  tests: print failed test numbers at the end of the test run
2011-07-24 16:23:01 -07:00
Jakub Narebski 131d6afcba gitweb: Introduce common system-wide settings for convenience
Because of backward compatibility we cannot change gitweb to always
use /etc/gitweb.conf (i.e. even if gitweb_config.perl exists).  For
common system-wide settings we therefore need separate configuration
file: /etc/gitweb-common.conf.

Long description:

gitweb currently obtains configuration from the following sources:

  1. per-instance configuration file (default: gitweb_conf.perl)
  2. system-wide configuration file (default: /etc/gitweb.conf)

If per-instance configuration file exists, then system-wide
configuration is _not used at all_.  This is quite untypical and
suprising behavior.

Moreover it is different from way git itself treats /etc/git.conf.  It
reads in stuff from /etc/git.conf and then local repos can change or
override things as needed.  In fact this is quite beneficial, because
it gives site admins a simple and easy way to give an automatic hint
to a repo about things the admin would like.

On the other hand changing current behavior may lead to the situation,
where something in /etc/gitweb.conf may interfere with unintended
interaction in the local repository.  One solution would be to
_require_ to do explicit include; with read_config_file() it is now
easy, as described in gitweb/README (description introduced in this
commit).

But as J.H. noticed we cannot ask people to modify their per-instance
gitweb config file to include system-wide settings, nor we can require
them to do this.

Therefore, as proposed by Junio, for gitweb to have centralized config
elements while retaining backwards compatibility, introduce separate
common system-wide configuration file, by default /etc/gitweb-common.conf

Noticed-by: Drew Northup <drew.northup@maine.edu>
Helped-by: John 'Warthog9' Hawley <warthog9@kernel.org>
Inspired-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-24 16:22:21 -07:00
Jens Lehmann 2579e1d293 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>
2011-07-24 11:55:14 -07:00
Jon Seymour 6c1c14480d 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>
2011-07-24 11:48:24 -07:00
Junio C Hamano 5c2f84599c Update draft release notes to 1.7.7
The third batch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-07-22 15:32:03 -07:00
Junio C Hamano 22f41286be Merge branch 'dc/stash-con-untracked'
* dc/stash-con-untracked:
  stash: Add --include-untracked option to stash and remove all untracked files

Conflicts:
	git-stash.sh
2011-07-22 14:46:28 -07:00
Junio C Hamano 9c81e6421b Merge branch 'jk/tag-contains-ab'
* jk/tag-contains-ab:
  Revert clock-skew based attempt to optimize tag --contains traversal
  git skew: a tool to find how big a clock skew exists in the history
  default core.clockskew variable to one day
  limit "contains" traversals based on commit timestamp
  tag: speed up --contains calculation
2011-07-22 14:45:19 -07:00
Junio C Hamano 1fad2862c8 Merge branch 'dz/connect-error-report'
* dz/connect-error-report:
  Do not log unless all connect() attempts fail
2011-07-22 14:44:28 -07:00
Junio C Hamano f424d7e0b9 Merge branch 'mz/doc-rebase-abort'
* mz/doc-rebase-abort:
  rebase: clarify "restore the original branch"
2011-07-22 14:44:08 -07:00