gitweb.git
bash prompt: fix redirection coding style in testsSZEDER Gábor Mon, 17 Jun 2013 20:34:16 +0000 (22:34 +0200)

bash prompt: fix redirection coding style in tests

Use '>file' instead of '> file', in accordance with the coding
guidelines.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>

Update draft release notes to 1.8.4Junio C Hamano Sun, 23 Jun 2013 21:55:45 +0000 (14:55 -0700)

Update draft release notes to 1.8.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'mz/rebase-tests'Junio C Hamano Sun, 23 Jun 2013 21:53:26 +0000 (14:53 -0700)

Merge branch 'mz/rebase-tests'

* mz/rebase-tests:
rebase topology tests: fix commit names on case-insensitive file systems
tests: move test for rebase messages from t3400 to t3406
t3406: modernize style
add tests for rebasing merged history
add tests for rebasing root
add tests for rebasing of empty commits
add tests for rebasing with patch-equivalence present
add simple tests of consistency across rebase types

Merge branch 'jk/unpack-entry-fallback-to-another'Junio C Hamano Sun, 23 Jun 2013 21:53:20 +0000 (14:53 -0700)

Merge branch 'jk/unpack-entry-fallback-to-another'

* jk/unpack-entry-fallback-to-another:
unpack_entry: do not die when we fail to apply a delta
t5303: drop "count=1" from corruption dd

Merge branch 'jk/apache-test-for-2.4'Junio C Hamano Sun, 23 Jun 2013 21:53:17 +0000 (14:53 -0700)

Merge branch 'jk/apache-test-for-2.4'

* jk/apache-test-for-2.4:
lib-httpd/apache.conf: check version only after mod_version loads
t/lib-httpd/apache.conf: configure an MPM module for apache 2.4
t/lib-httpd/apache.conf: load compat access module in apache 2.4
t/lib-httpd/apache.conf: load extra auth modules in apache 2.4
t/lib-httpd/apache.conf: do not use LockFile in apache >= 2.4

Merge branch 'cm/remote-mediawiki-perlcritique'Junio C Hamano Sun, 23 Jun 2013 21:53:13 +0000 (14:53 -0700)

Merge branch 'cm/remote-mediawiki-perlcritique'

* cm/remote-mediawiki-perlcritique: (31 commits)
git-remote-mediawiki: make error message more precise
git-remote-mediawiki: add a perlcritic rule in Makefile
git-remote-mediawiki: add a .perlcriticrc file
git-remote-mediawiki: clearly rewrite double dereference
git-remote-mediawiki: fix a typo ("mediwiki" instead of "mediawiki")
git-remote-mediawiki: put non-trivial numeric values in constants.
git-remote-mediawiki: don't use quotes for empty strings
git-remote-mediawiki: replace "unless" statements with negated "if" statements
git-remote-mediawiki: brace file handles for print for more clarity
git-remote-mediawiki: modify strings for a better coding-style
git-remote-mediawiki: put long code into a subroutine
git-remote-mediawiki: remove import of unused open2
git-remote-mediawiki: check return value of open
git-remote-mediawiki: assign a variable as undef and make proper indentation
git-remote-mediawiki: rename a variable ($last) which has the name of a keyword
git-remote-mediawiki: remove unused variable $entry
git-remote-mediawiki: turn double-negated expressions into simple expressions
git-remote-mediawiki: change the name of a variable
git-remote-mediawiki: add newline in the end of die() error messages
git-remote-mediawiki: change style in a regexp
...

Merge branch 'bp/remote-mw-tests'Junio C Hamano Sun, 23 Jun 2013 21:53:11 +0000 (14:53 -0700)

Merge branch 'bp/remote-mw-tests'

* bp/remote-mw-tests:
git-remote-mediawiki: remove hardcoded version number in the test suite

Merge branch 'rr/rebase-autostash'Junio C Hamano Sun, 23 Jun 2013 21:53:07 +0000 (14:53 -0700)

Merge branch 'rr/rebase-autostash'

* rr/rebase-autostash:
rebase: finish_rebase() in noop rebase
rebase: finish_rebase() in fast-forward rebase
rebase: guard against missing files in read_basic_state()

Merge branch 'rr/prompt-rebase-breakage-fix'Junio C Hamano Sun, 23 Jun 2013 21:53:05 +0000 (14:53 -0700)

Merge branch 'rr/prompt-rebase-breakage-fix'

* rr/prompt-rebase-breakage-fix:
prompt: squelch error output from cat

Merge branch 'jg/status-config'Junio C Hamano Sun, 23 Jun 2013 21:51:58 +0000 (14:51 -0700)

Merge branch 'jg/status-config'

"git status" learned status.branch and status.short configuration
variables to use --branch and --short options by default (override
with --no-branch and --no-short options from the command line).

* jg/status-config:
status: introduce status.branch to enable --branch by default
status: introduce status.short to enable --short by default

add -i: add extra options at the right place in "diff... Junio C Hamano Sun, 23 Jun 2013 19:19:05 +0000 (12:19 -0700)

add -i: add extra options at the right place in "diff" command line

Appending "--diff-algorithm=histogram" at the end of canned command
line for various modes of "diff" is correct for most of them but not
for "stash" that has a non-option already wired in, like so:

'stash' => {
DIFF => 'diff-index -p HEAD',

Appending an extra option after non-option may happen to work due to
overly lax command line parser, but that is not something we should
rely on. Instead, splice in the extra argument immediately after the
command name (i.e. 'diff-index', 'diff-files', etc.).

Signed-off-by: Junio C Hamano <gitster@pobox.com>

user-manual: Update download size for Git and the kernelW. Trevor King Wed, 19 Jun 2013 01:55:22 +0000 (21:55 -0400)

user-manual: Update download size for Git and the kernel

They've grown since d19fbc3 (Documentation: add git user's manual,
2007-01-07) when the stats were initially added. I've rounded
download sizes up to the nearest multiple of ten MiB to decrease the
precision and give a bit of growing room. Exact sizes:

$ git clone git://git.kernel.org/pub/scm/git/git.git
Initialized empty Git repository in /tmp/git/.git/
remote: Counting objects: 156872, done.
remote: Compressing objects: 100% (40826/40826), done.
remote: Total 156872 (delta 115322), reused 155492 (delta 114094)
Receiving objects: 100% (156872/156872), 37.29 MiB | 7.54 MiB/s, done.
Resolving deltas: 100% (115322/115322), done.

$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
Initialized empty Git repository in /tmp/linux/.git/
remote: Counting objects: 3057404, done.
remote: Compressing objects: 100% (474769/474769), done.
Receiving objects: 100% (3057404/3057404), 634.33 MiB | 27.95 MiB/s, done.
remote: Total 3057404 (delta 2570385), reused 3040910 (delta 2554408)
Resolving deltas: 100% (2570385/2570385), done.
Checking out files: 100% (43012/43012), done.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: Update 'linux-2.6.git' -> 'linux.git'W. Trevor King Sat, 22 Jun 2013 14:46:27 +0000 (10:46 -0400)

