Commit Graph

26176 Commits

Author SHA1 Message Date
Junio C Hamano
cea08ed783 Merge branch 'rc/maint-http-wrong-free' into next
* rc/maint-http-wrong-free:
  Makefile: some changes for http-related flag documentation
  http.c: fix an invalid free()

Conflicts:
	Makefile
2011-08-05 15:06:50 -07:00
Junio C Hamano
658e57c99f Merge branch 'ma/am-exclude' into next
* ma/am-exclude:
  am: pass exclude down to apply
2011-08-05 15:06:49 -07:00
Junio C Hamano
2764424d60 Merge branch 'cb/maint-exec-error-report' into next
* cb/maint-exec-error-report:
  notice error exit from pager
  error_routine: use parent's stderr if exec fails
2011-08-05 15:06:49 -07:00
Junio C Hamano
8d63a8c7b1 Merge branch 'rs/grep-function-context' into next
* rs/grep-function-context:
  grep: long context options
  grep: add option to show whole function as context
2011-08-05 15:06:49 -07:00
Junio C Hamano
fe77d18a3f Merge branch 'master' into next
* master:
2011-08-05 14:57:47 -07:00
Junio C Hamano
e7a85be3cf Merge branch 'tc/minix'
* tc/minix:
  Makefile: add Minix configuration options.
2011-08-05 14:55:00 -07:00
Junio C Hamano
96790ca029 Merge branch 'jc/pack-order-tweak'
* jc/pack-order-tweak:
  pack-objects: optimize "recency order"
  core: log offset pack data accesses happened
2011-08-05 14:54:57 -07:00
Junio C Hamano
2a34220e42 Merge branch 'master' into next
* master:
  docs: put listed example commands in backticks
  gitweb: pass string after encoding in utf-8 to syntax highlighter
  Add option hooks.diffopts to customize change summary in post-receive-email
2011-08-04 16:19:11 -07:00
Jeff King
5d2fc9135a docs: put listed example commands in backticks
Many examples of git command invocation are given in asciidoc listing
blocks, which makes them monospaced and avoids further interpretation of
special characters.  Some manpages make a list of examples, like:

  git foo::
    Run git foo.

  git foo -q::
    Use the "-q" option.

to quickly show many variants. However, they can sometimes be hard to
read, because they are shown in a proportional-width font (so, for
example, seeing the difference between "-- foo" and "--foo" can be
difficult).

This patch puts all such examples into backticks, which gives the
equivalent formatting to a listing block (i.e., monospaced and without
character interpretation).

As a bonus, this also fixes an example in the git-push manpage, in which
"git push origin :::" was accidentally considered a newly-indented list,
and not a list item with "git push origin :" in it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 15:49:13 -07:00
张忠山
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
b06e80e736 Merge branch 'jk/http-auth-keyring' into next
* jk/http-auth-keyring:
  credentials: add "getpass" helper
  credentials: add "store" helper
  credentials: add "cache" helper
  docs: end-user documentation for the credential subsystem
  http: use hostname in credential description
  allow the user to configure credential helpers
  look for credentials in config before prompting
  http: use credential API to get passwords
  introduce credentials API
  http: retry authentication failures for all http requests
  remote-curl: don't retry auth failures with dumb protocol
  improve httpd auth tests
  url: decode buffers that are not NUL-terminated

Conflicts:
	Documentation/Makefile
2011-08-03 15:25:53 -07:00
Jeff King
1e481b38ac credentials: add "getpass" helper
This just does the normal "ask on the terminal, or use
GIT_ASKPASS" logic that we already do. But it's useful for
writers of third-party helpers. See the documentation for an
example.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 15:25:12 -07:00
Jeff King
3fc3ee7332 credentials: add "store" helper
This is like "cache", except that we actually put the
credentials on disk. This can be terribly insecure, of
course, but we do what we can to protect them by filesystem
permissions, and we warn the user in the documentation.

This is not unlike using .netrc to store entries, but it's a
little more user-friendly. Instead of putting credentials in
place ahead of time, we transparently store them after
prompting the user for them once.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 15:25:12 -07:00
Jeff King
2d6874d83a credentials: add "cache" helper
If you access repositories over smart-http using http
authentication, then it can be annoying to have git ask you
for your password repeatedly. We cache credentials in
memory, of course, but git is composed of many small
programs. Having to input your password for each one can be
frustrating.

