git.git
11 years agotest-regex: Add a test to check for a bug in the regex routines
Ramsay Jones [Sat, 1 Sep 2012 17:46:54 +0000 (18:46 +0100)]
test-regex: Add a test to check for a bug in the regex routines

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosplit_ident_line(): make best effort when parsing author/committer line
Junio C Hamano [Fri, 31 Aug 2012 21:54:18 +0000 (14:54 -0700)]
split_ident_line(): make best effort when parsing author/committer line

Commits made by ancient version of Git allowed committer without
human readable name, like this (00213b17c in the kernel history):

    tree 6947dba41f8b0e7fe7bccd41a4840d6de6a27079
    parent 352dd1df32e672be4cff71132eb9c06a257872fe
    author Petr Baudis <pasky@ucw.cz> 1135223044 +0100
    committer  <sam@mars.ravnborg.org> 1136151043 +0100

    kconfig: Remove support for lxdialog --checklist

    ...

Signed-off-by: Petr Baudis <pasky@suse.cz>
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
When fed such a commit, --format='%ci' fails to parse it, and gives
back an empty string.  Update the split_ident_line() to be a bit
more lenient when parsing, but make sure the caller that wants to
pick up sane value from its return value does its own validation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocherry-pick/revert: respect order of revisions to pick
Martin von Zweigbergk [Wed, 29 Aug 2012 06:15:56 +0000 (23:15 -0700)]
cherry-pick/revert: respect order of revisions to pick

When giving multiple individual revisions to cherry-pick or revert, as
in 'git cherry-pick A B' or 'git revert B A', one would expect them to
be picked/reverted in the order given on the command line. They are
instead ordered by their commit timestamp -- in chronological order
for "cherry-pick" and in reverse chronological order for
"revert". This matches the order in which one would usually give them
on the command line, making this bug somewhat hard to notice. Still,
it has been reported at least once before [1].

It seems like the chronological sorting happened by accident because
the revision walker has traditionally always sorted commits in reverse
chronological order when rev_info.no_walk was enabled. In the case of
'git revert B A' where B is newer than A, this sorting is a no-op. For
'git cherry-pick A B', the sorting would reverse the arguments, but
because the sequencer also flips the rev_info.reverse flag when
picking (as opposed to reverting), the end result is a chronological
order. The rev_info.reverse flag was probably flipped so that the
revision walker emits B before C in 'git cherry-pick A..C'; that it
happened to effectively undo the unexpected sorting done when not
walking, was probably a coincidence that allowed this bug to happen at
all.

Fix the bug by telling the revision walker not to sort the commits
when not walking. The only case we want to reverse the order is now
when cherry-picking and walking revisions (rev_info.no_walk = 0).

 [1] http://thread.gmane.org/gmane.comp.version-control.git/164794

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodemonstrate broken 'git cherry-pick three one two'
Martin von Zweigbergk [Wed, 29 Aug 2012 06:15:55 +0000 (23:15 -0700)]
demonstrate broken 'git cherry-pick three one two'

Cherry-picking commits out of order (w.r.t. commit time stamp) doesn't
currently work. Add a test case to demonstrate it.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoteach log --no-walk=unsorted, which avoids sorting
Martin von Zweigbergk [Wed, 29 Aug 2012 06:15:54 +0000 (23:15 -0700)]
teach log --no-walk=unsorted, which avoids sorting

When 'git log' is passed the --no-walk option, no revision walk takes
place, naturally. Perhaps somewhat surprisingly, however, the provided
revisions still get sorted by commit date. So e.g 'git log --no-walk
HEAD HEAD~1' and 'git log --no-walk HEAD~1 HEAD' give the same result
(unless the two revisions share the commit date, in which case they
will retain the order given on the command line). As the commit that
introduced --no-walk (8e64006 (Teach revision machinery about
--no-walk, 2007-07-24)) points out, the sorting is intentional, to
allow things like

 git log --abbrev-commit --pretty=oneline --decorate --all --no-walk

to show all refs in order by commit date.

But there are also other cases where the sorting is not wanted, such
as

 <command producing revisions in order> |
       git log --oneline --no-walk --stdin

To accomodate both cases, leave the decision of whether or not to sort
up to the caller, by allowing --no-walk={sorted,unsorted}, defaulting
to 'sorted' for backward-compatibility reasons.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agolog: fix --quiet synonym for -s
Jeff King [Tue, 28 Aug 2012 21:29:34 +0000 (17:29 -0400)]
log: fix --quiet synonym for -s

Originally the "--quiet" option was parsed by the
diff-option parser into the internal QUICK option. This had
the effect of silencing diff output from the log (which was
not intended, but happened to work and people started to
use it). But it also had other odd side effects at the diff
level (for example, it would suppress the second commit in
"git show A B").

To fix this, commit 1c40c36 converted log to parse-options
and handled the "quiet" option separately, not passing it
on to the diff code. However, it simply ignored the option,
which was a regression for people using it as a synonym for
"-s". Commit 01771a8 then fixed that by interpreting the
option to add DIFF_FORMAT_NO_OUTPUT to the list of output
formats.

However, that commit did not fix it in all cases. It sets
the flag after setup_revisions is called. Naively, this
makes sense because you would expect the setup_revisions
parser to overwrite our output format flag if "-p" or
another output format flag is seen.

However, that is not how the NO_OUTPUT flag works. We
actually store it in the bit-field as just another format.
At the end of setup_revisions, we call diff_setup_done,
which post-processes the bitfield and clears any other
formats if we have set NO_OUTPUT. By setting the flag after
setup_revisions is done, diff_setup_done does not have a
chance to make this tweak, and we end up with other format
options still set.

As a result, the flag would have no effect in "git log -p
--quiet" or "git show --quiet".  Fix it by setting the
format flag before the call to setup_revisions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agohttp: prompt for credentials on failed POST
Jeff King [Mon, 27 Aug 2012 13:27:15 +0000 (09:27 -0400)]
http: prompt for credentials on failed POST

All of the smart-http GET requests go through the http_get_*
functions, which will prompt for credentials and retry if we
see an HTTP 401.

POST requests, however, do not go through any central point.
Moreover, it is difficult to retry in the general case; we
cannot assume the request body fits in memory or is even
seekable, and we don't know how much of it was consumed
during the attempt.

Most of the time, this is not a big deal; for both fetching
and pushing, we make a GET request before doing any POSTs,
so typically we figure out the credentials during the first
request, then reuse them during the POST. However, some
servers may allow a client to get the list of refs from
receive-pack without authentication, and then require
authentication when the client actually tries to POST the
pack.

This is not ideal, as the client may do a non-trivial amount
of work to generate the pack (e.g., delta-compressing
objects). However, for a long time it has been the
recommended example configuration in git-http-backend(1) for
setting up a repository with anonymous fetch and
authenticated push. This setup has always been broken
without putting a username into the URL. Prior to commit
986bbc0, it did work with a username in the URL, because git
would prompt for credentials before making any requests at
all. However, post-986bbc0, it is totally broken. Since it
has been advertised in the manpage for some time, we should
make sure it works.