Documentation: Update 'linux-2.6.git' -> 'linux.git'

The 3.x tree has been out for a while now. The -2.6 repository name
survived the initial release [1], but kernel.org now only lists
'linux.git' (for aegl as well as torvalds) [2].

[1]: http://article.gmane.org/gmane.linux.kernel/1147422
On 2011-05-30 01:47:57 GMT, Linus Torvalds wrote:
> ... yes, that means that my git tree is still called
> "linux-2.6.git" on kernel.org.
[2]: http://git.kernel.org/cgit/

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: Update the NFS remote examples to use... W. Trevor King Sat, 22 Jun 2013 14:46:26 +0000 (10:46 -0400)

Documentation: Update the NFS remote examples to use the staging repo

linux-nfs.org seems to have restructured their repository layout since
8391c60 (git-remote.txt: fix example url, 2007-11-02), and Bruce's
repo is now at git://git.linux-nfs.org/projects/bfields/linux.git.
Bruce also has a more richer internal branch structure (master,
everything, for-3.1, ...), so updating the existing example to use his
current repo may be confusing.

To simplify, I've replaced the NFS repo with Greg's staging repo.
I've also updated the output of the surrounding commands to match the
output of a current run through.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc/clone: Pick more compelling paths for the --referen... W. Trevor King Sat, 22 Jun 2013 14:46:25 +0000 (10:46 -0400)

doc/clone: Pick more compelling paths for the --reference example

There may be times when using one of your local repositories as a
reference for a new clone make sense, but the implied version-bump in
the old example isn't one of them. I think a more intuitive example
is multi-user system with a central reference clone, and the new paths
hint at this use case.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

doc/clone: Remove the '--bare -l -s' exampleW. Trevor King Sat, 22 Jun 2013 14:46:24 +0000 (10:46 -0400)

doc/clone: Remove the '--bare -l -s' example

There are other examples in git-clone.txt demonstrating both '--bare'
and '-l -s'.

Signed-off-by: W. Trevor King <wking@tremily.us>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

lib-httpd/apache.conf: check version only after mod_ver... Jeff King Fri, 21 Jun 2013 18:12:51 +0000 (14:12 -0400)

lib-httpd/apache.conf: check version only after mod_version loads

Commit 0442743 introduced an <IfVersion> directive near the
top of the apache config file. However, at that point we
have not yet checked for and loaded the mod_version module.
This means that the directive will behave oddly if
mod_version is dynamically loaded, failing to match when it
should.

We can fix this by moving the whole block below the
LoadModule directive for mod_version.

Reported-by: Brian Gernhardt <brian@gernhardtsoftware.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Fri, 21 Jun 2013 18:26:41 +0000 (11:26 -0700)

Sync with maint

* maint:
completion: complete diff --word-diff

t6003: add --author-date-order testJunio C Hamano Fri, 21 Jun 2013 18:08:02 +0000 (11:08 -0700)

t6003: add --author-date-order test

Tweak the --topo/date-order test vector a bit and mark the author
dates of two commits (a2 and a3) earlier than their own committer
dates, making them much older than other commits that are made on
parallel branches to simulate the case where a long running topic
was rebased recently.

They will show up as recent in the --date-order output due to their
timestamps, but they appear a lot later in the --author-date-order
output, even though their committer timestamp says otherwise.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

topology tests: teach a helper to set author dates... Junio C Hamano Fri, 21 Jun 2013 18:03:32 +0000 (11:03 -0700)

topology tests: teach a helper to set author dates as well

Introduce on_dates helper that is similar to on_committer_date but
also sets the author date, not just the committer date.

At this step, just set the same timestamp to the author date as the
committer date, as no test looks at author date yet.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

t6003: add --date-order testJunio C Hamano Fri, 21 Jun 2013 17:52:06 +0000 (10:52 -0700)

t6003: add --date-order test

The "--date-order" output is a slight twist of "--topo-order" in
that commits from parallel histories are shown in their committer
date order without an attempt to clump commits from a single line
of history together like --topo-order does.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

topology tests: teach a helper to take abbreviated... Junio C Hamano Fri, 21 Jun 2013 17:29:59 +0000 (10:29 -0700)

topology tests: teach a helper to take abbreviated timestamps

The on_committer_date helper in t/lib-t6000 is used in t6002 and
t6003 with timestamps on a single day within a single minute
(i.e. 1971-08-16 00:00) and the tests repeat this over and over.

The actual value of the timestamp, however, does not matter very
much; only their relative ordering does.

Introduce another helper to expand only the suffix of the timestamp
to a full timestamp to make the lines shorter, and use it in this
helper. Also, because all the commits in the test are made with
specific GIT_COMMITTER_DATE, stop unsetting it at the end of the
helper.

We'll be specifying the author timestamp to these test commits in a
later patch, which will be helped with this change.

Also remove a test that was commented-out from t6003; it used to
test a commit with the same parent listed twice, which was allowed
by mistake but was fixed long time ago.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/lib-t6000: style fixesJunio C Hamano Fri, 21 Jun 2013 17:12:48 +0000 (10:12 -0700)

t/lib-t6000: style fixes

Mostly fixes to initial indentation with 8-SP (they should be HT)
and wrapping long lines.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

web--browse: support /usr/bin/cygstart on CygwinYaakov Selkowitz Fri, 21 Jun 2013 07:24:32 +0000 (02:24 -0500)

web--browse: support /usr/bin/cygstart on Cygwin

While both GUI and console Cygwin browsers do exist, anecdotal evidence
suggests most users rely on their native Windows browser. cygstart,
which is a long-standing part of the base Cygwin installation, will
cause the page to be opened in the default Windows browser (the one
registered to open .html files).

Signed-off-by: Yaakov Selkowitz <yselkowitz@users.sourceforge.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

transport-helper: be quiet on read errors from helpersJeff King Fri, 21 Jun 2013 07:05:39 +0000 (03:05 -0400)

transport-helper: be quiet on read errors from helpers

Prior to commit 81d340d4, we did not print any error message
if a remote transport helper died unexpectedly. If a helper
did not print any error message (e.g., because it crashed),
the user could be left confused. That commit tried to
rectify the situation by printing a note that the helper
exited unexpectedly.

However, this makes a much more common case worse: when a
helper does die with a useful message, we print the extra
"Reading from 'git-remote-foo failed" message. This can also
end up confusing users, as they may not even know what
remote helpers are (e.g., the fact that http support comes
through git-remote-https is purely an implementation detail
that most users do not know or care about).

Since we do not have a good way of knowing whether the
helper printed a useful error, and since the common failure
mode is for it to do so, let's default to remaining quiet.
Debuggers can dig further by setting GIT_TRANSPORT_HELPER_DEBUG.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: complete diff --word-diffRamkumar Ramachandra Tue, 18 Jun 2013 19:24:05 +0000 (00:54 +0530)

completion: complete diff --word-diff

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

apply: carefully strdup a possibly-NULL nameThomas Rast Fri, 21 Jun 2013 11:38:00 +0000 (13:38 +0200)

apply: carefully strdup a possibly-NULL name