This patch introduces a credential helper that will cache
passwords in memory for a short period of time.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 15:25:12 -07:00
Jeff King
b0c3e61f4d docs: end-user documentation for the credential subsystem
The credential API and helper format is already defined in
technical/api-credentials.txt.  This presents the end-user
view.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 15:25:12 -07:00
Jeff King
dad8534f86 http: use hostname in credential description
Until now, a request for an http password looked like:

  Username:
  Password:

Now it will look like:

  Username for 'example.com':
  Password for 'example.com':

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 15:25:12 -07:00
Jeff King
00b1daa2c1 allow the user to configure credential helpers
The functionality for helpers is already there; we just need
to give the users a way to turn it on.

The new functionality is enabled whenever a caller of the
credentials API passes a NULL method list. This will enable
it for all current callers (i.e., the http code).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 15:25:12 -07:00
Jeff King
20a93d32fa look for credentials in config before prompting
When an http request receives a 401, we ask the user for
both a username and password. While it's generally not a
good idea for us to store the password in plaintext, having
to input the username each time is annoying, and can be
easily solved with a config variable.

This patch teaches the credential subsystem to look up items
in the git config file before prompting. Items are indexed
by the "unique" token passed to the credential system.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 15:25:12 -07:00
Jeff King
41b8701903 http: use credential API to get passwords
This patch converts the http code to use the new credential
API, both for http authentication as well as for getting
certificate passwords.

Most of the code change is simply variable naming (the
passwords are now contained inside a struct). The biggest
change is determining a "unique" context to pass to the
credential API.  This patch uses "http:$host" for http
authentication and "cert:$file" for opening certificate
files.

We pass an empty list of methods to the credential API,
which means that we will use the internal credential_getpass
function. This should yield no behavior change, except that
we now print "Password for 'certificate':" instead of
"Certificate Password:" when asking for certificate
passwords.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 15:25:11 -07:00
Jeff King
59f5226028 introduce credentials API
There are a few places in git that need to get a username
and password credential from the user; the most notable one
is HTTP authentication for smart-http pushing.

Right now the only choices for providing credentials are to
put them plaintext into your ~/.netrc, or to have git prompt
you (either on the terminal or via an askpass program). The
former is not very secure, and the latter is not very
convenient.

Unfortunately, there is no "always best" solution for
password management. The details will depend on the tradeoff
you want between security and convenience, as well as how
git can integrate with other security systems (e.g., many
operating systems provide a keychain or password wallet for
single sign-on).

This patch abstracts the notion of gathering user
credentials into a few simple functions. These functions can
be backed by our internal git_getpass implementation (which
just prompts the user), or by external helpers which are
free to consult system-specific password wallets, make
custom policy decisions on password caching and storage, or
prompt the user in a non-traditional manner.

The helper protocol aims for simplicity of helper
implementation; see the newly added documentation for
details.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 15:25:11 -07:00
Junio C Hamano
6918f69ba7 Merge branch 'cb/partial-commit-relative-pathspec' into next
* cb/partial-commit-relative-pathspec:
  commit: allow partial commits with relative paths
2011-08-03 15:22:55 -07:00
Junio C Hamano
ea4842bf3a Merge branch 'ef/ipv4-connect-error-report' into next
* ef/ipv4-connect-error-report:
  connect: only log if all attempts failed (ipv4)
2011-08-03 15:22:55 -07:00
Junio C Hamano
faeff9479f Merge branch 'oa/pull-reflog' into next
* oa/pull-reflog:
  pull: remove extra space from reflog message

Conflicts:
	git-pull.sh
2011-08-03 15:22:55 -07:00
Junio C Hamano
ae9cf6f9a4 Merge branch 'ms/reflog-show-is-default' into next
* ms/reflog-show-is-default:
  reflog: actually default to subcommand 'show'
2011-08-03 15:22:54 -07:00
Junio C Hamano
88f97a93ee Merge branch 'jl/submodule-status-summary-doc' into next
* jl/submodule-status-summary-doc:
  Documentation/submodule: add command references and update options
2011-08-03 15:22:54 -07:00
Junio C Hamano
f9e23286fe Merge branch 'rc/histogram-diff' (early part) into next
* 'rc/histogram-diff' (early part):
  Make test number unique
2011-08-03 14:52:31 -07:00
Junio C Hamano
8927a3d7a6 Merge branch 'master' into next
* master:
  add gitignore entry to description about how to write a builtin
  gitattributes: Reword "attribute macro" to "macro attribute"
  gitattributes: Clarify discussion of attribute macros
  Skip archive --remote tests on Windows