Unfortunately, it is not as easy as simply calling post_rpc
again when it fails, due to the input issue mentioned above.
However, we can still make this specific case work by
retrying in two specific instances:

  1. If the request is large (bigger than LARGE_PACKET_MAX),
     we will first send a probe request with a single flush
     packet. Since this request is static, we can freely
     retry it.

  2. If the request is small and we are not using gzip, then
     we have the whole thing in-core, and we can freely
     retry.

That means we will not retry in some instances, including:

  1. If we are using gzip. However, we only do so when
     calling git-upload-pack, so it does not apply to
     pushes.

  2. If we have a large request, the probe succeeds, but
     then the real POST wants authentication. This is an
     extremely unlikely configuration and not worth worrying
     about.

While it might be nice to cover those instances, doing so
would be significantly more complex for very little
real-world gain. In the long run, we will be much better off
when curl learns to internally handle authentication as a
callback, and we can cleanly handle all cases that way.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agohttp: factor out http error code handling
Jeff King [Mon, 27 Aug 2012 13:26:04 +0000 (09:26 -0400)]
http: factor out http error code handling

Most of our http requests go through the http_request()
interface, which does some nice post-processing on the
results. In particular, it handles prompting for missing
credentials as well as approving and rejecting valid or
invalid credentials. Unfortunately, it only handles GET
requests. Making it handle POSTs would be quite complex, so
let's pull result handling code into its own function so
that it can be reused from the POST code paths.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot: test http access to "half-auth" repositories
Jeff King [Mon, 27 Aug 2012 13:25:53 +0000 (09:25 -0400)]
t: test http access to "half-auth" repositories

Some sites set up http access to repositories such that
fetching is anonymous and unauthenticated, but pushing is
authenticated. While there are multiple ways to do this, the
technique advertised in the git-http-backend manpage is to
block access to locations matching "/git-receive-pack$".

Let's emulate that advice in our test setup, which makes it
clear that this advice does not actually work.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot: test basic smart-http authentication
Jeff King [Mon, 27 Aug 2012 13:25:36 +0000 (09:25 -0400)]
t: test basic smart-http authentication