2901bbe (apply: free patch->{def,old,new}_name fields, 2012-03-21)
cleaned up the memory management of filenames in the patches, but
forgot that find_name_traditional() can return NULL as a way of saying
"I couldn't find a name".

That NULL unfortunately gets passed into xstrdup() next, resulting in
a segfault. Use null_strdup() so as to safely propagate the null,
which will let us emit the correct error message.

Reported-by: DevHC on #git
Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.4Junio C Hamano Thu, 20 Jun 2013 23:13:41 +0000 (16:13 -0700)

Update draft release notes to 1.8.4

Merge branch 'cm/remote-mediawiki'Junio C Hamano Thu, 20 Jun 2013 23:02:42 +0000 (16:02 -0700)

Merge branch 'cm/remote-mediawiki'

* cm/remote-mediawiki:
git-remote-mediawiki: display message when launched directly

Merge branch 'rs/match-trees-refactor'Junio C Hamano Thu, 20 Jun 2013 23:02:40 +0000 (16:02 -0700)

Merge branch 'rs/match-trees-refactor'

Code cleanup.

* rs/match-trees-refactor:
match-trees: factor out fill_tree_desc_strict

Merge branch 'rs/logical-vs-binary-or'Junio C Hamano Thu, 20 Jun 2013 23:02:38 +0000 (16:02 -0700)

Merge branch 'rs/logical-vs-binary-or'

Code cleanup.

* rs/logical-vs-binary-or:
use logical OR (||) instead of binary OR (|) in logical context

Merge branch 'mm/color-auto-default'Junio C Hamano Thu, 20 Jun 2013 23:02:33 +0000 (16:02 -0700)

Merge branch 'mm/color-auto-default'

Flip the default for color.ui to 'auto', which is what many
tutorials recommend new users to do.

* mm/color-auto-default:
make color.ui default to 'auto'
config: refactor management of color.ui's default value

Merge branch 'rs/discard-index-discard-array'Junio C Hamano Thu, 20 Jun 2013 23:02:30 +0000 (16:02 -0700)

Merge branch 'rs/discard-index-discard-array'

* rs/discard-index-discard-array:
read-cache: free cache in discard_index
read-cache: add simple performance test

Merge branch 'nd/traces'Junio C Hamano Thu, 20 Jun 2013 23:02:28 +0000 (16:02 -0700)

Merge branch 'nd/traces'

* nd/traces:
git.txt: document GIT_TRACE_PACKET
core: use env variable instead of config var to turn on logging pack access

Merge branch 'fc/show-non-empty-errors-in-test'Junio C Hamano Thu, 20 Jun 2013 23:02:24 +0000 (16:02 -0700)

Merge branch 'fc/show-non-empty-errors-in-test'

* fc/show-non-empty-errors-in-test:
test: test_must_be_empty helper

Merge branch 'fc/makefile'Junio C Hamano Thu, 20 Jun 2013 23:02:21 +0000 (16:02 -0700)

Merge branch 'fc/makefile'

Makefile simplification.

* fc/makefile:
Makefile: use $^ to avoid listing prerequisites on the command line
build: do not install git-remote-testgit
build: generate and clean test scripts

Merge branch 'js/test-ln-s-add'Junio C Hamano Thu, 20 Jun 2013 23:02:18 +0000 (16:02 -0700)

Merge branch 'js/test-ln-s-add'

Many tests that check the behaviour of symbolic links stored in the
index or the tree objects do not have to be skipped on a filesystem
that lack symbolic link support.

* js/test-ln-s-add:
t4011: remove SYMLINKS prerequisite
t6035: use test_ln_s_add to remove SYMLINKS prerequisite
t3509, t4023, t4114: use test_ln_s_add to remove SYMLINKS prerequisite
t3100: use test_ln_s_add to remove SYMLINKS prerequisite
t3030: use test_ln_s_add to remove SYMLINKS prerequisite
t0000: use test_ln_s_add to remove SYMLINKS prerequisite
tests: use test_ln_s_add to remove SYMLINKS prerequisite (trivial cases)
tests: introduce test_ln_s_add
t3010: modernize style
test-chmtime: Fix exit code on Windows

Merge branch 'nd/make-wildmatch-default'Junio C Hamano Thu, 20 Jun 2013 23:02:14 +0000 (16:02 -0700)

Merge branch 'nd/make-wildmatch-default'

* nd/make-wildmatch-default:
Makefile: promote wildmatch to be the default fnmatch implementation

pull: merge into unborn by fast-forwarding from empty... Thomas Rast Thu, 20 Jun 2013 22:38:28 +0000 (18:38 -0400)

pull: merge into unborn by fast-forwarding from empty tree

The logic for pulling into an unborn branch was originally
designed to be used on a newly-initialized repository
(d09e79c, git-pull: allow pulling into an empty repository,
2006-11-16). It thus did not initially deal with
uncommitted changes in the unborn branch. The case of an
_unstaged_ untracked file was fixed by 4b3ffe5 (pull: do not
clobber untracked files on initial pull, 2011-03-25).
However, it still clobbered existing staged files, both when
the file exists in the merged commit (it will be
overwritten), and when it does not (it will be deleted).

We fix this by doing a two-way merge, where the "current"
side of the merge is an empty tree, and the "target" side is
HEAD (already updated to FETCH_HEAD at this point). This
amounts to claiming that all work in the index was done vs.
an empty tree, and thus all content of the index is
precious.

Note that this use of read-tree just gives us protection
against overwriting index and working tree changes. It will
not actually result in a 3-way merge conflict in the index.
This is fine, as this is a rare situation, and the conflict
would not be interesting anyway (it must, by definition, be
an add/add conflict with the whole content conflicting). And
it makes it simpler for the user to recover, as they have no
HEAD to "git reset" back to.

Reported-by: Stefan Schüßler <mail@stefanschuessler.de>
Signed-off-by: Thomas Rast <trast@inf.ethz.ch>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pull: update unborn branch tip after indexJeff King Thu, 20 Jun 2013 22:36:31 +0000 (18:36 -0400)

pull: update unborn branch tip after index

When commit d09e79c taught git to pull into an unborn
branch, it first updated the unborn branch to point at the
pulled commit, and then used read-tree to update the index
and working tree. That ordering made sense, since any
failure of the latter step would be due to filesystem
errors, and one could then recover with "git reset --hard".

Later, commit 4b3ffe5 added extra safety for existing files
in the working tree by asking read-tree to bail out when it
would overwrite such a file. This error mode is much less
"your pull failed due to random errors" and more like "we
reject this pull because it would lose data". In that case,
it makes sense not to update the HEAD ref, just as a regular
rejected merge would do.

This patch reverses the order of the update-ref and
read-tree calls, so that we do not touch the HEAD ref at all if a
merge is rejected. This also means that we would not update
HEAD in case of a transient filesystem error, but those are
presumably less rare (and one can still recover by repeating
the pull, or by accessing FETCH_HEAD directly).

While we're reorganizing the code, we can drop the "exit 1"
from the end of our command chain. We exit immediately
either way, and just calling exit without an argument will
use the exit code from the last command.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

