]> Kevux Git Server - rit/log
rit
12 years agocontrib/git-credential-gnome-keyring.c: use secure memory functions for passwds
Brandon Casey [Mon, 23 Sep 2013 18:49:11 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: use secure memory functions for passwds

gnome-keyring provides functions for allocating non-pageable memory (if
possible) intended to be used for storing passwords.  Let's use them.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocontrib/git-credential-gnome-keyring.c: use gnome helpers in keyring_object()
Brandon Casey [Mon, 23 Sep 2013 18:49:10 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: use gnome helpers in keyring_object()

Rather than carefully allocating memory for sprintf() to write into,
let's make use of the glib helper function g_strdup_printf(), which
makes things a lot easier and less error-prone.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocontrib/git-credential-gnome-keyring.c: set Gnome application name
Brandon Casey [Mon, 23 Sep 2013 18:49:09 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: set Gnome application name

Since this is a Gnome application, let's set the application name to
something reasonable.  This will be displayed in Gnome dialog boxes
e.g. the one that prompts for the user's keyring password.

We add an include statement for glib.h and add the glib-2.0 cflags and
libs to the compilation arguments, but both of these are really noops
since glib is already a dependency of gnome-keyring.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocontrib/git-credential-gnome-keyring.c: ensure buffer is non-empty before accessing
Brandon Casey [Mon, 23 Sep 2013 18:49:08 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: ensure buffer is non-empty before accessing

Ensure buffer length is non-zero before attempting to access the last
element.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocontrib/git-credential-gnome-keyring.c: strlen() returns size_t, not ssize_t
Brandon Casey [Mon, 23 Sep 2013 18:49:07 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: strlen() returns size_t, not ssize_t

Also, initialization is not necessary since it is assigned before it is
used.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocontrib/git-credential-gnome-keyring.c: exit non-zero when called incorrectly
Brandon Casey [Mon, 23 Sep 2013 18:49:06 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: exit non-zero when called incorrectly

If the correct arguments were not specified, this program should exit
non-zero.  Let's do so.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocontrib/git-credential-gnome-keyring.c: add static where applicable
Brandon Casey [Mon, 23 Sep 2013 18:49:05 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: add static where applicable

Mark global variable and functions as static.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agocontrib/git-credential-gnome-keyring.c: *style* use "if ()" not "if()" etc.
Brandon Casey [Mon, 23 Sep 2013 18:49:04 +0000 (11:49 -0700)]
contrib/git-credential-gnome-keyring.c: *style* use "if ()" not "if()" etc.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agorevision: do not peel tags used in range notation
Junio C Hamano [Thu, 19 Sep 2013 21:20:34 +0000 (14:20 -0700)]
revision: do not peel tags used in range notation

A range notation "A..B" means exactly the same thing as what "^A B"
means, i.e. the set of commits that are reachable from B but not
from A.  But the internal representation after the revision parser
parsed these two notations are subtly different.

 - "rev-list ^A B" leaves A and B in the revs->pending.objects[]
   array, with the former marked as UNINTERESTING and the revision
   traversal machinery propagates the mark to underlying commit
   objects A^0 and B^0.

 - "rev-list A..B" peels tags and leaves A^0 (marked as
   UNINTERESTING) and B^0 in revs->pending.objects[] array before
   the traversal machinery kicks in.

This difference usually does not matter, but starts to matter when
the --objects option is used.  For example, we see this:

    $ git rev-list --objects v1.8.4^1..v1.8.4 | grep $(git rev-parse v1.8.4)
    $ git rev-list --objects v1.8.4 ^v1.8.4^1 | grep $(git rev-parse v1.8.4)
    04f013dc38d7512eadb915eba22efc414f18b869 v1.8.4

With the former invocation, the revision traversal machinery never
hears about the tag v1.8.4 (it only sees the result of peeling it,
i.e. the commit v1.8.4^0), and the tag itself does not appear in the
output.  The latter does send the tag object itself to the output.

Make the range notation keep the unpeeled objects and feed them to
the traversal machinery to fix this inconsistency.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoMerge branch 'maint'
Junio C Hamano [Tue, 15 Oct 2013 23:15:00 +0000 (16:15 -0700)]
Merge branch 'maint'

* maint:
  git-prune-packed.txt: fix reference to GIT_OBJECT_DIRECTORY
  clone --branch: refuse to clone if upstream repo is empty

12 years agogit-prune-packed.txt: fix reference to GIT_OBJECT_DIRECTORY
Steffen Prohaska [Mon, 23 Sep 2013 19:19:19 +0000 (21:19 +0200)]
git-prune-packed.txt: fix reference to GIT_OBJECT_DIRECTORY

git-prune-packed operates on GIT_OBJECT_DIRECTORY, not
GIT_OBJECT_DIR.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agogit.txt: fix asciidoc syntax of --*-pathspecs
Steffen Prohaska [Mon, 23 Sep 2013 18:54:35 +0000 (20:54 +0200)]
git.txt: fix asciidoc syntax of --*-pathspecs

Labeled lists require a double colon.

[jc] I eyeballed the output from

        git grep '[^:]:$' Documentation/\*.txt

     and the patch fixes all breakages of this kind.

Signed-off-by: Steffen Prohaska <prohaska@zib.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agodoc/cli: make "dot repository" an independent bullet point
Philip Oakley [Tue, 15 Oct 2013 21:57:42 +0000 (14:57 -0700)]
doc/cli: make "dot repository" an independent bullet point

The way to spell the current repository with a '.' dot is
independent from how the pathspec allows globs expanded by Git.

Make them two separate bullet items in the enumeration.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoremote: do not copy "origin" string literal
Jeff King [Tue, 24 Sep 2013 05:19:08 +0000 (01:19 -0400)]
remote: do not copy "origin" string literal

Our default_remote_name starts at "origin", but may be
overridden by the config file. In the former case, we
allocate a new string, but in the latter case, we point to
the remote name in an existing "struct branch".

This gives the variable inconsistent free() semantics (we
are sometimes responsible for freeing the string and
sometimes pointing to somebody else's storage), and causes a
small leak when the allocated string is overridden by
config.

We can fix both by simply dropping the extra copy and
pointing to the string literal.

Noticed-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agobash prompt: don't use '+=' operator in show upstream code path
SZEDER Gábor [Tue, 15 Oct 2013 12:21:11 +0000 (14:21 +0200)]
bash prompt: don't use '+=' operator in show upstream code path

The '+=' operator is not supported by old Bash versions (3.0) we still
care about.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agosplit_ident: parse timestamp from end of line
Jeff King [Mon, 14 Oct 2013 22:45:00 +0000 (18:45 -0400)]
split_ident: parse timestamp from end of line

Split_ident currently parses left to right. Given this
input:

  Your Name <email@example.com> 123456789 -0500\n

We assume the name starts the line and runs until the first
"<".  That starts the email address, which runs until the
first ">".  Everything after that is assumed to be the
timestamp.

This works fine in the normal case, but is easily broken by
corrupted ident lines that contain an extra ">". Some
examples seen in the wild are:

  1. Name <email>-<> 123456789 -0500\n

  2. Name <email> <Name<email>> 123456789 -0500\n

  3. Name1 <email1>, Name2 <email2> 123456789 -0500\n

Currently each of these produces some email address (which
is not necessarily the one the user intended) and end up
with a NULL date (which is generally interpreted as the
epoch by "git log" and friends).

But in each case we could get the correct timestamp simply
by parsing from the right-hand side, looking backwards for
the final ">", and then reading the timestamp from there.

In general, it's a losing battle to try to automatically
guess what the user meant with their broken crud. But this
particular workaround is probably worth doing.  One, it's
dirt simple, and can't impact non-broken cases. Two, it
doesn't catch a single breakage we've seen, but rather a
large class of errors (i.e., any breakage inside the email
angle brackets may affect the email, but won't spill over
into the timestamp parsing). And three, the timestamp is
arguably more valuable to get right, because it can affect
correctness (e.g., in --until cutoffs).

This patch implements the right-to-left scheme described
above. We adjust the tests in t4212, which generate a commit
with such a broken ident, and now gets the timestamp right.
We also add a test that fsck continues to detect the
breakage.

For reference, here are pointers to the breakages seen (as
numbered above):

[1] http://article.gmane.org/gmane.comp.version-control.git/221441

[2] http://article.gmane.org/gmane.comp.version-control.git/222362

[3] http://perl5.git.perl.org/perl.git/commit/13b79730adea97e660de84bbe67f9d7cbe344302

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
12 years agoremote-curl: rewrite base url from info/refs redirects
Jeff King [Sat, 28 Sep 2013 08:35:35 +0000 (04:35 -0400)]
remote-curl: rewrite base url from info/refs redirects

For efficiency and security reasons, an earlier commit in
this series taught http_get_* to re-write the base url based
on redirections we saw while making a specific request.

This commit wires that option into the info/refs request,
meaning that a redirect from

    http://example.com/foo.git/info/refs

to

    https://example.com/bar.git/info/refs

will behave as if "https://example.com/bar.git" had been
provided to git in the first place.

The tests bear some explanation. We introduce two new
hierearchies into the httpd test config:

  1. Requests to /smart-redir-limited will work only for the
     initial info/refs request, but not any subsequent
     requests. As a result, we can confirm whether the
     client is re-rooting its requests after the initial
     contact, since otherwise it will fail (it will ask for
     "repo.git/git-upload-pack", which is not redirected).

  2. Requests to smart-redir-auth will redirect, and require
     auth after the redirection. Since we are using the
     redirected base for further requests, we also update
     the credential struct, in order not to mislead the user
     (or credential helpers) about which credential is
     needed. We can therefore check the GIT_ASKPASS prompts
     to make sure we are prompting for the new location.
     Because we have neither multiple servers nor https
     support in our test setup, we can only redirect between
     paths, meaning we need to turn on
     credential.useHttpPath to see the difference.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoremote-curl: store url as a strbuf
Jeff King [Sat, 28 Sep 2013 08:35:25 +0000 (04:35 -0400)]
remote-curl: store url as a strbuf

We use a strbuf to generate the string containing the remote
URL, but then detach it to a bare pointer. This makes it
harder to later manipulate the URL, as we have forgotten the
length (and the allocation semantics are not as clear).

Let's instead keep the strbuf around. As a bonus, this
eliminates a confusing double-use of the "buf" strbuf in
main(). Prior to this, it was used both for constructing the
url, and for reading commands from stdin.

The downside is that we have to update each call site to
refer to "url.buf" rather than just "url" when they want the
C string.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoremote-curl: make refs_url a strbuf
Jeff King [Sat, 28 Sep 2013 08:35:10 +0000 (04:35 -0400)]
remote-curl: make refs_url a strbuf

In the discover_refs function, we use a strbuf named
"buffer" for multiple purposes. First we build the info/refs
URL in it, and then detach that to a bare pointer. Then, we
use the same strbuf to store the result of fetching the
refs.

Let's instead keep a separate refs_url strbuf. This is less
confusing, as the "buffer" strbuf is now used for only one
thing.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agohttp: update base URLs when we see redirects
Jeff King [Sat, 28 Sep 2013 08:34:05 +0000 (04:34 -0400)]
http: update base URLs when we see redirects

If a caller asks the http_get_* functions to go to a
particular URL and we end up elsewhere due to a redirect,
the effective_url field can tell us where we went.

It would be nice to remember this redirect and short-cut
further requests for two reasons:

  1. It's more efficient. Otherwise we spend an extra http
     round-trip to the server for each subsequent request,
     just to get redirected.

  2. If we end up with an http 401 and are going to ask for
     credentials, it is to feed them to the redirect target.
     If the redirect is an http->https upgrade, this means
     our credentials may be provided on the http leg, just
     to end up redirected to https. And if the redirect
     crosses server boundaries, then curl will drop the
     credentials entirely as it follows the redirect.

However, it, it is not enough to simply record the effective
URL we saw and use that for subsequent requests. We were
originally fed a "base" url like:

   http://example.com/foo.git

and we want to figure out what the new base is, even though
the URLs we see may be:

     original: http://example.com/foo.git/info/refs
    effective: http://example.com/bar.git/info/refs

Subsequent requests will not be for "info/refs", but for
other paths relative to the base. We must ask the caller to
pass in the original base, and we must pass the redirected
base back to the caller (so that it can generate more URLs
from it). Furthermore, we need to feed the new base to the
credential code, so that requests to credential helpers (or
to the user) match the URL we will be requesting.

This patch teaches http_request_reauth to do this munging.
Since it is the caller who cares about making more URLs, it
seems at first glance that callers could simply check
effective_url themselves and handle it. However, since we
need to update the credential struct before the second
re-auth request, we have to do it inside http_request_reauth.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agohttp: provide effective url to callers
Jeff King [Sat, 28 Sep 2013 08:32:02 +0000 (04:32 -0400)]
http: provide effective url to callers

When we ask curl to access a URL, it may follow one or more
redirects to reach the final location. We have no idea
this has happened, as curl takes care of the details and
simply returns the final content to us.

The final URL that we ended up with can be accessed via
CURLINFO_EFFECTIVE_URL. Let's make that optionally available
to callers of http_get_*, so that they can make further
decisions based on the redirection.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agohttp: hoist credential request out of handle_curl_result
Jeff King [Sat, 28 Sep 2013 08:31:45 +0000 (04:31 -0400)]
http: hoist credential request out of handle_curl_result

When we are handling a curl response code in http_request or
in the remote-curl RPC code, we use the handle_curl_result
helper to translate curl's response into an easy-to-use
code. When we see an HTTP 401, we do one of two things:

  1. If we already had a filled-in credential, we mark it as
     rejected, and then return HTTP_NOAUTH to indicate to
     the caller that we failed.

  2. If we didn't, then we ask for a new credential and tell
     the caller HTTP_REAUTH to indicate that they may want
     to try again.

Rejecting in the first case makes sense; it is the natural
result of the request we just made. However, prompting for
more credentials in the second step does not always make
sense. We do not know for sure that the caller is going to
make a second request, and nor are we sure that it will be
to the same URL. Logically, the prompt belongs not to the
request we just finished, but to the request we are (maybe)
about to make.

In practice, it is very hard to trigger any bad behavior.
Currently, if we make a second request, it will always be to
the same URL (even in the face of redirects, because curl
handles the redirects internally). And we almost always
retry on HTTP_REAUTH these days. The one exception is if we
are streaming a large RPC request to the server (e.g., a
pushed packfile), in which case we cannot restart. It's
extremely unlikely to see a 401 response at this stage,
though, as we would typically have seen it when we sent a
probe request, before streaming the data.

This patch drops the automatic prompt out of case 2, and
instead requires the caller to do it. This is a few extra
lines of code, and the bug it fixes is unlikely to come up
in practice. But it is conceptually cleaner, and paves the
way for better handling of credentials across redirects.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agomergetool--lib: Fix typo in the merge/difftool help
Stefan Saasen [Fri, 4 Oct 2013 14:34:53 +0000 (07:34 -0700)]
mergetool--lib: Fix typo in the merge/difftool help

The help text for the `tool` flag should mention:

    --tool=<tool>

instead of:

    --tool-<tool>

Signed-off-by: Stefan Saasen <ssaasen@atlassian.com>
Reviewed-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agosparse: suppress some "using sizeof on a function" warnings
Ramsay Jones [Sun, 6 Oct 2013 20:52:21 +0000 (21:52 +0100)]
sparse: suppress some "using sizeof on a function" warnings

Sparse issues an "using sizeof on a function" warning for each
call to curl_easy_setopt() which sets an option that takes a
function pointer parameter. (currently 12 such warnings over 4
files.)

The warnings relate to the use of the "typecheck-gcc.h" header
file which adds a layer of type-checking macros to the curl
function invocations (for gcc >= 4.3 and !__cplusplus). As part
of the type-checking layer, 'sizeof' is applied to the function
parameter of curl_easy_setopt(). Note that, in the context of
sizeof, the function to function pointer conversion is not
performed and that sizeof(f) != sizeof(&f).

A simple solution, therefore, would be to replace the function
name in each such call to curl_easy_setopt() with an explicit
function pointer expression (i.e. replace f with &f).

However, the "typecheck-gcc.h" header file is only conditionally
included, in addition to the gcc and C++ checks mentioned above,
depending on the CURL_DISABLE_TYPECHECK preprocessor variable.

In order to suppress the warnings, we use target-specific variable
assignments to add -DCURL_DISABLE_TYPECHECK to SPARSE_FLAGS for
each file affected (http-push.c, http.c, http-walker.c and
remote-curl.c).

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoformat-patch doc: Thunderbird wraps lines unless mailnews.wraplength=0
Ramsay Jones [Sun, 6 Oct 2013 20:51:31 +0000 (21:51 +0100)]
format-patch doc: Thunderbird wraps lines unless mailnews.wraplength=0

The Thunderbird section of the 'MUA-specific hints' contains three
different approaches to setting up the mail client to leave patch
emails unmolested. The second approach (configuration) has a step
missing when configuring the composition window not to wrap. In
particular, the "mailnews.wraplength" configuration variable needs
to be set to zero. Update the documentation to add the missing
setting.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoMerge branch 'rj/highlight-test-hang'
Jonathan Nieder [Mon, 14 Oct 2013 23:19:31 +0000 (16:19 -0700)]
Merge branch 'rj/highlight-test-hang'

* rj/highlight-test-hang:
  gitweb test: fix highlight test hang on Linux Mint

12 years agogitweb test: fix highlight test hang on Linux Mint
Ramsay Jones [Sun, 6 Oct 2013 20:50:46 +0000 (21:50 +0100)]
gitweb test: fix highlight test hang on Linux Mint

Linux Mint has an implementation of the highlight command (unrelated
to the one from http://www.andre-simon.de) that works as a simple
filter. The script uses 'sed' to add terminal colour escape codes
around text matching a regular expression. When t9500-*.sh attempts
to run "highlight --version", the script simply hangs waiting for
input. (See https://bugs.launchpad.net/linuxmint/+bug/815005).

The tool required by gitweb can be installed from the 'highlight'
package. Unfortunately, given the default $PATH, this leads to the
tool having lower precedence than the script.

In order to avoid hanging the test, add '</dev/null' to the command
line of the highlight invocation. Also, since the 'highlight' tool
requred by gitweb produces '--version' output (and the script does
not), saving the command output allows a simple check for the wrong
'highlight'.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agowrapper.c: only define gitmkstemps if needed
Ramsay Jones [Sun, 6 Oct 2013 20:50:00 +0000 (21:50 +0100)]
wrapper.c: only define gitmkstemps if needed

When the NO_MKSTEMPS build variable is not set, the gitmkstemps
function is dead code.  Use a preprocessor conditional to only include
the definition when needed.

Noticed by sparse.  ("'gitmkstemps' was not declared. Should it be
static?")

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agorefs.c: spell NULL pointer as NULL
Ramsay Jones [Sun, 6 Oct 2013 20:49:18 +0000 (21:49 +0100)]
refs.c: spell NULL pointer as NULL

A call to update_ref_lock() passes '0' to the 'int *type_p' parameter.
Noticed by sparse.  ("Using plain integer as NULL pointer")

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoconfig.c: mark file-local function static
Ramsay Jones [Sun, 6 Oct 2013 20:48:29 +0000 (21:48 +0100)]
config.c: mark file-local function static

Commit 7192777 refactors git_parse_ulong, which is public, into a more
generic function.  But since we kept the git_parse_ulong wrapper, only
that part needs to be public; nobody outside the file calls the
lower-level git_parse_unsigned.

Noticed with sparse.  ("'git_parse_unsigned' was not declared. Should
it be static?")

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Explained-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoCodingGuidelines: style for multi-line comments
brian m. carlson [Sat, 12 Oct 2013 00:45:46 +0000 (00:45 +0000)]
CodingGuidelines: style for multi-line comments

The style for multi-line comments is often mentioned and should be documented
for clarity.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoMerge branch 'nv/doc-config-signingkey'
Jonathan Nieder [Mon, 14 Oct 2013 19:45:50 +0000 (12:45 -0700)]
Merge branch 'nv/doc-config-signingkey'

* nv/doc-config-signingkey:
  config doc: user.signingkey is also used for signed commits

12 years agoconfig doc: user.signingkey is also used for signed commits
Nicolas Vigier [Mon, 14 Oct 2013 17:04:36 +0000 (19:04 +0200)]
config doc: user.signingkey is also used for signed commits

The description of the user.signingkey option only mentioned its use
when creating a signed tag. Make it clear that is is also used when
creating signed commits.

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoclone --branch: refuse to clone if upstream repo is empty
Ralf Thielow [Fri, 11 Oct 2013 16:49:02 +0000 (18:49 +0200)]
clone --branch: refuse to clone if upstream repo is empty

Since 920b691 (clone: refuse to clone if --branch
points to bogus ref) we refuse to clone with option
"-b" if the specified branch does not exist in the
(non-empty) upstream. If the upstream repository is empty,
the branch doesn't exist, either. So refuse the clone too.

Reported-by: Robert Mitwicki <robert.mitwicki@opensoftware.pl>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoMerge branch 'sb/checkout-test-complex-path'
Jonathan Nieder [Mon, 14 Oct 2013 18:09:30 +0000 (11:09 -0700)]
Merge branch 'sb/checkout-test-complex-path'

* sb/checkout-test-complex-path:
  checkout test: enable test with complex relative path

12 years agoMerge branch 'rt/cherry-pick-status'
Jonathan Nieder [Mon, 14 Oct 2013 18:08:47 +0000 (11:08 -0700)]
Merge branch 'rt/cherry-pick-status'

* rt/cherry-pick-status:
  status: show commit sha1 in "You are currently cherry-picking" message
  status test: add missing && to <<EOF blocks

12 years agoMerge branch 'rj/doc-formatting-fix'
Jonathan Nieder [Mon, 14 Oct 2013 18:07:50 +0000 (11:07 -0700)]
Merge branch 'rj/doc-formatting-fix'

* rj/doc-formatting-fix:
  howto/revert-a-faulty-merge: fix unescaped '^'s
  howto/setup-git-server-over-http: fix unescaped '^'s

12 years agoMerge branch 'po/remote-set-head-usage'
Jonathan Nieder [Mon, 14 Oct 2013 18:07:29 +0000 (11:07 -0700)]
Merge branch 'po/remote-set-head-usage'

* po/remote-set-head-usage:
  remote set-head -h: add long options to synopsis
  remote doc: document long forms of set-head options

12 years agoMerge branch 'nd/clone-local-with-colon'
Jonathan Nieder [Mon, 14 Oct 2013 18:06:57 +0000 (11:06 -0700)]
Merge branch 'nd/clone-local-with-colon'

* nd/clone-local-with-colon:
  clone: tighten "local paths with colons" check a bit

12 years agoMerge branch 'jx/clean-interactive'
Jonathan Nieder [Mon, 14 Oct 2013 18:03:48 +0000 (11:03 -0700)]
Merge branch 'jx/clean-interactive'

* jx/clean-interactive:
  path-utils test: rename mingw_path function to print_path

12 years agoMerge branch 'jk/diff-algo'
Jonathan Nieder [Mon, 14 Oct 2013 17:59:51 +0000 (10:59 -0700)]
Merge branch 'jk/diff-algo'

* jk/diff-algo:
  merge-recursive: fix parsing of "diff-algorithm" option

12 years agogit-prompt.sh: optionally show upstream branch name
Julien Carsique [Thu, 10 Oct 2013 14:40:39 +0000 (16:40 +0200)]
git-prompt.sh: optionally show upstream branch name

When working with multiple remotes, it is common to switch the upstream
from a remote to another. Doing so, the prompt may not be the expected
one. Providing an option to display tracking information sounds useful.

Add a "name" option to GIT_PS1_SHOWUPSTREAM which will show the upstream
abbrev name. This option is ignored if "verbose" is false.

Signed-off-by: Julien Carsique <julien.carsique@gmail.com>
Improved-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agopath-utils test: rename mingw_path function to print_path
Sebastian Schuberth [Thu, 10 Oct 2013 20:49:43 +0000 (22:49 +0200)]
path-utils test: rename mingw_path function to print_path

mingw_path was introduced in abd4284 to output a mangled path as it is
passed as an argument to main(). But the name is misleading because
mangling does not come from MinGW, but from MSYS [1]. As abd4284 does not
introduce any MSYS or MinGW specific code but just prints out argv[2] as
it is passed to main(), give the function the more generic and less
confusing name "print_path".

[1] http://www.mingw.org/wiki/Posix_path_conversion

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agohowto/revert-a-faulty-merge: fix unescaped '^'s
Ramsay Jones [Fri, 11 Oct 2013 18:24:14 +0000 (19:24 +0100)]
howto/revert-a-faulty-merge: fix unescaped '^'s

Several uses of the '^' operator are being interpreted by asciidoc
as requests to show the following text as a superscript. In order
to fix this problem, use backticks (`) to quote the text of the
affected git command invocations.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agohowto/setup-git-server-over-http: fix unescaped '^'s
Ramsay Jones [Fri, 11 Oct 2013 19:38:36 +0000 (20:38 +0100)]
howto/setup-git-server-over-http: fix unescaped '^'s

The text contains two 'grep' invocations which include the 'start
of line' regular expression character '^'. Asciidoc mis-interprets
this use of '^' as a superscript request. In order to fix this
formatting problem, use backticks (`) to quote the text of the
affected 'grep' command invocations.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agohttp: enable keepalive on TCP sockets
Eric Wong [Sat, 12 Oct 2013 22:29:40 +0000 (22:29 +0000)]
http: enable keepalive on TCP sockets

This is a follow up to commit e47a8583 (enable SO_KEEPALIVE for
connected TCP sockets, 2011-12-06).

Sockets may never receive notification of some link errors,
causing "git fetch" or similar processes to hang forever.
Enabling keepalive messages allows hung processes to error out
after a few minutes/hours depending on the keepalive settings of
the system.

I noticed this problem with some non-interactive cronjobs getting
hung when talking to HTTP servers.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoUse simpler relative_path when set_git_dir
Jiang Xin [Mon, 14 Oct 2013 02:29:40 +0000 (10:29 +0800)]
Use simpler relative_path when set_git_dir

Using a relative_path as git_dir first appears in v1.5.6-1-g044bbbc.
It will make git_dir shorter only if git_dir is inside work_tree,
and this will increase performance. But my last refactor effort on
relative_path function (commit v1.8.3-rc2-12-ge02ca72) changed that.
Always use relative_path as git_dir may bring troubles like
$gmane/234434.

Because new relative_path is a combination of original relative_path
from path.c and original path_relative from quote.c, so in order to
restore the origin implementation, save the original relative_path
as remove_leading_path, and call it in setup.c.

Suggested-by: Karsten Blees <karsten.blees@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agorelative_path should honor dos-drive-prefix
Jiang Xin [Mon, 14 Oct 2013 02:29:39 +0000 (10:29 +0800)]
relative_path should honor dos-drive-prefix

Tvangeste found that the "relative_path" function could not work
properly on Windows if "in" and "prefix" have DOS drive prefix
(such as "C:/windows"). ($gmane/234434)

E.g., When execute: test-path-utils relative_path "C:/a/b" "D:/x/y",
should return "C:/a/b", but returns "../../C:/a/b", which is wrong.

So make relative_path honor DOS drive prefix, and add test cases
for it in t0060.

Reported-by: Tvangeste <i.4m.l33t@yandex.ru>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agotest: use unambigous leading path (/foo) for MSYS
Jiang Xin [Mon, 14 Oct 2013 02:29:38 +0000 (10:29 +0800)]
test: use unambigous leading path (/foo) for MSYS

In test cases for relative_path, path with one leading character
(such as /a, /x) may be recogonized as "a:/" or "x:/" if there is
such DOS drive on MSYS platform. Use an umambigous leading path
"/foo" instead.

Also change two leading slashes (//) to three leading slashes (///),
otherwize it will be recognized as UNC name on MSYS platform.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agomv: Fix spurious warning when moving a file in presence of submodules
Jens Lehmann [Sun, 13 Oct 2013 11:52:05 +0000 (13:52 +0200)]
mv: Fix spurious warning when moving a file in presence of submodules

In commit 0656781fa "git mv" learned to update the submodule path in the
.gitmodules file when moving a submodule in the work tree. But since that
commit update_path_in_gitmodules() gets called no matter if we moved a
submodule or a regular file, which is wrong and leads to a bogus warning
when moving a regular file in a repo containing a .gitmodules file:

    warning: Could not find section in .gitmodules where path=<filename>

Fix that by only calling update_path_in_gitmodules() when moving a
submodule. To achieve that, we introduce the special SUBMODULE_WITH_GITDIR
define to distinguish the cases where we also have to connect work tree
and git directory from those where we only need to update the .gitmodules
setting.

A test for submodules using a .git directory together with a .gitmodules
file has been added to t7001. Even though newer git versions will always
use a gitfile when cloning submodules, repositories cloned with older git
versions will still use this layout.

Reported-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agomergetools/diffmerge: support DiffMerge as a git mergetool
Stefan Saasen [Sat, 12 Oct 2013 22:29:35 +0000 (09:29 +1100)]
mergetools/diffmerge: support DiffMerge as a git mergetool

DiffMerge is a non-free (but gratis) tool that supports OS X, Windows and Linux.

    See http://www.sourcegear.com/diffmerge/

DiffMerge includes a script `/usr/bin/diffmerge` that can be used to launch the
graphical compare tool.

This change adds mergetool support for DiffMerge and adds 'diffmerge' as an
option to the mergetool help.

Signed-off-by: Stefan Saasen <ssaasen@atlassian.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years ago.mailmap: switch to Thomas Rast's personal address
Thomas Rast [Sun, 13 Oct 2013 14:07:49 +0000 (16:07 +0200)]
.mailmap: switch to Thomas Rast's personal address

Normalize to my personal address, as my ETH addresses will expire
soon.  Also add my new corp account to be somewhat futureproof.

Note that despite the private address being first, Google owns the
copyright as long as I am employed there.

Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agogit-svn: Warn about changing default for --prefix in Git v2.0
Johan Herland [Fri, 11 Oct 2013 12:57:06 +0000 (14:57 +0200)]
git-svn: Warn about changing default for --prefix in Git v2.0

In Git v2.0, we will change the default --prefix for init/clone from
none/empty to "origin/" (which causes SVN-tracking branches to be
placed at refs/remotes/origin/* instead of refs/remotes/*).

This patch warns users about the upcoming change, both in the git-svn
manual page, and on stderr when running init/clone in the "multi-mode"
without providing a --prefix.

Cc: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
12 years agoDocumentation/git-svn: Promote the use of --prefix in docs + examples
Johan Herland [Fri, 11 Oct 2013 12:57:05 +0000 (14:57 +0200)]
Documentation/git-svn: Promote the use of --prefix in docs + examples

Currently, the git-svn defaults to using an empty prefix, which ends
up placing the SVN-tracking refs directly in refs/remotes/*. This
placement runs counter to Git's convention of placing remote-tracking
branches in refs/remotes/$remote/*.

Furthermore, combining git-svn with "regular" Git remotes run the risk
of clobbering refs under refs/remotes (e.g. if you have a git remote
called "tags" with a "v1" branch, it will overlap with the git-svn's
tracking branch for the "v1" tag from Subversion.

Even though the git-svn refs stored in refs/remotes/* are not "proper"
remote-tracking branches (since they are not covered by a proper git
remote's refspec), they clearly represent a similar concept, and would
benefit from following the same convention.

For example, if git-svn tracks Subversion branch "foo" at
refs/remotes/foo, and you create a local branch refs/heads/foo to add
some commits to be pushed back to Subversion (using "git svn dcommit),
then it is clearly unhelpful of Git to throw

  warning: refname 'foo' is ambiguous.

every time you checkout, rebase, or otherwise interact with the branch.

At this time, the user is better off using the --prefix=foo/ (the
trailing slash is important) to git svn init/clone, to cause the
SVN-tracking refs to be placed at refs/remotes/foo/* instead of
refs/remotes/*. This patch updates the documentation to encourage
use of --prefix.

This is also in preparation for changing the default value of --prefix
at some point in the future.

Cc: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
12 years agostatus: show commit sha1 in "You are currently cherry-picking" message
Ralf Thielow [Fri, 11 Oct 2013 15:58:37 +0000 (17:58 +0200)]
status: show commit sha1 in "You are currently cherry-picking" message

Especially helpful when cherry-picking multiple commits.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agostatus test: add missing && to <<EOF blocks
Jonathan Nieder [Fri, 11 Oct 2013 17:35:46 +0000 (10:35 -0700)]
status test: add missing && to <<EOF blocks

When a test forgets to include && after each command, it is possible
for an early command to succeed but the test to fail, which can hide
bugs.

Checked using the following patch to the test harness:

--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -425,7 +425,17 @@ test_eval_ () {
eval </dev/null >&3 2>&4 "$*"
 }

+check_command_chaining_ () {
+ eval >&3 2>&4 "(exit 189) && $*"
+ eval_chain_ret=$?
+ if test "$eval_chain_ret" != 189
+ then
+ error 'bug in test script: missing "&&" in test commands'
+ fi
+}
+
 test_run_ () {
+ check_command_chaining_ "$1"
test_cleanup=:
expecting_failure=$2
setup_malloc_check

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agocherry-pick: handle "-" after parsing options
Jeff King [Thu, 10 Oct 2013 16:41:17 +0000 (12:41 -0400)]
cherry-pick: handle "-" after parsing options

Currently, we only try converting argv[1] from "-" into "@{-1}".  This
means we do not notice "-" when used together with an option.  Worse,
when "git cherry-pick" is run with no options, we segfault.  Fix this
by doing the substitution after we have checked that there is
something in argv to cherry-pick and know any remaining options are
meant for the revision-listing machinery.

This still does not handle "-" after the first non-cherry-pick option.
For example,

git cherry-pick foo~2 - bar~5

and

git cherry-pick --no-merges -

will still dump usage.

Reported-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agogit-svn.txt: elaborate on rev_map files
Keshav Kini [Sun, 29 Sep 2013 23:46:00 +0000 (18:46 -0500)]
git-svn.txt: elaborate on rev_map files

The man page for `git svn` describes a situation in which "'git svn'
will not be able to rebuild" your $GIT_DIR/svn/**/.rev_map* files, but
no mention is made of in what circumstances `git svn` *will* be able to
do so, how to get `git svn` to do so, or even what these files are.

This patch adds a FILES section to the man page with a description of
what $GIT_DIR/svn/**/.rev_map* files are and how they are (re)built, and
links to this description from various other parts of the man page.

Signed-off-by: Keshav Kini <keshav.kini@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
12 years agogit-svn.txt: replace .git with $GIT_DIR
Keshav Kini [Sun, 29 Sep 2013 23:45:59 +0000 (18:45 -0500)]
git-svn.txt: replace .git with $GIT_DIR

As $GIT_DIR may not equal '.git', it's usually more generally correct to
refer to files in $GIT_DIR rather than in .git .

This will also allow me to link some of the occurrences of '.git' in
git-svn.txt to a new reference target inside this file in an upcoming
commit, because in AsciiDoc definitions apparently can't start with
a '.' character.

Signed-off-by: Keshav Kini <keshav.kini@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
12 years agogit-svn.txt: reword description of gc command
Keshav Kini [Sun, 29 Sep 2013 23:45:58 +0000 (18:45 -0500)]
git-svn.txt: reword description of gc command

It's redundant to say that $GIT_DIR/svn/<refname>/unhandled.log or
$GIT_DIR/svn/<refname>/index is in .git/svn when $GIT_DIR is '.git', and
is wrong when $GIT_DIR is not '.git'

Also, a '/' was missing from the pathname $GIT_DIR/svn/<refname>/index .

Signed-off-by: Keshav Kini <keshav.kini@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
12 years agogit-svn.txt: fix AsciiDoc formatting error
Keshav Kini [Sun, 29 Sep 2013 23:45:57 +0000 (18:45 -0500)]
git-svn.txt: fix AsciiDoc formatting error

As asterisks are used to indicate bold text in AsciiDoc, shell glob
expressions must be escaped appropriately.

Signed-off-by: Keshav Kini <keshav.kini@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
12 years agogit-svn: fix signed commit parsing
Nicolas Vigier [Mon, 30 Sep 2013 14:46:14 +0000 (16:46 +0200)]
git-svn: fix signed commit parsing

When parsing a commit object, git-svn wrongly think that a line
containing spaces means the end of headers and the start of the commit
message. In case of signed commit, the gpgsig entry contains a line with
one space, so "git svn dcommit" will include part of the signature in
the commit message.

An example of such problem :
http://svnweb.mageia.org/treasurer?view=revision&revision=86

This commit changes the regex to only match an empty line as separator
between the headers and the commit message.

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
12 years agocheckout test: enable test with complex relative path
Stefan Beller [Wed, 9 Oct 2013 14:35:11 +0000 (16:35 +0200)]
checkout test: enable test with complex relative path

This test was added, commented out, in fed1b5ca (git-checkout: Test
for relative path use, 2007-11-09).  Later git's path handling was
improved (d089ebaa, setup: sanitize absolute and funny paths in
get_pathspec(), 2008-01-28) but we forgot to enable the now-working
test.

This test expects to run from a subdirectory, so add a 'cd'.  While
we're here, examine the content of the checked-out file instead of
just checking that it exists.  The other checkout tests already do the
same.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoMerge branch 'tz/credential-netrc'
Jonathan Nieder [Tue, 8 Oct 2013 20:56:50 +0000 (13:56 -0700)]
Merge branch 'tz/credential-netrc'

* tz/credential-netrc:
  git-credential-netrc: fix uninitialized warning

12 years agogit-credential-netrc: fix uninitialized warning
Ted Zlatanov [Tue, 8 Oct 2013 20:02:02 +0000 (16:02 -0400)]
git-credential-netrc: fix uninitialized warning

Simple patch to avoid unitialized warning and log what we'll do.

Signed-off-by: Ted Zlatanov <tzz@lifelogs.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoDocumentation/Makefile: make AsciiDoc dblatex dir configurable
John Keeping [Thu, 3 Oct 2013 19:17:32 +0000 (20:17 +0100)]
Documentation/Makefile: make AsciiDoc dblatex dir configurable

On my system this is in /usr/share/asciidoc/dblatex not
/etc/asciidoc/dblatex.  Extract this portion of the path to a variable
so that is can be set in config.mak.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agohttp: refactor options to http_get_*
Jeff King [Sat, 28 Sep 2013 08:31:23 +0000 (04:31 -0400)]
http: refactor options to http_get_*

Over time, the http_get_strbuf function has grown several
optional parameters. We now have a bitfield with multiple
boolean options, as well as an optional strbuf for returning
the content-type of the response. And a future patch in this
series is going to add another strbuf option.

Treating these as separate arguments has a few downsides:

  1. Most call sites need to add extra NULLs and 0s for the
     options they aren't interested in.

  2. The http_get_* functions are actually wrappers around
     2 layers of low-level implementation functions. We have
     to pass these options through individually.

  3. The http_get_strbuf wrapper learned these options, but
     nobody bothered to do so for http_get_file, even though
     it is backed by the same function that does understand
     the options.

Let's consolidate the options into a single struct. For the
common case of the default options, we'll allow callers to
simply pass a NULL for the options struct.

The resulting code is often a few lines longer, but it ends
up being easier to read (and to change as we add new
options, since we do not need to update each call site).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agorebase -i: respect core.abbrev
Kirill A. Shutemov [Sat, 28 Sep 2013 15:53:05 +0000 (18:53 +0300)]
rebase -i: respect core.abbrev

collapse_todo_ids() uses `git rev-parse --short=7' to abbreviate
commit ids before showing them to the user in a text editor.  Let's
drop argument from --short to the configured value instead (still
defaulting to 7).

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Acked-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agohttp_request: factor out curlinfo_strbuf
Jeff King [Sat, 28 Sep 2013 08:31:11 +0000 (04:31 -0400)]
http_request: factor out curlinfo_strbuf

When we retrieve the content-type of an http response, curl
gives us a pointer to internal storage, which we then copy
into a strbuf. Let's factor out the get-and-copy routine,
which can be used for getting other curl info.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agohttp_get_file: style fixes
Jeff King [Sat, 28 Sep 2013 08:31:00 +0000 (04:31 -0400)]
http_get_file: style fixes

Besides being ugly, the extra parentheses are idiomatic for
suppressing compiler warnings when we are assigning within a
conditional. We aren't doing that here, and they just
confuse the reader.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoRelNotes/1.8.5: direct script writers to "git status --porcelain"
Matthieu Moy [Thu, 26 Sep 2013 13:23:35 +0000 (15:23 +0200)]
RelNotes/1.8.5: direct script writers to "git status --porcelain"

[jn: with wording tweak from Keshav Kini]

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoremote set-head -h: add long options to synopsis
Philip Oakley [Sat, 21 Sep 2013 15:51:46 +0000 (16:51 +0100)]
remote set-head -h: add long options to synopsis

Document --auto and --delete alongside their short forms -a and -d in
the first line of 'git remote set-head -h' output.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoremote doc: document long forms of set-head options
Philip Oakley [Sat, 21 Sep 2013 15:51:45 +0000 (16:51 +0100)]
remote doc: document long forms of set-head options

"git remote set-head" has always supported --add and --delete
as synonyms for the -a and -d option but forgot to document
them.

Signed-off-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agosubmodule foreach: skip eval for more than one argument
Anders Kaseorg [Fri, 27 Sep 2013 10:23:55 +0000 (06:23 -0400)]
submodule foreach: skip eval for more than one argument

'eval "$@"' creates an extra layer of shell interpretation, which is
probably not expected by a user who passes multiple arguments to git
submodule foreach:

 $ git grep "'"
 [searches for single quotes]
 $ git submodule foreach git grep "'"
 Entering '[submodule]'
 /usr/lib/git-core/git-submodule: 1: eval: Syntax error: Unterminated quoted string
 Stopping at '[submodule]'; script returned non-zero status.

To fix this, if the user passes more than one argument, execute "$@"
directly instead of passing it to eval.

Examples:

 * Typical usage when adding an extra level of quoting is to pass a
   single argument representing the entire command to be passed to the
   shell.  This doesn't change that.

 * One can imagine someone feeding untrusted input as an argument:

  git submodule foreach git grep "$variable"

   That currently results in a nonobvious shell code injection
   vulnerability.  Executing the command named by the arguments
   directly, as in this patch, fixes it.

Signed-off-by: Anders Kaseorg <andersk@mit.edu>
Acked-by: Johan Herland <johan@herland.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoclone: tighten "local paths with colons" check a bit
Nguyễn Thái Ngọc Duy [Fri, 27 Sep 2013 13:48:13 +0000 (20:48 +0700)]
clone: tighten "local paths with colons" check a bit

commit 6000334 (clone: allow cloning local paths with colons in them -
2013-05-04) made it possible to specify a path that has colons in it
without file://, e.g. ../foo:bar/somewhere. But the check was a bit
sloppy.

Consider the url '[foo]:bar'. The '[]' unwrapping code will turn the
string to 'foo\0:bar'. In effect this new string is the same as
'foo/:bar' in the check "path < strchrnul(host, '/')", which mistakes
it for a local path (with '/' before the first ':') when it's actually
not.

So disable the check for '/' before ':' when the URL has been mangled
by '[]' unwrapping.

[jn: with tests from Jeff King]

Noticed-by: Morten Stenshorne <mstensho@opera.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agocontrib: remove ciabot
Stefan Beller [Thu, 26 Sep 2013 20:33:02 +0000 (22:33 +0200)]
contrib: remove ciabot

Almost a year ago the CIA service irrevocably crashed.  The CIA author
had plans to revive the service, but the effort has since sunk without
trace.

Projects tend to use "irker" instead these days.  Repository hook
scripts for irker ship with the irker distribution.

Signed-off-by: Stefan Beller <stefanbeller@googlemail.com>
Acked-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoSync with Git 1.8.4.1
Jonathan Nieder [Thu, 26 Sep 2013 22:36:57 +0000 (15:36 -0700)]
Sync with Git 1.8.4.1

12 years agoGit 1.8.4.1
Jonathan Nieder [Thu, 26 Sep 2013 22:01:41 +0000 (15:01 -0700)]
Git 1.8.4.1

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agomerge-recursive: fix parsing of "diff-algorithm" option
John Keeping [Thu, 26 Sep 2013 20:02:48 +0000 (21:02 +0100)]
merge-recursive: fix parsing of "diff-algorithm" option

The "diff-algorithm" option to the recursive merge strategy takes the
name of the algorithm as an option, but it uses strcmp on the option
string to check if it starts with "diff-algorithm=", meaning that this
options cannot actually be used.

Fix this by switching to prefixcmp.  At the same time, clarify the
following line by using strlen instead of a hard-coded length, which
also makes it consistent with nearby code.

Reported-by: Luke Noel-Storr <luke.noel-storr@integrate.co.uk>
Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoMerge branch 'mm/rebase-continue-freebsd-WB' into maint
Jonathan Nieder [Thu, 26 Sep 2013 19:41:14 +0000 (12:41 -0700)]
Merge branch 'mm/rebase-continue-freebsd-WB' into maint

* mm/rebase-continue-freebsd-WB:
  rebase: fix run_specific_rebase's use of "return" on FreeBSD

12 years agoMerge branch 'km/svn-1.8-serf-only' into maint
Jonathan Nieder [Thu, 26 Sep 2013 19:34:23 +0000 (12:34 -0700)]
Merge branch 'km/svn-1.8-serf-only' into maint

* km/svn-1.8-serf-only:
  Git.pm: revert _temp_cache use of temp_is_locked
  git-svn: allow git-svn fetching to work using serf
  Git.pm: add new temp_is_locked function

12 years agoMerge branch 'js/xread-in-full' into maint
Jonathan Nieder [Thu, 26 Sep 2013 19:30:44 +0000 (12:30 -0700)]
Merge branch 'js/xread-in-full' into maint

* js/xread-in-full:
  stream_to_pack: xread does not guarantee to read all requested bytes

12 years agoMerge branch 'bc/send-email-ssl-die-message-fix' into maint
Jonathan Nieder [Thu, 26 Sep 2013 19:27:29 +0000 (12:27 -0700)]
Merge branch 'bc/send-email-ssl-die-message-fix' into maint

* bc/send-email-ssl-die-message-fix:
  send-email: don't call methods on undefined values

12 years agoMerge branch 'bc/submodule-status-ignored'
Jonathan Nieder [Wed, 25 Sep 2013 06:36:08 +0000 (23:36 -0700)]
Merge branch 'bc/submodule-status-ignored'

* bc/submodule-status-ignored:
  Improve documentation concerning the status.submodulesummary setting
  submodule: don't print status output with ignore=all
  submodule: fix confusing variable name

12 years agoMerge branch 'cc/replace-with-the-same-type'
Jonathan Nieder [Wed, 25 Sep 2013 06:35:24 +0000 (23:35 -0700)]
Merge branch 'cc/replace-with-the-same-type'

* cc/replace-with-the-same-type:
  Doc: 'replace' merge and non-merge commits
  t6050-replace: use some long option names
  replace: allow long option names
  Documentation/replace: add Creating Replacement Objects section
  t6050-replace: add test to clean up all the replace refs
  t6050-replace: test that objects are of the same type
  Documentation/replace: state that objects must be of the same type
  replace: forbid replacing an object with one of a different type

12 years agoMerge branch 'kb/msvc-compile'
Jonathan Nieder [Wed, 25 Sep 2013 06:31:58 +0000 (23:31 -0700)]
Merge branch 'kb/msvc-compile'

* kb/msvc-compile:
  Windows: do not redefine _WIN32_WINNT
  MinGW: Fix stat definitions to work with MinGW runtime version 4.0
  MSVC: fix stat definition hell
  MSVC: fix compile errors due to macro redefinitions
  MSVC: fix compile errors due to missing libintl.h

12 years agoMerge branch 'nd/unpack-entry-optim-in-pack-objects'
Jonathan Nieder [Wed, 25 Sep 2013 06:29:55 +0000 (23:29 -0700)]
Merge branch 'nd/unpack-entry-optim-in-pack-objects'

* nd/unpack-entry-optim-in-pack-objects:
  pack-objects: no crc check when the cached version is used

12 years agoMerge branch 'jk/shortlog-tolerate-broken-commit'
Jonathan Nieder [Wed, 25 Sep 2013 06:29:00 +0000 (23:29 -0700)]
Merge branch 'jk/shortlog-tolerate-broken-commit'

* jk/shortlog-tolerate-broken-commit:
  shortlog: ignore commits with missing authors

12 years agoMerge branch 'jc/strcasecmp-pure-inline'
Jonathan Nieder [Wed, 25 Sep 2013 06:28:13 +0000 (23:28 -0700)]
Merge branch 'jc/strcasecmp-pure-inline'

* jc/strcasecmp-pure-inline:
  mailmap: work around implementations with pure inline strcasecmp

12 years agoMerge branch 'sg/complete-untracked-filter'
Jonathan Nieder [Wed, 25 Sep 2013 06:27:44 +0000 (23:27 -0700)]
Merge branch 'sg/complete-untracked-filter'

* sg/complete-untracked-filter:
  completion: improve untracked directory filtering for filename completion

12 years agoMerge branch 'nd/fetch-pack-error-reporting-fix'
Jonathan Nieder [Wed, 25 Sep 2013 06:27:02 +0000 (23:27 -0700)]
Merge branch 'nd/fetch-pack-error-reporting-fix'

* nd/fetch-pack-error-reporting-fix:
  fetch-pack.c: show correct command name that fails

12 years agoMerge branch 'es/contacts-in-subdir'
Jonathan Nieder [Wed, 25 Sep 2013 06:25:23 +0000 (23:25 -0700)]
Merge branch 'es/contacts-in-subdir'

* es/contacts-in-subdir:
  contacts: fix to work in subdirectories

12 years agoMerge branch 'jc/push-cas'
Jonathan Nieder [Wed, 25 Sep 2013 06:22:03 +0000 (23:22 -0700)]
Merge branch 'jc/push-cas'

* jc/push-cas:
  t5541: mark passing c-a-s test as success

12 years agoMerge branch 'maint'
Jonathan Nieder [Wed, 25 Sep 2013 06:19:00 +0000 (23:19 -0700)]
Merge branch 'maint'

* maint:
  git-remote-mediawiki: bugfix for pages w/ >500 revisions

12 years agodoc: don't claim that cherry calls patch-id
Michael S. Tsirkin [Tue, 24 Sep 2013 22:33:36 +0000 (01:33 +0300)]
doc: don't claim that cherry calls patch-id

The id is already different for binary files.  The hash used is an
implementation detail, so let's just document how diffs are compared.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agogit-remote-mediawiki: bugfix for pages w/ >500 revisions
Benoit Person [Tue, 24 Sep 2013 19:32:30 +0000 (21:32 +0200)]
git-remote-mediawiki: bugfix for pages w/ >500 revisions

Mediawiki introduces a new API for queries w/ more than 500 results in
version 1.21. That change triggered an infinite loop while cloning a
mediawiki with such a page.

The latest API renamed and moved the "continuing" information in the
response, necessary to build the next query. The code failed to retrieve
that information but still detected that it was in a "continuing
query". As a result, it launched the same query over and over again.

If a "continuing" information is detected in the response (old or new),
the next query is updated accordingly. If not, we quit assuming it's not
a continuing query.

Reported-by: Benjamin Cathey
Signed-off-by: Benoit Person <benoit.person@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agosample pre-commit hook: use --bool when retrieving config var
Johan Herland [Tue, 24 Sep 2013 07:52:56 +0000 (09:52 +0200)]
sample pre-commit hook: use --bool when retrieving config var

Currently if you set

[hooks]
allowNonAscii

(or allownonascii = 1, or = yes) in your .git/config then the sample
pre-commit misinterprets the value as "false" and rejects non-ASCII
filenames.  Use "git config --bool" to get the usual nicer boolean
handling.

Signed-off-by: Johan Herland <johan@herland.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agoclone: add a period after "done" to end the sentence
Sebastian Schuberth [Tue, 24 Sep 2013 10:24:46 +0000 (12:24 +0200)]
clone: add a period after "done" to end the sentence

We have a period in other places after "done" (see e.g. clone_local), so
we should have one here, too.

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agocontrib/git-credential-gnome-keyring.c: remove unused die() function
Brandon Casey [Mon, 23 Sep 2013 05:07:58 +0000 (22:07 -0700)]
contrib/git-credential-gnome-keyring.c: remove unused die() function

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
12 years agocontrib/git-credential-gnome-keyring.c: remove unnecessary pre-declarations
Brandon Casey [Mon, 23 Sep 2013 05:07:57 +0000 (22:07 -0700)]
contrib/git-credential-gnome-keyring.c: remove unnecessary pre-declarations

These are all defined before they are used, so it is not necessary to
pre-declare them.  Remove the pre-declarations.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>