We do not currently test authentication over smart-http at
all. In theory, it should work exactly as it does for dumb
http (which we do test). It does indeed work for these
simple tests, but this patch lays the groundwork for more
complex tests in future patches.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot/lib-httpd: recognize */smart/* repos as smart-http
Jeff King [Mon, 27 Aug 2012 13:25:21 +0000 (09:25 -0400)]
t/lib-httpd: recognize */smart/* repos as smart-http

We do not currently test authentication for smart-http repos
at all. Part of the infrastructure to do this is recognizing
that auth/smart is indeed a smart-http repo.

The current apache config recognizes only "^/smart/*" as
smart-http. Let's instead treat anything with /smart/ in the
URL as smart-http. This is obviously a stupid thing to do
for a real production site, but for our test suite we know
that our repositories will not have this magic string in the
name.

Note that we will route /foo/smart/bar.git directly to
git-http-backend/bar.git; in other words, everything before
the "/smart/" is irrelevant to finding the repo on disk (but
may impact apache config, for example by triggering auth
checks).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot/lib-httpd: only route auth/dumb to dumb repos
Jeff King [Mon, 27 Aug 2012 13:24:42 +0000 (09:24 -0400)]
t/lib-httpd: only route auth/dumb to dumb repos

Our test apache config points all of auth/ directly to the
on-disk repositories via an Alias directive. This works fine
because everything authenticated is currently in auth/dumb,
which is a subset.  However, this would conflict with a
ScriptAlias for auth/smart (which will come in future
patches), so let's narrow the Alias.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot5550: factor out http auth setup
Jeff King [Mon, 27 Aug 2012 13:24:31 +0000 (09:24 -0400)]
t5550: factor out http auth setup

The t5550 script sets up a nice askpass helper for
simulating user input and checking what git prompted for.
Let's make it available to other http scripts by migrating
it to lib-httpd.

We can use this immediately in t5540 to make our tests more
robust (previously, we did not check at all that hitting the
password-protected repo actually involved a password).
Unfortunately, we end up failing the test because the
current code erroneously prompts twice (once for
git-remote-http, and then again when the former spawns
git-http-push).

More importantly, though, it will let us easily add
smart-http authentication tests in t5541 and t5551; we
currently do not test smart-http authentication at all.

As part of making it generic, let's always look for and
store auxiliary askpass files at the top-level trash
directory; this makes it compatible with t5540, which runs
some tests from sub-repositories. We can abstract away the
ugliness with a short helper function.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot5550: put auth-required repo in auth/dumb
Jeff King [Mon, 27 Aug 2012 13:23:37 +0000 (09:23 -0400)]
t5550: put auth-required repo in auth/dumb

In most of our tests, we put repos to be accessed by dumb
protocols in /dumb, and repos to be accessed by smart
protocols in /smart.  In our test apache setup, the whole
/auth hierarchy requires authentication. However, we don't
bother to split it by smart and dumb here because we are not
currently testing smart-http authentication at all.

That will change in future patches, so let's be explicit
that we are interested in testing dumb access here. This
also happens to match what t5540 does for the push tests.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodoc: "git checkout -b/-B/--orphan" always takes a branch name
Junio C Hamano [Sun, 26 Aug 2012 18:40:08 +0000 (11:40 -0700)]
doc: "git checkout -b/-B/--orphan" always takes a branch name

While the synopsis section makes it clear that the new branch name
is the parameter to these flags, the option description did not.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoapply: compute patch->def_name correctly under -p0
Junio C Hamano [Sat, 25 Aug 2012 05:48:55 +0000 (22:48 -0700)]
apply: compute patch->def_name correctly under -p0

Back when "git apply" was written, we made sure that the user can
skip more than the default number of path components (i.e. 1) by
giving "-p<n>", but the logic for doing so was built around the
notion of "we skip N slashes and stop".  This obviously does not
work well when running under -p0 where we do not want to skip any,
but still want to skip SP/HT that separates the pathnames of
preimage and postimage and want to reject absolute pathnames.

Stop using "stop_at_slash()", and instead introduce a new helper
"skip_tree_prefix()" with similar logic but works correctly even for
the -p0 case.

This is an ancient bug, but has been masked for a long time because
most of the patches are text and have other clues to tell us the
name of the preimage and the postimage.

Noticed by Colin McCabe.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'maint-1.7.11' into maint
Junio C Hamano [Fri, 24 Aug 2012 19:34:19 +0000 (12:34 -0700)]
Merge branch 'maint-1.7.11' into maint

* maint-1.7.11:
  Prepare for 1.7.11.6
  Make the ciabot scripts completely self-configuring in the normal case.
  Improved documentation for the ciabot scripts.
  man: git pull -r is a short for --rebase
  gitcli: describe abbreviation of long options
  rev-list docs: clarify --topo-order description
  Documentation/CodingGuidelines: spell out more shell guidelines
  Documentation: do not mention .git/refs/* directories
  tests: Introduce test_seq

11 years agoPrepare for 1.7.11.6
Junio C Hamano [Fri, 24 Aug 2012 19:33:31 +0000 (12:33 -0700)]
Prepare for 1.7.11.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'mv/pull-r-for-rebase' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:47 +0000 (12:05 -0700)]
Merge branch 'mv/pull-r-for-rebase' into maint-1.7.11

A minor documentation update.

* mv/pull-r-for-rebase:
  man: git pull -r is a short for --rebase

11 years agoMerge branch 'jc/maint-abbrev-option-cli' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:44 +0000 (12:05 -0700)]
Merge branch 'jc/maint-abbrev-option-cli' into maint-1.7.11

We did not document that many commands take unique prefix
abbreviations of long options (e.g. "--option" may be the only flag
that the command accepts that begin with "--opt", in which case you
can give "--opt") anywhere easy to find for new people.

* jc/maint-abbrev-option-cli:
  gitcli: describe abbreviation of long options

11 years agoMerge branch 'jc/maint-rev-list-topo-doc' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:40 +0000 (12:05 -0700)]
Merge branch 'jc/maint-rev-list-topo-doc' into maint-1.7.11

It was unclear what "--topo-order" was really about in the
documentation. It is not just about "children before parent", but
also about "don't mix lineages".

* jc/maint-rev-list-topo-doc:
  rev-list docs: clarify --topo-order description

11 years agoMerge branch 'hv/coding-guidelines' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:35 +0000 (12:05 -0700)]
Merge branch 'hv/coding-guidelines' into maint-1.7.11

In earlier days, "imitate the style in the neibouring code" was
sufficient to keep the coherent style, but over time some parts of
the codebase have drifted enough to make it ineffective.

* hv/coding-guidelines:
  Documentation/CodingGuidelines: spell out more shell guidelines

11 years agoMerge branch 'jc/tag-doc' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:30 +0000 (12:05 -0700)]
Merge branch 'jc/tag-doc' into maint-1.7.11

Our documentation used to assume having files in .git/refs/*
directories was the only to have branches and tags, but that is not
true for quite some time.

* jc/tag-doc:
  Documentation: do not mention .git/refs/* directories

11 years agoMerge branch 'mk/test-seq' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:24 +0000 (12:05 -0700)]
Merge branch 'mk/test-seq' into maint-1.7.11

Add a compatibility/utility function to the test framework.

* mk/test-seq:
  tests: Introduce test_seq

11 years agoMerge branch 'lp/no-cmd-http-fetch' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:19 +0000 (12:05 -0700)]
Merge branch 'lp/no-cmd-http-fetch' into maint-1.7.11

* lp/no-cmd-http-fetch:
  builtin.h: remove unused cmd_<foo> declarations

11 years agoMerge branch 'bw/maint-1.7.9-solaris-getpass' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:11 +0000 (12:05 -0700)]
Merge branch 'bw/maint-1.7.9-solaris-getpass' into maint-1.7.11

* bw/maint-1.7.9-solaris-getpass:
  Enable HAVE_DEV_TTY for Solaris
  terminal: seek when switching between reading and writing

11 years agoMerge branch 'jk/maint-commit-check-committer-early' into maint-1.7.11
Junio C Hamano [Fri, 24 Aug 2012 19:05:08 +0000 (12:05 -0700)]
Merge branch 'jk/maint-commit-check-committer-early' into maint-1.7.11

* jk/maint-commit-check-committer-early:
  commit: check committer identity more strictly

11 years agosha1_file.c: introduce get_max_fd_limit() helper
Joachim Schmitz [Fri, 24 Aug 2012 09:52:22 +0000 (11:52 +0200)]
sha1_file.c: introduce get_max_fd_limit() helper

Not all platforms have getrlimit(), but there are other ways to see
the maximum number of files that a process can have open.  If
getrlimit() is unavailable, fall back to sysconf(_SC_OPEN_MAX) if
available, and use OPEN_MAX from <limits.h>.

Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMake 'git submodule update --force' always check out submodules.
Stefan Zager [Wed, 25 Jul 2012 17:41:54 +0000 (10:41 -0700)]
Make 'git submodule update --force' always check out submodules.

Currently, it will only do a checkout if the sha1 registered in the containing
repository doesn't match the HEAD of the submodule, regardless of whether the
submodule is dirty.  As discussed on the mailing list, the '--force' flag is a
strong indicator that the state of the submodule is suspect, and should be reset
to HEAD.

Signed-off-by: Stefan Zager <szager@google.com>
Acked-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agomergetool: style fixes
Junio C Hamano [Thu, 23 Aug 2012 05:33:15 +0000 (22:33 -0700)]
mergetool: style fixes

This script is one of the sizeable ones that tempted people to copy
its "neibouring style" in their new code, but was littered with
styles incompatible with our style guide.

 - use one tab, not four spaces, per indent level;

 - long lines can be wrapped after '|', '&&', or '||' for
   readability.

 - structures like "if .. then .. else .. fi", "while .. do .. done"
   are split into lines in such a way that does not require
   unnecessary semicolon.

 - case, esac and case-arms align at the same column.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMake the ciabot scripts completely self-configuring in the normal case.
Eric S. Raymond [Thu, 23 Aug 2012 05:21:53 +0000 (01:21 -0400)]
Make the ciabot scripts completely self-configuring in the normal case.

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoImproved documentation for the ciabot scripts.
Eric S. Raymond [Thu, 23 Aug 2012 04:10:53 +0000 (00:10 -0400)]
Improved documentation for the ciabot scripts.

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agospecifying ranges: we did not mean to make ".." an empty set
Junio C Hamano [Mon, 2 May 2011 20:39:16 +0000 (13:39 -0700)]
specifying ranges: we did not mean to make ".." an empty set

Either end of revision range operator can be omitted to default to HEAD,
as in "origin.." (what did I do since I forked) or "..origin" (what did
they do since I forked).  But the current parser interprets ".."  as an
empty range "HEAD..HEAD", and worse yet, because ".." does exist on the
filesystem, we get this annoying output:

  $ cd Documentation/howto
  $ git log .. ;# give me recent commits that touch Documentation/ area.
  fatal: ambiguous argument '..': both revision and filename
  Use '--' to separate filenames from revisions

Surely we could say "git log ../" or even "git log -- .." to disambiguate,
but we shouldn't have to.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agohttp.c: don't use curl_easy_strerror prior to curl-7.12.0
Joachim Schmitz [Thu, 23 Aug 2012 07:33:55 +0000 (09:33 +0200)]
http.c: don't use curl_easy_strerror prior to curl-7.12.0

Reverts be22d92 (http: avoid empty error messages for some curl
errors, 2011-09-05) on platforms with older versions of libcURL
where the function is not available.

Signed-off-by: Joachim Schmitz <jojo@schmitz-digital.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot3910: use the UTF8_NFD_TO_NFC test prereq
Michael J Gruber [Mon, 30 Jul 2012 09:57:18 +0000 (11:57 +0200)]
t3910: use the UTF8_NFD_TO_NFC test prereq

Besides reusing the new test prerequisite, this fixes also the issue
that the current output is not TAP compliant and produces the output "no
reason given" [for skipping].

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'maint-1.7.11' into maint
Junio C Hamano [Wed, 22 Aug 2012 18:27:30 +0000 (11:27 -0700)]
Merge branch 'maint-1.7.11' into maint

* maint-1.7.11:
  contrib/ciabot: Get ciabot configuration from git variables

11 years agocontrib/ciabot: Get ciabot configuration from git variables
Eric S. Raymond [Wed, 22 Aug 2012 10:52:30 +0000 (06:52 -0400)]
contrib/ciabot: Get ciabot configuration from git variables

These changes remove all need to modify the ciabot scripts for installation.
Instead, per-project configuration can be dome via variables in a [ciabot]
section of the config file.

Also, correct for the new server address.

Signed-off-by: Eric S. Raymond <esr@thyrsus.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofast-import: document the --done option
Eric S. Raymond [Wed, 22 Aug 2012 10:57:05 +0000 (06:57 -0400)]
fast-import: document the --done option

Acked-by: Sverre Rabbelier <srabbelier@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agowarn_on_inaccessible(): a helper to warn on inaccessible paths
Junio C Hamano [Tue, 21 Aug 2012 21:52:07 +0000 (14:52 -0700)]
warn_on_inaccessible(): a helper to warn on inaccessible paths

The previous series introduced warnings to multiple places, but it
could become tiring to see the warning on the same path over and
over again during a single run of Git.  Making just one function
responsible for issuing this warning, we could later choose to keep
track of which paths we issued a warning (it would involve a hash
table of paths after running them through real_path() or something)
in order to reduce noise.

Right now we do not know if the noise reduction is necessary, but it
still would be a good code reduction/sharing anyway.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoattr: warn on inaccessible attribute files
Jeff King [Tue, 21 Aug 2012 06:31:52 +0000 (02:31 -0400)]
attr: warn on inaccessible attribute files

Just like config and gitignore files, we silently ignore
missing or inaccessible attribute files. An existent but
inaccessible file is probably a configuration error, so
let's warn the user.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogitignore: report access errors of exclude files
Jeff King [Tue, 21 Aug 2012 06:26:07 +0000 (02:26 -0400)]
gitignore: report access errors of exclude files

When we try to access gitignore files, we check for their
existence with a call to "access". We silently ignore
missing files. However, if a file is not readable, this may
be a configuration error; let's warn the user.

For $GIT_DIR/info/excludes or core.excludesfile, we can just
use access_or_warn. However, for per-directory files we
actually try to open them, so we must add a custom warning.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoconfig: warn on inaccessible files
Jeff King [Tue, 21 Aug 2012 06:10:59 +0000 (02:10 -0400)]
config: warn on inaccessible files

Before reading a config file, we check "!access(path, R_OK)"
to make sure that the file exists and is readable. If it's
not, then we silently ignore it.

For the case of ENOENT, this is fine, as the presence of the
file is optional. For other cases, though, it may indicate a
configuration error (e.g., not having permissions to read
the file). Let's print a warning in these cases to let the
user know.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofor-each-ref: Fix sort with multiple keys
Kacper Kornet [Tue, 21 Aug 2012 07:47:26 +0000 (09:47 +0200)]
for-each-ref: Fix sort with multiple keys

The linked list describing sort options was not correctly set up in
opt_parse_sort. In the result, contrary to the documentation, only the
last of multiple --sort options to git-for-each-ref was taken into
account. This commit fixes it.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot6300: test sort with multiple keys
Kacper Kornet [Tue, 21 Aug 2012 07:46:06 +0000 (09:46 +0200)]
t6300: test sort with multiple keys

Documentation of git-for-each-ref says that --sort=<key> option can be
used multiple times, in which case the last key becomes the primary key.
However this functionality was never checked in test suite and is
currently broken. This commit adds appropriate test in preparation for fix.

Signed-off-by: Kacper Kornet <draenog@pld-linux.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoprecompose-utf8: do not call checks for non-ascii "utf8"
Junio C Hamano [Mon, 20 Aug 2012 18:12:58 +0000 (11:12 -0700)]
precompose-utf8: do not call checks for non-ascii "utf8"

As suggested by Linus, this function is not checking UTF-8-ness of the
string; it only is seeing if it is pure US-ASCII.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoGit 1.7.12 v1.7.12
Junio C Hamano [Mon, 20 Aug 2012 00:02:11 +0000 (17:02 -0700)]
Git 1.7.12

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-config doc: unconfuse an example
Junio C Hamano [Sat, 18 Aug 2012 23:35:09 +0000 (16:35 -0700)]
git-config doc: unconfuse an example

One fictitious command "proxy-command" is enclosed inside a double
quote pair, while another fictitious command "default-proxy" is not
in the example, but the quoting does not change anything in the pair
of examples.  Remove the quotes to avoid unnecessary confusion.

Noticed by Michael Haggerty.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit-config.txt: fix example
Michael Haggerty [Sat, 18 Aug 2012 17:32:10 +0000 (19:32 +0200)]
git-config.txt: fix example

The "--add" option is required to add a new value to a multivalued
configuration entry.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'jc/doc-git-updates' (early part)
Junio C Hamano [Fri, 17 Aug 2012 20:27:10 +0000 (13:27 -0700)]
Merge branch 'jc/doc-git-updates' (early part)

* 'jc/doc-git-updates' (early part):
  Documentation: update URL for formatted pages

11 years agoDocumentation: update the introductory section
Junio C Hamano [Fri, 17 Aug 2012 19:48:52 +0000 (12:48 -0700)]
Documentation: update the introductory section

The second paragraph in the git(1) description section were meant to
guide people who are not ready to dive into this page away from here.
Referring migrating CVS users to another page before they get
acquainted with Git was somewhat out of place.  Move the reference to
the "FURTHER DOCUMENTATION" section and push that section down.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation: update URL for formatted pages
Junio C Hamano [Fri, 17 Aug 2012 19:14:57 +0000 (12:14 -0700)]
Documentation: update URL for formatted pages

The one at kernel.org has not been updated for quite a while and
can no longer be called "the latest".

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agostash: invoke rerere in case of conflict
Phil Hord [Tue, 10 Jul 2012 22:52:28 +0000 (18:52 -0400)]
stash: invoke rerere in case of conflict

"stash apply" directly calls a backend merge function which does not
automatically invoke rerere.  This confuses mergetool when leftover
rerere state is left behind from previous merges.

Invoke rerere explicitly when we encounter a conflict during stash
apply.  This turns the test introduced by the previous commit to
succeed.

Signed-off-by: Phil Hord <hordp@cisco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agotest: git-stash conflict sets up rerere
Phil Hord [Tue, 10 Jul 2012 22:52:27 +0000 (18:52 -0400)]
test: git-stash conflict sets up rerere

Add a test to make sure that a conflicted "stash apply" invokes
rerere to record the conflicts and resolve the the files it can
(the current code doesn't, so the test is marked as failing).

Without correct state recorded for rerere, mergetool may be
confused, causing it to think no files have conflicts even though
they do.  This condition is not verified by this test since a
subsequent commit will change the behavior to enable rerere for
stash conflicts.

Also, the next test expected us to finish up with a reset, which is
impossible to do if we fail (as we must) and it's an unreasonable
expectation anyway.  Begin the next test with a reset of its own
instead.

Signed-off-by: Phil Hord <hordp@cisco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocleanup precompose_utf8
Robin Rosenberg [Fri, 17 Aug 2012 14:53:10 +0000 (16:53 +0200)]
cleanup precompose_utf8

 - Remove extraneous parentheses and braces;

 - Remove redundant NUL-termination before strcpy();

 - Check result of unlink when probing for decomposed file names;

 - Adjust for the coding style by adding missing whitespaces;

 - Move storage class "static" at the beginning of the decl.

Signed-off-by: Robin Rosenberg <robin.rosenberg@dewire.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoman: git pull -r is a short for --rebase
Miklos Vajna [Thu, 16 Aug 2012 09:50:18 +0000 (11:50 +0200)]
man: git pull -r is a short for --rebase

Letting the "--rebase" option squat on the short-and-sweet single
letter option "-r" was an unintended accident and was not even
documented, but the short option seems to be already used in the
wild. Let's document it so that other options that begin with "r"
would not be tempted to steal it.

Signed-off-by: Miklos Vajna <vmiklos@suse.cz>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogitcli: describe abbreviation of long options
Junio C Hamano [Fri, 17 Aug 2012 06:16:22 +0000 (23:16 -0700)]
gitcli: describe abbreviation of long options

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge git://github.com/git-l10n/git-po to update Swedish translation
Junio C Hamano [Fri, 17 Aug 2012 03:13:45 +0000 (20:13 -0700)]
Merge git://github.com/git-l10n/git-po to update Swedish translation

* git://github.com/git-l10n/git-po:
  l10n: Fixes to Swedish translation

11 years agol10n: Fixes to Swedish translation
Peter Krefting [Tue, 14 Aug 2012 08:58:14 +0000 (09:58 +0100)]
l10n: Fixes to Swedish translation

Tersify texts overflowing an 80-character terminal.
Fix spelling mistakes.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
11 years agoGit 1.7.12-rc3 v1.7.12-rc3
Junio C Hamano [Wed, 15 Aug 2012 20:46:16 +0000 (13:46 -0700)]
Git 1.7.12-rc3

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoSync with 1.7.11.5
Junio C Hamano [Wed, 15 Aug 2012 20:41:17 +0000 (13:41 -0700)]
Sync with 1.7.11.5

11 years agoGit 1.7.11.5 v1.7.11.5
Junio C Hamano [Wed, 15 Aug 2012 20:39:53 +0000 (13:39 -0700)]
Git 1.7.11.5

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge branch 'rj/maint-grep-remove-redundant-test' into maint
Junio C Hamano [Wed, 15 Aug 2012 20:37:20 +0000 (13:37 -0700)]
Merge branch 'rj/maint-grep-remove-redundant-test' into maint

* rj/maint-grep-remove-redundant-test:
  t7810-*.sh: Remove redundant test

11 years agoMerge branch 'hv/link-alt-odb-entry' into maint
Junio C Hamano [Wed, 15 Aug 2012 20:36:47 +0000 (13:36 -0700)]
Merge branch 'hv/link-alt-odb-entry' into maint

* hv/link-alt-odb-entry:
  link_alt_odb_entry: fix read over array bounds reported by valgrind

11 years agorev-list docs: clarify --topo-order description
Junio C Hamano [Wed, 15 Aug 2012 20:02:48 +0000 (13:02 -0700)]
rev-list docs: clarify --topo-order description

It was unclear what "--topo-order" was really about in the
documentation.  It is not just about "children before parent", but
also about "don't mix lineages".

Reword the description for both "--date-order" and "--topo-order",
and add an illustration to it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogitweb: URL-decode $my_url/$my_uri when stripping PATH_INFO
Jay Soffian [Thu, 9 Aug 2012 02:29:26 +0000 (22:29 -0400)]
gitweb: URL-decode $my_url/$my_uri when stripping PATH_INFO

When gitweb is used as a DirectoryIndex, it attempts to strip
PATH_INFO on its own, as $cgi->url() fails to do so.

However, it fails to account for the fact that PATH_INFO has
already been URL-decoded by the web server, but the value
returned by $cgi->url() has not been. This causes the stripping
to fail whenever the URL contains encoded characters.

To see this in action, setup gitweb as a DirectoryIndex and
then use it on a repository with a directory containing a
space in the name. Navigate to tree view, examine the gitweb
generated html and you'll see a link such as:

  <a href="/test.git/tree/HEAD:/directory with spaces">directory with spaces</a>

When clicked on, the browser will URL-encode this link, giving
a $cgi->url() of the form:

   /test.git/tree/HEAD:/directory%20with%20spaces

While PATH_INFO is:

   /test.git/tree/HEAD:/directory with spaces

Fix this by calling unescape() on both $my_url and $my_uri before
stripping PATH_INFO from them.

Signed-off-by: Jay Soffian <jaysoffian@gmail.com>
Acked-by: Jakub Narebski <jnareb@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation/CodingGuidelines: spell out more shell guidelines
Heiko Voigt [Wed, 15 Aug 2012 17:06:01 +0000 (19:06 +0200)]
Documentation/CodingGuidelines: spell out more shell guidelines

In earlier days, "imitate the style in the neibouring code" was
sufficient to keep the coherent style, but over time some parts of
the codebase have drifted enough to make it ineffective.

Spell some of the guidelines out.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosend-email: validate & reconfirm interactive responses
Junio C Hamano [Tue, 14 Aug 2012 22:15:53 +0000 (15:15 -0700)]
send-email: validate & reconfirm interactive responses

People answer 'y' to "Who should the emails appear to be from?"  and
'n' to "Message-ID to be used as In-Reply-To for the first email?"
for some unknown reason.  While it is possible that your local
username really is "y" and you are sending the mail to your local
colleagues, it is possible, and some might even say it is likely,
that it is a user error.

Fortunately, our interactive prompter already has input validation
mechanism built-in.  Enhance it so that we can optionally reconfirm
and allow the user to pass an input that does not validate, and
"softly" require input to the sender, in-reply-to, and recipient to
contain "@" and "." in this order, which would catch most cases of
mistakes.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoLet submodule command exit with error status if path does not exist
Heiko Voigt [Tue, 14 Aug 2012 20:35:27 +0000 (22:35 +0200)]
Let submodule command exit with error status if path does not exist

Various subcommands of the "git submodule" command exited with 0
status even though the path given by the user did not exist.

The reason behind that was that they all pipe the output of
module_list into the while loop which then does the action on the
paths specified by the commandline. Since the exit code of the
command on the upstream side of the pipe is ignored by the shell,
the status code of "ls-files --error-unmatch" nor "module_list" was
not propagated.

In case ls-files returns with an error code, we write a special
string that is not possible in non error situations, and no other
output, so that the downstream can detect the error and die with an
error code.

The error message that there is an unmatched pathspec comes through
stderr directly from ls-files. So the user still gets a hint whats going
on.

Signed-off-by: Heiko Voigt <hvoigt@hvoigt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofetch-pack: mention server version with verbose output
Jeff King [Tue, 14 Aug 2012 02:02:10 +0000 (22:02 -0400)]
fetch-pack: mention server version with verbose output

Fetch-pack's verbose mode is more of a debugging mode (and
in fact takes two "-v" arguments to trigger via the
porcelain layer). Let's mention the server version as
another possible item of interest.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoparse_feature_request: make it easier to see feature values
Jeff King [Tue, 14 Aug 2012 01:59:27 +0000 (21:59 -0400)]
parse_feature_request: make it easier to see feature values

We already take care to parse key/value capabilities like
"foo=bar", but the code does not provide a good way of
actually finding out what is on the right-hand side of the
"=".

A server using "parse_feature_request" could accomplish this
with some extra parsing. You must skip past the "key"
portion manually, check for "=" versus NUL or space, and
then find the length by searching for the next space (or
NUL).  But clients can't even do that, since the
"server_supports" interface does not even return the
pointer.

Instead, let's have our parser share more information by
providing a pointer to the value and its length. The
"parse_feature_value" function returns a pointer to the
feature's value portion, along with the length of the value.
If the feature is missing, NULL is returned. If it does not
have an "=", then a zero-length value is returned.

Similarly, "server_feature_value" behaves in the same way,
but always checks the static server_feature_list variable.

We can then implement "server_supports" in terms of
"server_feature_value". We cannot implement the original
"parse_feature_request" in terms of our new function,
because it returned a pointer to the beginning of the
feature. However, no callers actually cared about the value
of the returned pointer, so we can simplify it to a boolean
just as we do for "server_supports".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agofetch-pack: do not ask for unadvertised capabilities
Junio C Hamano [Fri, 10 Aug 2012 21:27:52 +0000 (14:27 -0700)]
fetch-pack: do not ask for unadvertised capabilities

In the same spirit as the previous fix, stop asking for thin-pack, no-progress
and include-tag capabilities when the other end does not claim to support them.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agogit svn: reset invalidates the memoized mergeinfo caches
Peter Baumann [Thu, 9 Aug 2012 06:42:53 +0000 (08:42 +0200)]
git svn: reset invalidates the memoized mergeinfo caches

Since v1.7.0-rc2~11 (git-svn: persistent memoization, 2010-01-30),
git-svn has maintained some private per-repository caches in
.git/svn/.caches to avoid refetching and recalculating some
mergeinfo-related information with every 'git svn fetch'.

This memoization can cause problems, e.g consider the following case:

SVN repo:

  ... - a - b - c - m  <- trunk
          \        /
            d  -  e    <- branch1

The Git import of the above repo is at commit 'a' and doesn't know about
the branch1. In case of an 'git svn rebase', only the trunk of the
SVN repo is imported. During the creation of the git commit 'm', git svn
uses the svn:mergeinfo property and tries to find the corresponding git
commit 'e' to create 'm' with 'c' and 'e' as parents. But git svn rebase
only imports the current branch so commit 'e' is not imported.
Therefore git svn fails to create commit 'm' as a merge commit, because one
of its parents is not known to git. The imported history looks like this:

  ... - a - b - c - m  <- trunk

A later 'git svn fetch' to import all branches can't rewrite the commit 'm'
to add 'e' as a parent and to make it a real git merge commit, because it
was already imported.

That's why the imported history misses the merge and looks like this:

  ... - a - b - c - m  <- trunk
          \
            d  -  e    <- branch1

Right now the only known workaround for importing 'm' as a merge is to
force reimporting 'm' again from SVN, e.g. via

  $ git svn reset --revision $(git find-rev $c)
  $ git svn fetch

Sadly, this is where the behavior has regressed: git svn reset doesn't
invalidate the old mergeinfo cache, which is no longer valid for the
reimport, which leads to 'm' beeing imprted with only 'c' as parent.

As solution to this problem, this commit invalidates the mergeinfo cache
to force correct recalculation of the parents.

During development of this patch, several ways for invalidating the cache
where considered. One of them is to use Memoize::flush_cache, which will
call the CLEAR method on the underlying Memoize persistency implementation.
Sadly, neither Memoize::Storable nor the newer Memoize::YAML module
introduced in 68f532f4ba888 could optionally be used implement the
CLEAR method, so this is not an option.

Reseting the internal hash used to store the memoized values has the same
problem, because it calls the non-existing CLEAR method of the
underlying persistency layer, too.

Considering this and taking into account the different implementations
of the memoization modules, where Memoize::Storable is not in our control,
implementing the missing CLEAR method is not an option, at least not if
Memoize::Storable is still used.

Therefore the easiest solution to clear the cache is to delete the files
on disk in 'git svn reset'. Normally, deleting the files behind the back
of the memoization module would be problematic, because the in-memory
representation would still exist and contain wrong data. Fortunately, the
memoization is active in memory only for a small portion of the code.
Invalidating the cache by deleting the files on disk if it isn't active
should be safe.

Signed-off-by: Peter Baumann <waste.manager@gmx.de>
Signed-off-by: Steven Walter <stevenrwalter@gmail.com>
Signed-off-by: Eric Wong <normalperson@yhbt.net>
11 years agogit svn: handle errors and concurrent commits in dcommit
Robert Luberda [Wed, 8 Aug 2012 05:35:00 +0000 (07:35 +0200)]
git svn: handle errors and concurrent commits in dcommit

dcommit didn't handle errors returned by SVN and coped very
poorly with concurrent commits that appear in SVN repository
while dcommit was running. In both cases it left git repository
in inconsistent state: index (which was reset with `git reset
--mixed' after a successful commit to SVN) no longer matched the
checkouted tree, when the following commit failed or needed to be
rebased. See http://bugs.debian.org/676904 for examples.

This patch fixes the issues by:
- introducing error handler for dcommit. The handler will try
  to rebase or reset working tree before returning error to the
  end user. dcommit_rebase function was extracted out of cmd_dcommit
  to ensure consistency between cmd_dcommit and the error handler.
- calling `git reset --mixed' only once after all patches are
  successfully committed to SVN. This ensures index is not touched
  for most of the time of dcommit run.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
11 years agodo not send client agent unless server does first
Jeff King [Fri, 10 Aug 2012 07:57:43 +0000 (03:57 -0400)]
do not send client agent unless server does first

Commit ff5effdf taught both clients and servers of the git protocol
to send an "agent" capability that just advertises their version for
statistics and debugging purposes.  The protocol-capabilities.txt
document however indicates that the client's advertisement is
actually a response, and should never include capabilities not
mentioned in the server's advertisement.

Adding the unconditional advertisement in the server programs was
OK, then, but the clients broke the protocol.  The server
implementation of git-core itself does not care, but at least one
does: the Google Code git server (or any server using Dulwich), will
hang up with an internal error upon seeing an unknown capability.

Instead, each client must record whether we saw an agent string from
the server, and respond with its agent only if the server mentioned
it first.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agosend-pack: fix capability-sending logic
Jeff King [Fri, 10 Aug 2012 07:57:31 +0000 (03:57 -0400)]
send-pack: fix capability-sending logic

If we have capabilities to send to the server, we send the
regular "want" line followed by a NUL, then the
capabilities; otherwise, we do not even send the NUL.

However, when checking whether we want to send the "quiet"
capability, we check args->quiet, which is wrong. That flag
only tells us whether the client side wanted to be quiet,
not whether the server supports it (originally, in c207e34f,
it meant both; however, that was later split into two flags
by 01fdc21f).

We still check the right flag when actually printing
"quiet", so this could only have two effects:

  1. We might send the trailing NUL when we do not otherwise
     need to. In theory, an antique pre-capability
     implementation of git might choke on this (since the
     client is instructed never to respond with capabilities
     that the server has not first advertised).

  2. We might also want to send the quiet flag if the
     args->progress flag is false, but this code path would
     not trigger in that instance.

In practice, it almost certainly never matters. The
report-status capability dates back to 2005. Any real-world
server is going to advertise that, and we will always
respond with at least that capability.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agorebase -i: use full onto sha1 in reflog
Michael J Gruber [Fri, 10 Aug 2012 06:51:19 +0000 (08:51 +0200)]
rebase -i: use full onto sha1 in reflog

'git rebase' uses the full onto sha1 for the reflog message whereas 'git
rebase -i' uses the short sha1. This is not only inconsistent, but can
lead to problems when the reflog is inspected at a later time at which
that abbreviation may have become ambiguous.

Make 'rebase -i' use the full onto sha1, as well.

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge git://github.com/git-l10n/git-po
Junio C Hamano [Thu, 9 Aug 2012 17:51:46 +0000 (10:51 -0700)]
Merge git://github.com/git-l10n/git-po

L10n updates for 1.7.12-rc2

* 'master' of git://github.com/git-l10n/git-po:
  l10n: Update Swedish translation (1168t0f0u)
  l10n: de.po: translate 77 new messages
  l10n: vi.po: update one message
  l10n: zh_CN.po: update one translation
  l10n: Update one message in git.pot

11 years agoadd tests for 'git rebase --keep-empty'
Martin von Zweigbergk [Thu, 9 Aug 2012 15:39:51 +0000 (08:39 -0700)]
add tests for 'git rebase --keep-empty'

Add test cases for 'git rebase --keep-empty' with and without an
"empty" commit already in upstream. The empty commit that is about to
be rebased should be kept in both cases.

Signed-off-by: Martin von Zweigbergk <martin.von.zweigbergk@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agol10n: Update Swedish translation (1168t0f0u)
Peter Krefting [Thu, 9 Aug 2012 05:36:41 +0000 (06:36 +0100)]
l10n: Update Swedish translation (1168t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
11 years agoMerge branch 'bw/maint-1.7.9-solaris-getpass'
Junio C Hamano [Wed, 8 Aug 2012 22:14:57 +0000 (15:14 -0700)]
Merge branch 'bw/maint-1.7.9-solaris-getpass'

The recent update to terminal I/O interface to get passwords &c
interactively didn't quite work on Solaris.

* bw/maint-1.7.9-solaris-getpass:
  Enable HAVE_DEV_TTY for Solaris
  terminal: seek when switching between reading and writing

11 years agosh-setup: protect from exported IFS
Junio C Hamano [Wed, 8 Aug 2012 19:08:17 +0000 (12:08 -0700)]
sh-setup: protect from exported IFS

Many scripted Porcelains rely on being able to split words at the
default $IFS characters, i.e. SP, HT and LF.  If the user exports a
non-default IFS to the environment, what they read from plumbing
commands such as ls-files that use HT to delimit fields may not be
split in the way we expect.

Protect outselves by resetting it, just like we do so against CDPATH
exported to the environment.

Noticed by Andrew Dranse <adranse@oanda.com>.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocheck-docs: get documented command list from Makefile
Jeff King [Wed, 8 Aug 2012 20:57:52 +0000 (16:57 -0400)]
check-docs: get documented command list from Makefile

The current code tries to get a list of documented commands
by doing "ls Documentation/git*txt" and culling a bunch of
special cases from the result. Looking for "git-*.txt" would
be more accurate, but would miss a few commands like
"gitweb" and "gitk".

Fortunately, Documentation/Makefile already knows what this
list is, so we can just ask it. Annoyingly, we still have to
post-process its output a little, since make will print
extra cruft like "GIT-VERSION-FILE is up to date" to stdout.

Now that our list is accurate, we can remove all of the ugly
special-cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocheck-docs: drop git-help special-case
Jeff King [Wed, 8 Aug 2012 20:57:13 +0000 (16:57 -0400)]
check-docs: drop git-help special-case

The check-docs target special-cases git-help to avoid
mentioning it as "documented but removed". This dates back
to the early implementation of git-help, when its code was
simply included inside git.c.

These days it is a full-fledged builtin (in builtin/help.c)
and does not need special-casing.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocheck-docs: list git-gui as a command
Jeff King [Wed, 8 Aug 2012 20:56:42 +0000 (16:56 -0400)]
check-docs: list git-gui as a command

git-gui is already documented and mentioned in command-list,
but adding it to the Makefile makes sure it is so. We also
add its alias git-citool (which is also documented).

As a result, we can drop them from the special case
statement that avoids them being listed as "documented but
does not exist".

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocheck-docs: factor out command-list
Jeff King [Wed, 8 Aug 2012 20:56:04 +0000 (16:56 -0400)]
check-docs: factor out command-list

The check-docs command list is composed from several
Makefile variables plus some special cases. Let's make the
meaning of the list more obvious and avoid repeating
ourselves by factoring it out.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocommand-list: mention git-credential-* helpers
Jeff King [Wed, 8 Aug 2012 18:34:49 +0000 (14:34 -0400)]
command-list: mention git-credential-* helpers

These commands were never added to the command-list. Adding
them makes "make check-docs" run without complaint.
While we're at it, let's capitalize the first letter of
their one-line summaries to match the rest of the git
manpages.

The credential-cache--daemon command is somewhat special. It
is already ignored by check-docs because it contains a "--",
marking it as a non-interesting implementation detail. It
is, in fact, documented, but since the documentation
basically just redirects you to a more appropriate command
anyway, let's explicitly omit it so it is not mentioned in
git(1).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocommand-list: add git-sh-i18n
Jeff King [Wed, 8 Aug 2012 18:34:39 +0000 (14:34 -0400)]
command-list: add git-sh-i18n

This is in the same category as git-sh-setup.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocheck-docs: update non-command documentation list
Jeff King [Wed, 8 Aug 2012 18:34:33 +0000 (14:34 -0400)]
check-docs: update non-command documentation list

The check-docs target looks at Documentation/git*txt and
complains if any entry does not have a matching command.
Therefore we need to explicitly ignore any entries which are
not meant to describe a command (like gitattributes.txt).
This list has grown stale over time, so let's bring it up to
date.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agocheck-docs: mention gitweb specially
Jeff King [Wed, 8 Aug 2012 18:32:37 +0000 (14:32 -0400)]
check-docs: mention gitweb specially

Like gitk, gitweb is not listed in the usual Makefile
variables and must be fed to check-docs specially. Otherwise
check-docs thinks it is documented but removed.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoDocumentation: list git-credential in plumbing commands
Matthieu Moy [Wed, 8 Aug 2012 07:58:27 +0000 (09:58 +0200)]
Documentation: list git-credential in plumbing commands

Commit e30b2feb1b (Jun 24 2012, add 'git credential' plumbing command)
forgot to add git-credential to command-list.txt, hence the command was
not appearing in the documentation, making it hard for users to discover
it.

While we're there, capitalize the description line for git-crendential
for consistency with other commands.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoMerge git://github.com/ralfth/git-po-de
Jiang Xin [Tue, 7 Aug 2012 23:23:01 +0000 (07:23 +0800)]
Merge git://github.com/ralfth/git-po-de

* git://github.com/ralfth/git-po-de:
  l10n: de.po: translate 77 new messages

11 years agoprune.c: only print informational message in show_only or verbose mode
Brandon Casey [Tue, 7 Aug 2012 05:01:49 +0000 (22:01 -0700)]
prune.c: only print informational message in show_only or verbose mode

"git prune" reports removal of loose object files that are no longer
necessary only under the "-v" option, but unconditionally reports
removal of temporary files that are no longer needed.

The original thinking was that the presence of a leftover temporary
file should be an unusual occurrence that may indicate an earlier
failure of some sort, and the user may want to be reminded of it.
Removing an unnecessary loose object file, on the other hand, is
just part of the normal operation.  That is why the former is always
printed out and the latter only when -v is used.

But neither report is particularly useful.  Hide both of these
behind the "-v" option for consistency.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agodocs: monospace listings in docbook output
Jeff King [Tue, 7 Aug 2012 20:07:38 +0000 (16:07 -0400)]
docs: monospace listings in docbook output

When asciidoc converts a listing block like:

----------------------
$ git log --merge
----------------------

it marks it to be displayed in a monospace font. This works
fine when generating HTML output. However, when generating
docbook output, we override the expansion of a listingblock
to work around bugs in some versions of the docbook
toolchain. Our override did not mark the listingblock with
the "monospaced" class.

The main output that uses docbook as an intermediate format
is the manpages. We didn't notice any issue there because
the monospaced class seems to be ignored when generating
roff from the docbook manpages.

However, when generating texinfo to make info pages, docbook
does respect this class. The resulting texinfo output
properly uses "@example" blocks to display the listing in
this case. Besides possibly looking prettier in some texinfo
backends,  one important effect is that the monospace font
suppresses texinfo's expansion of "--" and "---" into
en-dashes and em-dashes.  With the current code, the example
above ends up looking like "git log -merge", which is
confusing and wrong.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoGit 1.7.12-rc2 v1.7.12-rc2
Junio C Hamano [Tue, 7 Aug 2012 17:39:34 +0000 (10:39 -0700)]
Git 1.7.12-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agol10n: de.po: translate 77 new messages
Ralf Thielow [Thu, 2 Aug 2012 16:06:12 +0000 (18:06 +0200)]
l10n: de.po: translate 77 new messages

Translate 77 new messages came from git.pot update
in 3b6137f (l10n: Update git.pot (76 new, 4 removed
messages)) and bb2ba06 (l10n: Update one message in
git.pot).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
11 years agoreceive-pack: do not leak output from auto-gc to standard output
Junio C Hamano [Tue, 7 Aug 2012 05:31:10 +0000 (22:31 -0700)]
receive-pack: do not leak output from auto-gc to standard output

The standard output channel of receive-pack is a structured protocol
channel, and subprocesses must never be allowed to leak anything
into it by writing to their standard output.

Use RUN_COMMAND_STDOUT_TO_STDERR option to run_command_v_opt() just
like we do when running hooks to prevent output from "gc" leaking to
the standard output.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agot/t5400: demonstrate breakage caused by informational message from prune
Brandon Casey [Tue, 7 Aug 2012 05:01:48 +0000 (22:01 -0700)]
t/t5400: demonstrate breakage caused by informational message from prune

When receive-pack triggers 'git gc --auto' and 'git prune' is called to
remove a stale temporary object, 'git prune' prints an informational
message to stdout about the file that it will remove.  Since this message
is written to stdout, it is sent back over the transport channel to the git
client which tries to interpret it as part of the pack protocol and then
promptly terminates with a complaint about a protocol error.

Introduce a test which exercises the auto-gc functionality of receive-pack
and demonstrates this breakage.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoEnable HAVE_DEV_TTY for Solaris
Ben Walton [Tue, 7 Aug 2012 03:07:42 +0000 (23:07 -0400)]
Enable HAVE_DEV_TTY for Solaris

Now that git_terminal_prompt can cleanly interact with /dev/tty on
Solaris, enable HAVE_DEV_TTY so that this code path is used for
credential reading instead of relying on the crippled getpass().

Signed-off-by: Ben Walton <bwalton@artsci.utoronto.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agoterminal: seek when switching between reading and writing
Jeff King [Tue, 7 Aug 2012 04:10:26 +0000 (00:10 -0400)]
terminal: seek when switching between reading and writing

When a stdio stream is opened in update mode (e.g., "w+"),
the C standard forbids switching between reading or writing
without an intervening positioning function. Many
implementations are lenient about this, but Solaris libc
will flush the recently-read contents to the output buffer.
In this instance, that meant writing the non-echoed password
that the user just typed to the terminal.

Fix it by inserting a no-op fseek between the read and
write.

The opposite direction (writing followed by reading) is also
disallowed, but our intervening fflush is an acceptable
positioning function for that alternative.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
11 years agol10n: vi.po: update one message
Tran Ngoc Quan [Tue, 7 Aug 2012 00:18:01 +0000 (07:18 +0700)]
l10n: vi.po: update one message

* Translate message that updated from commit bb2ba06

Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>