for_each_ref: load all loose refs before packed refsJeff King Thu, 20 Jun 2013 08:37:53 +0000 (10:37 +0200)

for_each_ref: load all loose refs before packed refs

If we are iterating through the refs using for_each_ref (or
any of its sister functions), we can get into a race
condition with a simultaneous "pack-refs --prune" that looks
like this:

0. We have a large number of loose refs, and a few packed
refs. refs/heads/z/foo is loose, with no matching entry
in the packed-refs file.

1. Process A starts iterating through the refs. It loads
the packed-refs file from disk, then starts lazily
traversing through the loose ref directories.

2. Process B, running "pack-refs --prune", writes out the
new packed-refs file. It then deletes the newly packed
refs, including refs/heads/z/foo.

3. Meanwhile, process A has finally gotten to
refs/heads/z (it traverses alphabetically). It
descends, but finds nothing there. It checks its
cached view of the packed-refs file, but it does not
mention anything in "refs/heads/z/" at all (it predates
the new file written by B in step 2).

The traversal completes successfully without mentioning
refs/heads/z/foo at all (the name, of course, isn't
important; but the more refs you have and the farther down
the alphabetical list a ref is, the more likely it is to hit
the race). If refs/heads/z/foo did exist in the packed refs
file at state 0, we would see an entry for it, but it would
show whatever sha1 the ref had the last time it was packed
(which could be an arbitrarily long time ago).

This can be especially dangerous when process A is "git
prune", as it means our set of reachable tips will be
incomplete, and we may erroneously prune objects reachable
from that tip (the same thing can happen if "repack -ad" is
used, as it simply drops unreachable objects that are
packed).

This patch solves it by loading all of the loose refs for
our traversal into our in-memory cache, and then refreshing
the packed-refs cache. Because a pack-refs writer will
always put the new packed-refs file into place before
starting the prune, we know that any loose refs we fail to
see will either truly be missing, or will have already been
put in the packed-refs file by the time we refresh.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

get_packed_ref_cache: reload packed-refs file when... Jeff King Thu, 20 Jun 2013 08:37:52 +0000 (10:37 +0200)

get_packed_ref_cache: reload packed-refs file when it changes

Once we read the packed-refs file into memory, we cache it
to save work on future ref lookups. However, our cache may
be out of date with respect to what is on disk if another
process is simultaneously packing the refs. Normally it
is acceptable for us to be a little out of date, since there
is no guarantee whether we read the file before or after the
simultaneous update. However, there is an important special
case: our packed-refs file must be up to date with respect
to any loose refs we read. Otherwise, we risk the following
race condition:

0. There exists a loose ref refs/heads/master.

1. Process A starts and looks up the ref "master". It
first checks $GIT_DIR/master, which does not exist. It
then loads (and caches) the packed-refs file to see if
"master" exists in it, which it does not.

2. Meanwhile, process B runs "pack-refs --all --prune". It
creates a new packed-refs file which contains
refs/heads/master, and removes the loose copy at
$GIT_DIR/refs/heads/master.

3. Process A continues its lookup, and eventually tries
$GIT_DIR/refs/heads/master. It sees that the loose ref
is missing, and falls back to the packed-refs file. But
it examines its cached version, which does not have
refs/heads/master. After trying a few other prefixes,
it reports master as a non-existent ref.

There are many variants (e.g., step 1 may involve process A
looking up another ref entirely, so even a fully qualified
refname can fail). One of the most interesting ones is if
"refs/heads/master" is already packed. In that case process
A will not see it as missing, but rather will report
whatever value happened to be in the packed-refs file before
process B repacked (which might be an arbitrarily old
value).

We can fix this by making sure we reload the packed-refs
file from disk after looking at any loose refs. That's
unacceptably slow, so we can check its stat()-validity as a
proxy, and read it only when it appears to have changed.

Reading the packed-refs file after performing any loose-ref
system calls is sufficient because we know the ordering of
the pack-refs process: it always makes sure the newly
written packed-refs file is installed into place before
pruning any loose refs. As long as those operations by B
appear in their executed order to process A, by the time A
sees the missing loose ref, the new packed-refs file must be
in place.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add a stat_validity structMichael Haggerty Thu, 20 Jun 2013 08:37:51 +0000 (10:37 +0200)

add a stat_validity struct

It can sometimes be useful to know whether a path in the
filesystem has been updated without going to the work of
opening and re-reading its content. We trust the stat()
information on disk already to handle index updates, and we
can use the same trick here.

This patch introduces a "stat_validity" struct which
encapsulates the concept of checking the stat-freshness of a
file. It is implemented on top of "struct stat_data" to
reuse the logic about which stat entries to trust for a
particular platform, but hides the complexity behind two
simple functions: check and update.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Extract a struct stat_data from cache_entryMichael Haggerty Thu, 20 Jun 2013 08:37:50 +0000 (10:37 +0200)

Extract a struct stat_data from cache_entry

Add public functions fill_stat_data() and match_stat_data() to work
with it. This infrastructure will later be used to check the validity
of other types of file.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

packed_ref_cache: increment refcount when lockedMichael Haggerty Thu, 20 Jun 2013 08:37:49 +0000 (10:37 +0200)

packed_ref_cache: increment refcount when locked

Increment the packed_ref_cache reference count while it is locked to
prevent its being freed.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

do_for_each_entry(): increment the packed refs cache... Michael Haggerty Thu, 20 Jun 2013 08:37:48 +0000 (10:37 +0200)

do_for_each_entry(): increment the packed refs cache refcount

This function calls a user-supplied callback function which could do
something that causes the packed refs cache to be invalidated. So
acquire a reference count on the data structure to prevent our copy
from being freed while we are iterating over it.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: manage lifetime of packed refs cache via referenc... Michael Haggerty Thu, 20 Jun 2013 08:37:47 +0000 (10:37 +0200)

refs: manage lifetime of packed refs cache via reference counting

In struct packed_ref_cache, keep a count of the number of users of the
data structure. Only free the packed ref cache when the reference
count goes to zero rather than when the packed ref cache is cleared.
This mechanism will be used to prevent the cache data structure from
being freed while it is being iterated over.

So far, only the reference in struct ref_cache::packed is counted;
other users will be adjusted in separate commits.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: implement simple transactions for the packed... Michael Haggerty Thu, 20 Jun 2013 08:37:46 +0000 (10:37 +0200)

refs: implement simple transactions for the packed-refs file

Handle simple transactions for the packed-refs file at the
packed_ref_cache level via new functions lock_packed_refs(),
commit_packed_refs(), and rollback_packed_refs().

Only allow the packed ref cache to be modified (via add_packed_ref())
while the packed refs file is locked.

Change clone to add the new references within a transaction.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: wrap the packed refs cache in a level of indirectionMichael Haggerty Thu, 20 Jun 2013 08:37:45 +0000 (10:37 +0200)

refs: wrap the packed refs cache in a level of indirection