2011-08-03 14:16:33 -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
maximilian attems
77e9e496a1 am: pass exclude down to apply
This allows to pass patches around from repositories,
where the other repository doesn't feature certain files.

In the special case this works for dash git sync to klibc dash:
 git am --directory="usr/dash" --exclude="usr/dash/configure.ac" \
        --exclude="usr/dash/ChangeLog" --exclude="usr/dash/dash.1" \
	.. -i -s -k ../dash/000X-foo.patch

Signed-off-by: maximilian attems <max@stro.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 11:21:46 -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
Johannes Sixt
286e2b1a23 Make test number unique
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-03 10:14:50 -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
Junio C Hamano
9268738161 Merge branch 'jn/gitweb-config-list-case' into next
* jn/gitweb-config-list-case:
  gitweb: Git config keys are case insensitive, make config search too
2011-08-01 16:39:12 -07:00
Junio C Hamano
87df938e10 Merge branch 'cb/maint-quiet-push' into next
* cb/maint-quiet-push:
  propagate --quiet to send-pack/receive-pack

Conflicts:
	Documentation/git-receive-pack.txt
	Documentation/git-send-pack.txt
2011-08-01 16:39:12 -07:00
Junio C Hamano
c6115874d9 Merge branch 'jl/submodule-update-quiet' into next
* jl/submodule-update-quiet:
  submodule: update and add must honor --quiet flag
2011-08-01 16:39:12 -07:00
Junio C Hamano
61bae55a5c Merge branch 'js/ls-tree-error' into next
* js/ls-tree-error:
  Ensure git ls-tree exits with a non-zero exit code if read_tree_recursive fails.
  Add a test to check that git ls-tree sets non-zero exit code on error.
2011-08-01 16:39:11 -07:00
Junio C Hamano
4941e45a96 Merge branch 'jn/gitweb-system-config' into next
* jn/gitweb-system-config:
  gitweb: Introduce common system-wide settings for convenience
2011-08-01 16:39:11 -07:00
Junio C Hamano
6c88837b1d Merge branch 'jk/reset-reflog-message-fix' into next
* jk/reset-reflog-message-fix:
  reset: give better reflog messages
2011-08-01 16:39:11 -07:00
Junio C Hamano
98d8b08332 Merge branch 'jc/diff-index-refactor' into next
* jc/diff-index-refactor:
  diff-lib: refactor run_diff_index() and do_diff_cache()
  diff-lib: simplify do_diff_cache()
2011-08-01 16:39:11 -07:00
Clemens Buchacher
fc1b56f054 notice error exit from pager
If the pager fails to run, git produces no output, e.g.:

 $ GIT_PAGER=not-a-command git log

The error reporting fails for two reasons:

 (1) start_command: There is a mechanism that detects errors during
     execvp introduced in 2b541bf8 (start_command: detect execvp
     failures early). The child writes one byte to a pipe only if
     execvp fails.  The parent waits for either EOF, when the
     successful execvp automatically closes the pipe (see
     FD_CLOEXEC in fcntl(1)), or it reads a single byte, in which
     case it knows that the execvp failed. This mechanism is
     incompatible with the workaround introduced in 35ce8622
     (pager: Work around window resizing bug in 'less'), which
     waits for input from the parent before the exec. Since both
     the parent and the child are waiting for input from each
     other, that would result in a deadlock. In order to avoid
     that, the mechanism is disabled by closing the child_notifier
     file descriptor.

 (2) finish_command: The parent correctly detects the 127 exit
     status from the child, but the error output goes nowhere,
     since by that time it is already being redirected to the
     child.

No simple solution for (1) comes to mind.

Number (2) can be solved by not sending error output to the pager.
Not redirecting error output to the pager can result in the pager
overwriting error output with standard output, however.

Since there is no reliable way to handle error reporting in the
parent, produce the output in the child instead.

Signed-off-by: Clemens Buchacher <drizzd@aon.at>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-01 16:21:55 -07:00
Junio C Hamano
0ae577d331 Merge branch 'master' into next
* master:
  connect: correctly number ipv6 network adapter
  git-p4: commit time should be most recent p4 change time
  git-p4: one test missing config git-p4.skipSubmitEditCheck
  git-p4: add missing && in test
  git-p4: use test_when_finished in tests
2011-08-01 16:18:24 -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