As we know, we can solve any problem in this manner. In this case,
the problem is to avoid freeing a packed refs cache while somebody is
using it. So add a level of indirection as a prelude to
reference-counting the packed refs cache.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pack_refs(): split creation of packed refs and entry... Michael Haggerty Thu, 20 Jun 2013 08:37:44 +0000 (10:37 +0200)

pack_refs(): split creation of packed refs and entry writing

Split pack_refs() into multiple passes:

* Iterate over loose refs. For each one that can be turned into a
packed ref, create a corresponding entry in the packed refs cache.

* Write the packed refs to the packed-refs file.

This change isolates the mutation of the packed-refs file to a single
place.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

repack_without_ref(): split list curation and entry... Michael Haggerty Thu, 20 Jun 2013 08:37:43 +0000 (10:37 +0200)

repack_without_ref(): split list curation and entry writing

The repack_without_ref() function first removes the deleted ref from
the internal packed-refs list, then writes the packed-refs list to
disk, omitting any broken or stale entries. This patch splits that
second step into multiple passes:

* collect the list of refnames that should be deleted from packed_refs

* delete those refnames from the cache

* write the remainder to the packed-refs file

The purpose of this change is to make the "write the remainder" part
reusable.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7400: test of UTF-8 submodule names pass under Mac OSTorsten Bögershausen Thu, 20 Jun 2013 14:58:48 +0000 (16:58 +0200)

t7400: test of UTF-8 submodule names pass under Mac OS

submodules with names using UTF-8 need core.precomposeunicode true
under Mac OS X, set it in the test case.

Improve the portability:

- Not all shells on all OS may understand literal UTF-8 strings.
- Use a help variable filled by printf, as we do it in e.g. t0050.

"strange names" can be called UTF-8, rephrase the heading.

While at it, unbreak &&-chain in the test, and use test_config.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-email: sanitize author when writing From lineMichael S. Tsirkin Tue, 18 Jun 2013 12:49:26 +0000 (15:49 +0300)

send-email: sanitize author when writing From line

sender is now sanitized, but we didn't sanitize author when checking
whether From: line is needed in the message body.

As a result git started writing duplicate From: lines when author
matched sender and has utf8 characters.

Reported-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Tested-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-email: add test for duplicate utf8 nameMichael S. Tsirkin Tue, 18 Jun 2013 12:49:29 +0000 (15:49 +0300)

send-email: add test for duplicate utf8 name

Verify that author name is not duplicated if it matches sender, even
if it is in utf8 (the test expects a failure that will be fixed in
the next patch).

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

diff: add --ignore-blank-lines optionAntoine Pelisse Wed, 19 Jun 2013 18:46:07 +0000 (20:46 +0200)

diff: add --ignore-blank-lines option

The goal of the patch is to introduce the GNU diff
-B/--ignore-blank-lines as closely as possible. The short option is not
available because it's already used for "break-rewrites".

When this option is used, git-diff will not create hunks that simply
add or remove empty lines, but will still show empty lines
addition/suppression if they are close enough to "valuable" changes.

There are two differences between this option and GNU diff -B option:
- GNU diff doesn't have "--inter-hunk-context", so this must be handled
- The following sequence looks like a bug (context is displayed twice):

$ seq 5 >file1
$ cat <<EOF >file2
change
1
2

3
4
5
change
EOF
$ diff -u -B file1 file2
--- file1 2013-06-08 22:13:04.471517834 +0200
+++ file2 2013-06-08 22:13:23.275517855 +0200
@@ -1,5 +1,7 @@
+change
1
2
+
3
4
5
@@ -3,3 +5,4 @@
3
4
5
+change

So here is a more thorough description of the option:
- real changes are interesting
- blank lines that are close enough (less than context size) to
interesting changes are considered interesting (recursive definition)
- "context" lines are used around each hunk of interesting changes
- If two hunks are separated by less than "inter-hunk-context", they
will be merged into one.

The implementation does the "interesting changes selection" in a single
pass.

Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

random typofixes (committed missing a 't', successful... Veres Lajos Wed, 19 Jun 2013 05:37:24 +0000 (07:37 +0200)

random typofixes (committed missing a 't', successful missing an 's')

Signed-off-by: Veres Lajos <vlajos@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: write useful reflog message for fast-forwardRamkumar Ramachandra Wed, 19 Jun 2013 07:37:09 +0000 (13:07 +0530)

sequencer: write useful reflog message for fast-forward

The following command

$ git cherry-pick --ff b8bb3f

writes the following uninformative message to the reflog

cherry-pick

Improve it to

cherry-pick: fast-forward

Avoid hard-coding "cherry-pick" in fast_forward_to(), so the sequencer
is generic enough to support future actions.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

resolve_ref_unsafe(): close race condition reading... Michael Haggerty Wed, 19 Jun 2013 06:36:28 +0000 (08:36 +0200)

resolve_ref_unsafe(): close race condition reading loose refs

We read loose references in two steps. The code is roughly:

lstat()
if error ENOENT:
loose ref is missing; look for corresponding packed ref
else if S_ISLNK:
readlink()
if error:
report failure
else if S_ISDIR:
report failure
else
open()
if error:
report failure
read()

The problem is that the first filesystem call, to lstat(), is not
atomic with the second filesystem call, to readlink() or open().
Therefore it is possible for another process to change the file
between our two calls, for example:

* If the other process deletes the file, our second call will fail
with ENOENT, which we *should* interpret as "loose ref is missing;
look for corresponding packed ref". This can arise if the other
process is pack-refs; it might have just written a new packed-refs
file containing the old contents of the reference then deleted the
loose ref.

* If the other process changes a symlink into a plain file, our call
to readlink() will fail with EINVAL, which we *should* respond to by
trying to open() and read() the file.

The old code treats the reference as missing in both of these cases,
which is incorrect.

So instead, handle errors more selectively: if the result of
readline()/open() is a failure that is inconsistent with the result of
the previous lstat(), then something is fishy. In this case jump back
and start over again with a fresh call to lstat().

One race is still possible and undetected: another process could
change the file from a regular file into a symlink between the call to
lstat and the call to open(). The open() call would silently follow
the symlink and not know that something is wrong. This situation
could be detected in two ways:

* On systems that support O_NOFOLLOW, pass that option to the open().

* On other systems, call fstat() on the fd returned by open() and make
sure that it agrees with the stat info from the original lstat().

However, we don't use symlinks anymore, so this situation is unlikely.
Moreover, it doesn't appear that treating a symlink as a regular file
would have grave consequences; after all, this is exactly how the code
handles non-relative symlinks. So this commit leaves that race
unaddressed.

Note that this solves only the part of the race within
resolve_ref_unsafe. In the situation described above, we may still be
depending on a cached view of the packed-refs file; that race will be
dealt with in a future patch.

This problem was reported and diagnosed by Jeff King <peff@peff.net>,
and this solution is derived from his patch.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

resolve_ref_unsafe(): handle the case of an SHA-1 withi... Michael Haggerty Wed, 19 Jun 2013 06:36:27 +0000 (08:36 +0200)

resolve_ref_unsafe(): handle the case of an SHA-1 within loop

There is only one "break" statement within the loop, which jumps to
the code after the loop that handles the case of a file that holds a
SHA-1. So move that code from below the loop into the if statement
where the break was previously located. This makes the logic flow
more local.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

resolve_ref_unsafe(): extract function handle_missing_l... Michael Haggerty Wed, 19 Jun 2013 06:36:26 +0000 (08:36 +0200)

resolve_ref_unsafe(): extract function handle_missing_loose_ref()

The nesting was getting a bit out of hand, and it's about to get
worse.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http.c: don't rewrite the user:passwd string multiple... Brandon Casey Wed, 19 Jun 2013 02:43:49 +0000 (19:43 -0700)

http.c: don't rewrite the user:passwd string multiple times

Curl older than 7.17 (RHEL 4.X provides 7.12 and RHEL 5.X provides
7.15) requires that we manage any strings that we pass to it as
pointers. So, we really shouldn't be modifying this strbuf after we
have passed it to curl.

Our interaction with curl is currently safe (before or after this
patch) since the pointer that is passed to curl is never invalidated;
it is repeatedly rewritten with the same sequence of characters but
the strbuf functions never need to allocate a larger string, so the
same memory buffer is reused.

This "guarantee" of safety is somewhat subtle and could be overlooked
by someone who may want to add a more complex handling of the username
and password. So, let's stop modifying this strbuf after we have
passed it to curl, but also leave a note to describe the assumptions
that have been made about username/password lifetime and to draw
attention to the code.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Acked-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

name-rev: allow to specify a subpath for --refs optionNamhyung Kim Tue, 18 Jun 2013 12:35:31 +0000 (21:35 +0900)

name-rev: allow to specify a subpath for --refs option

When an user wants to filter specific ref using the --refs option,
the pattern needs to match the full ref, e.g. --refs=refs/tags/v1.*.

It'd be convenient to specify a subpath of ref pattern. For
example, --refs=origin/* can find refs/remotes/origin/master by
searching the pattern against its substrings in turn:

refs/remotes/origin/master
remotes/origin/master
origin/master

If it finds a match in a subpath, unambigous part of the ref path will
be removed in the output.

Signed-off-by: Namhyung Kim <namhyung.kim@lge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fix "builtin-*" references to be "builtin/*"Phil Hord Tue, 18 Jun 2013 17:44:58 +0000 (13:44 -0400)

fix "builtin-*" references to be "builtin/*"

Documentation and some comments still refer to files in builtin/
as 'builtin-*.[cho]'. Update these to show the correct location.

Signed-off-by: Phil Hord <hordp@cisco.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Assisted-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: Move "git diff <blob> <blob>"Kevin Bracey Tue, 18 Jun 2013 14:58:50 +0000 (17:58 +0300)

Documentation: Move "git diff <blob> <blob>"

The section describing "git diff <blob> <blob>" had been placed in a
position that disrupted the statement "This is synonymous to the
previous form".

Reorder to place this form after all the <commit>-using forms, and the
note applying to them. Also mention this form in the initial description
paragraph.

Signed-off-by: Kevin Bracey <kevin@bracey.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-merge.txt: weaken warning about uncom... Matthieu Moy Tue, 18 Jun 2013 08:42:55 +0000 (10:42 +0200)

Documentation/git-merge.txt: weaken warning about uncommited changes

Commit 35d2fffd introduced 'git merge --abort' as a synonym to 'git reset
--merge', and added some failing tests in t7611-merge-abort.sh (search
'###' in this file) showing that 'git merge --abort' could not always
recover the pre-merge state.

Still, in many cases, 'git merge --abort' just works, and it is usually
considered that the ability to start a merge with uncommited changes is
an important property of Git.

Weaken the warning by discouraging only merge with /non-trivial/
uncommited changes.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t9802: explicitly name the upstream branch to use... Brandon Casey Tue, 18 Jun 2013 01:40:50 +0000 (18:40 -0700)

t/t9802: explicitly name the upstream branch to use as a base

Prior to commit fa83a33b, the 'git checkout' DWIMery would create a
new local branch if the specified branch name did not exist and it
matched exactly one ref in the "remotes" namespace. It searched
the "remotes" namespace for matching refs using a simple comparison
of the trailing portion of the remote ref names. This approach
could sometimes produce false positives or negatives.

Since fa83a33b, the DWIMery more strictly excludes the remote name
from the ref comparison by iterating through the remotes that are
configured in the .gitconfig file. This has the side-effect that
any refs that exist in the "remotes" namespace, but do not match
the destination side of any remote refspec, will not be used by
the DWIMery.

This change in behavior breaks the tests in t9802 which relied on
the old behavior of searching all refs in the remotes namespace,
since the git-p4 script does not configure any remotes in the
.gitconfig. Let's work around this in these tests by explicitly
naming the upstream branch to base the new local branch on when
calling 'git checkout'.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Acked-by: Pete Wyckoff <pw@padd.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase topology tests: fix commit names on case-insensi... Johannes Sixt Tue, 18 Jun 2013 07:28:07 +0000 (09:28 +0200)

rebase topology tests: fix commit names on case-insensitive file systems

The recently introduced tests used uppercase letters to denote
cherry-picks of commits having the corresponding lowercase letter names.
The helper functions also set up tags with the names of the commits.

But this constellation fails on case-insensitive file systems because
there cannot be distinct tags with names that differ only in case.

Use a less subtle convention for the names of cherry-picked commits.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git-push.txt: explain better cases where... Matthieu Moy Mon, 17 Jun 2013 17:52:41 +0000 (19:52 +0200)

Documentation/git-push.txt: explain better cases where --force is dangerous

The behavior of "git push --force" is rather clear when it updates only
one remote ref, but running it when pushing several branches can really
be dangerous. Warn the users a bit more and give them the alternative to
push only one branch.

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/checkout.c: don't leak memory in check_tracking... Brandon Casey Tue, 18 Jun 2013 01:40:49 +0000 (18:40 -0700)

builtin/checkout.c: don't leak memory in check_tracking_name

remote_find_tracking() populates the query struct with an allocated
string in the dst member. So, we do not need to xstrdup() the string,
since we can transfer ownership from the query struct (which will go
out of scope at the end of this function) to our callback struct, but
we must free the string if it will not be used so we will not leak
memory.

Let's do so.

Signed-off-by: Brandon Casey <drafnel@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: drop the top-level requirementJohn Keeping Sun, 16 Jun 2013 14:18:18 +0000 (15:18 +0100)

submodule: drop the top-level requirement

Use the new rev-parse --prefix option to process all paths given to the
submodule command, dropping the requirement that it be run from the
top-level of the repository.

Since the interpretation of a relative submodule URL depends on whether
or not "remote.origin.url" is configured, explicitly block relative URLs
in "git submodule add" when not at the top level of the working tree.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rev-parse: add --prefix optionJohn Keeping Sun, 16 Jun 2013 14:18:17 +0000 (15:18 +0100)

rev-parse: add --prefix option

This makes 'git rev-parse' behave as if it were invoked from the
specified subdirectory of a repository, with the difference that any
file paths which it prints are prefixed with the full path from the top
of the working tree.

This is useful for shell scripts where we may want to cd to the top of
the working tree but need to handle relative paths given by the user on
the command line.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: show full path in error messageJohn Keeping Sun, 16 Jun 2013 14:18:16 +0000 (15:18 +0100)

submodule: show full path in error message

When --recursive was added to "submodule foreach" in commit 15fc56a (git
submodule foreach: Add --recursive to recurse into nested submodules,
2009-08-19), the error message when the script returns a non-zero status
was not updated to contain $prefix to show the full path. Fix this.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7403: add missing && chainingJohn Keeping Sun, 16 Jun 2013 14:18:15 +0000 (15:18 +0100)

t7403: add missing && chaining

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7403: modernize styleJohn Keeping Sun, 16 Jun 2013 14:18:14 +0000 (15:18 +0100)

t7403: modernize style

Change the indentation to use tabs consistently and start content on the
line after the paren opening a subshell.

Also don't put a space in ">file" and remove ":" from ": >file" to be
consistent with the majority of tests elsewhere.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7401: make indentation consistentJohn Keeping Sun, 16 Jun 2013 14:18:13 +0000 (15:18 +0100)

t7401: make indentation consistent

Only leading whitespace is changed in this patch.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: Add description of --local optionNamhyung Kim Mon, 17 Jun 2013 13:31:31 +0000 (22:31 +0900)

config: Add description of --local option

It was missed in the option list while mentioned from the general
description. Add it for completeness.

Signed-off-by: Namhyung Kim <namhyung@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-submodule.sh: remove duplicate call to set_rev_nameFredrik Gustafsson Mon, 17 Jun 2013 09:55:36 +0000 (11:55 +0200)

git-submodule.sh: remove duplicate call to set_rev_name

set_rev_name is a possiblly expensive operation. If a submodule has
changes in it, set_rev_name was called twice.

Move call to set_rev_name so it's only called once, no matter which
codepath is taken.

Signed-off-by: Fredrik Gustafsson <iveqy@iveqy.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status: give better advice when cherry-pick is in... Ralf Thielow Mon, 17 Jun 2013 04:28:26 +0000 (06:28 +0200)

wt-status: give better advice when cherry-pick is in progress

When cherry-pick is in progress, 'git status' gives the advice to
run "git commit" to finish the cherry-pick.

However, this won't continue the sequencer, when picking a range of
commits.

Advise users to run "git cherry-pick --continue/--abort"; they work
when picking a single commit as well.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetool--lib: refactor {diff,merge}_cmd logicJohn Keeping Sun, 16 Jun 2013 17:51:22 +0000 (18:51 +0100)

mergetool--lib: refactor {diff,merge}_cmd logic

Instead of needing a wrapper to call the diff/merge command, simply
provide the diff_cmd and merge_cmd functions for user-specified tools in
the same way as we do for built-in tools.

Signed-off-by: John Keeping <john@keeping.me.uk>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/Makefile: move infodir to be with other... John Keeping Sun, 16 Jun 2013 17:13:01 +0000 (18:13 +0100)

Documentation/Makefile: move infodir to be with other '*dir's

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/Makefile: fix spaces around assignmentsJohn Keeping Sun, 16 Jun 2013 17:13:00 +0000 (18:13 +0100)

Documentation/Makefile: fix spaces around assignments

A simple style fix; no functional change.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

GIT-VERSION-GEN: support non-standard $GIT_DIR pathDennis Kaarsemaker Sat, 15 Jun 2013 23:01:11 +0000 (01:01 +0200)

GIT-VERSION-GEN: support non-standard $GIT_DIR path

make and make test both work when $GIT_DIR isn't .git, but make dist
included a bogus GIT-VERSION-FILE.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: allow sha1's as part of the pathDennis Kaarsemaker Sat, 15 Jun 2013 21:35:02 +0000 (23:35 +0200)

tests: allow sha1's as part of the path

When running 'make test' from a path such as
.../daily-build/master@bdff0e3a374617dce784f801b97500d9ba2e4705, the
logic in fuzz.sed as generated by t5105-request-pull.sh was backwards,
replacing object names before replacing urls, making the test fail.

Signed-off-by: Dennis Kaarsemaker <dennis@kaarsemaker.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rebase: use 'git stash store' to simplify logicRamkumar Ramachandra Sat, 15 Jun 2013 13:13:26 +0000 (18:43 +0530)

rebase: use 'git stash store' to simplify logic

rebase has no reason to know about the implementation of the stash. In
the case when applying the autostash results in conflicts, replace the
relevant code in finish_rebase () to simply call 'git stash store'.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: introduce 'git stash store'Ramkumar Ramachandra Sat, 15 Jun 2013 13:13:25 +0000 (18:43 +0530)

stash: introduce 'git stash store'

save_stash() contains the logic for doing two potentially independent
operations; the first is preparing the stash merge commit, and the
second is updating the stash ref/ reflog accordingly. While the first
operation is abstracted out into a create_stash() for callers to access
via 'git stash create', the second one is not. Fix this by factoring
out the logic for storing the stash into a store_stash() that callers
can access via 'git stash store'.

Like create, store is not intended for end user interactive use, but for
callers in other scripts. We can simplify the logic in the
rebase.autostash feature using this new subcommand.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

unpack-trees: don't shift conflicts left and rightRené Scharfe Sat, 15 Jun 2013 23:44:43 +0000 (01:44 +0200)

unpack-trees: don't shift conflicts left and right

If o->merge is set, the struct traverse_info member conflicts is shifted
left in unpack_callback, then passed through traverse_trees_recursive
to unpack_nondirectories, where it is shifted right before use. Stop
the shifting and just pass the conflict bit mask as is. Rename the
member to df_conflicts to prove that it isn't used anywhere else.

Signed-off-by: René Scharfe <rene.scharfe@lsrfire.ath.cx>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash: simplify option parser for createRamkumar Ramachandra Sat, 15 Jun 2013 13:13:24 +0000 (18:43 +0530)

stash: simplify option parser for create

The option parser for create unnecessarily checks "$1" inside a case
statement that matches "$1" in the first place.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash doc: document short form -p in synopsisRamkumar Ramachandra Sat, 15 Jun 2013 13:13:23 +0000 (18:43 +0530)

stash doc: document short form -p in synopsis

'git stash save' can take -p, the short form of --patch, as an option.
Document this.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

stash doc: add a warning about using createRamkumar Ramachandra Sat, 15 Jun 2013 13:13:22 +0000 (18:43 +0530)

stash doc: add a warning about using create

Add a note saying that the user probably wants "save" in the create
description. While at it, document that it can optionally take a
message in the synopsis.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/am: use test_path_is_missing() where appropriateRamkumar Ramachandra Sat, 15 Jun 2013 12:43:12 +0000 (18:13 +0530)

t/am: use test_path_is_missing() where appropriate

Replace instances of ! test -d with test_path_is_missing.

Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

am: handle stray $dotest directoryRamkumar Ramachandra Sat, 15 Jun 2013 12:43:11 +0000 (18:13 +0530)

am: handle stray $dotest directory

The following bug has been observed:

$ git am # no input file
^C
$ git am --abort
Resolve operation not in progress, we are not resuming.

This happens because the following test fails:

test -d "$dotest" && test -f "$dotest/last" && test -f "$dotest/next"

and the codepath for an "am in-progress" is not executed. It falls back
to the codepath that treats this as a "fresh execution". Before
rr/rebase-autostash, this condition was

test -d "$dotest"

It would incorrectly execute the "normal" am --abort codepath:

git read-tree --reset -u HEAD ORIG_HEAD
git reset ORIG_HEAD

by incorrectly assuming that an am is "in progress" (i.e. ORIG_HEAD
etc. was written during the previous execution).

Notice that

$ git am
^C

executes nothing of significance, is equivalent to

$ mkdir .git/rebase-apply

Therefore, the correct solution is to treat .git/rebase-apply as a
"stray directory" and remove it on --abort in the fresh-execution
codepath. Also ensure that we're not called with --rebasing from
git-rebase--am.sh; in that case, it is the responsibility of the caller
to handle and stray directories.

While at it, tell the user to run "git am --abort" to get rid of the
stray $dotest directory, if she attempts anything else.

Reported-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge tag 'gitgui-0.18.0' of git://repo.or.cz/git-guiJunio C Hamano Mon, 17 Jun 2013 03:06:55 +0000 (20:06 -0700)

Merge tag 'gitgui-0.18.0' of git://repo.or.cz/git-gui

git-gui 0.18.0

* tag 'gitgui-0.18.0' of git://repo.or.cz/git-gui:
git-gui 0.18
git-gui: avoid an error message when removing the last remote
git-gui: fix file name handling with non-empty prefix
git-gui: bring wish process to front on Mac
git-gui: change dialog button positions for Windows to suit platform.
git-gui: allow "\ No newline at end of file" for linewise staging
git-gui: fix the mergetool launcher for the Beyond Compare tool.
Makefile: replace "echo 1>..." with "echo >..."
French translation: copy -> copie.
git-gui: Fix parsing of <rev> <path-which-not-present-in-worktree>

status: introduce status.branch to enable --branch... Jorge Juan Garcia Garcia Tue, 11 Jun 2013 13:34:05 +0000 (15:34 +0200)

status: introduce status.branch to enable --branch by default

Some people often run 'git status -b'.
The config variable status.branch allows to set it by default.

Signed-off-by: Jorge Juan Garcia Garcia <Jorge-Juan.Garcia-Garcia@ensimag.imag.fr>
Signed-off-by: Mathieu Lienard--Mayor <Mathieu.Lienard--Mayor@ensimag.imag.fr>
Reviewed-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Update draft release notes to 1.8.4Junio C Hamano Sun, 16 Jun 2013 05:12:52 +0000 (22:12 -0700)

Update draft release notes to 1.8.4

Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-gui 0.18 gitgui-0.18.0Pat Thoyts Sat, 15 Jun 2013 22:53:34 +0000 (23:53 +0100)

git-gui 0.18

Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

git-gui: avoid an error message when removing the last... Pat Thoyts Sat, 15 Jun 2013 22:36:27 +0000 (23:36 +0100)

git-gui: avoid an error message when removing the last remote

When the last remote is removed on a system that has tearoff menu items
the code that adjusts the fetch and prune menus may raise an error when
probing the menu entry for a non-existing -label option.
Check the entry type to avoid this fault.

Reported-by: Vedran Miletić <rivanvx@gmail.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>

unpack_entry: do not die when we fail to apply a deltaJeff King Fri, 14 Jun 2013 21:53:34 +0000 (17:53 -0400)

unpack_entry: do not die when we fail to apply a delta

When we try to load an object from disk and fail, our
general strategy is to see if we can get it from somewhere
else (e.g., a loose object). That lets users fix corruption
problems by copying known-good versions of objects into the
object database.

We already handle the case where we were not able to read
the delta from disk. However, when we find that the delta we
read does not apply, we simply die. This case is harder to
trigger, as corruption in the delta data itself would
trigger a crc error from zlib. However, a corruption that
pointed us at the wrong delta base might cause it.

We can do the same "fail and try to find the object
elsewhere" trick instead of dying. This not only gives us a
chance to recover, but also puts us on code paths that will
alert the user to the problem (with the current message,
they do not even know which sha1 caused the problem).

Note that unlike some other pack corruptions, we do not
recover automatically from this case when doing a repack.
There is nothing apparently wrong with the delta, as it
points to a valid, accessible object, and we realize the
error only when the resulting size does not match up. And in
theory, one could even have a case where the corrupted size
is the same, and the problem would only be noticed by
recomputing the sha1.

We can get around this by recomputing the deltas with
--no-reuse-delta, which our test does (and this is probably
good advice for anyone recovering from pack corruption).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5303: drop "count=1" from corruption ddJeff King Fri, 14 Jun 2013 21:51:01 +0000 (17:51 -0400)

t5303: drop "count=1" from corruption dd

This test corrupts pack objects by using "dd" with a seek
command. It passes "count=1 bs=1" to munge just a single
byte. However, the test added in commit b3118bdc wants to
munge two bytes, and the second byte of corruption is
silently ignored.

This turned out not to impact the test, however. The idea
was to reduce the "size of this entry" part of the header so
that zlib runs out of input bytes while inflating the entry.
That header is two bytes long, and the test reduced the
value of both bytes; since we experience the problem if we
are off by even 1 byte, it is sufficient to munge only the
first one.

Even though the test would have worked with only a single
byte munged, and we could simply tweak the test to use a
single byte, it makes sense to lift this 1-byte restriction
from do_corrupt_object. It will allow future tests that do
need to change multiple bytes to do so.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-remote-mediawiki: remove hardcoded version number... Benoit Person Fri, 14 Jun 2013 10:19:11 +0000 (12:19 +0200)

git-remote-mediawiki: remove hardcoded version number in the test suite

Updates the code to make it more easy to switch mediawiki version when
testing. Before that, the version number was partly hardcoded, partly
in a var.

Signed-off-by: Benoit Person <benoit.person@ensimag.fr>
Signed-off-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/lib-httpd/apache.conf: configure an MPM module for... Jeff King Sun, 9 Jun 2013 08:09:32 +0000 (04:09 -0400)

t/lib-httpd/apache.conf: configure an MPM module for apache 2.4

Versions of Apache before 2.4 always had a "MultiProcessing
Module" (MPM) statically built in, which manages the worker
threads/processes. We do not care which one, as it is
largely a performance issue, and we put only a light load on
the server during our testing.

As of Apache 2.4, the MPM module is loadable just like any
other module, but exactly one such module must be loaded. On
a system where the MPMs are compiled dynamically (e.g.,
Debian unstable), this means that our test Apache server
will not start unless we provide the appropriate
configuration.

Unfortunately, we do not actually know which MPM modules are
available or appropriate for the system on which the tests
are running. This patch picks the "prefork" module, as it
is likely to be available on all Unix-like systems.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>