gitweb.git
Merge branch 'tb/blame-resurrect-convert-to-git'Junio C Hamano Mon, 11 May 2015 21:23:52 +0000 (14:23 -0700)

Merge branch 'tb/blame-resurrect-convert-to-git'

Some time ago, "git blame" (incorrectly) lost the convert_to_git()
call when synthesizing a fake "tip" commit that represents the
state in the working tree, which broke folks who record the history
with LF line ending to make their project portabile across
platforms while terminating lines in their working tree files with
CRLF for their platform.

* tb/blame-resurrect-convert-to-git:
blame: CRLF in the working tree and LF in the repo

Merge branch 'va/fix-git-p4-tests'Junio C Hamano Mon, 11 May 2015 21:23:51 +0000 (14:23 -0700)

Merge branch 'va/fix-git-p4-tests'

* va/fix-git-p4-tests:
git-p4: t9814: prevent --chain-lint failure

Merge branch 'ld/p4-case-fold'Junio C Hamano Mon, 11 May 2015 21:23:50 +0000 (14:23 -0700)

Merge branch 'ld/p4-case-fold'

* ld/p4-case-fold:
git-p4: add failing tests for case-folding p4d

Merge branch 'jk/rebase-quiet-noop'Junio C Hamano Mon, 11 May 2015 21:23:49 +0000 (14:23 -0700)

Merge branch 'jk/rebase-quiet-noop'

"git rebase --quiet" was not quite quiet when there is nothing to
do.

* jk/rebase-quiet-noop:
rebase: silence "git checkout" for noop rebase

Merge branch 'va/p4-client-path'Junio C Hamano Mon, 11 May 2015 21:23:48 +0000 (14:23 -0700)

Merge branch 'va/p4-client-path'

git p4 attempts to better handle branches in Perforce.

* va/p4-client-path:
git-p4: improve client path detection when branches are used
t9801: check git-p4's branch detection with client spec enabled

Merge branch 'mm/add-p-split-error'Junio C Hamano Mon, 11 May 2015 21:23:47 +0000 (14:23 -0700)

Merge branch 'mm/add-p-split-error'

When "add--interactive" splits a hunk into two overlapping hunks
and then let the user choose only one, it sometimes feeds an
incorrect patch text to "git apply". Add tests to demonstrate
this.

I have a slight suspicion that this may be $gmane/87202 coming back
and biting us (I seem to have said "let's run with this and see
what happens" back then).

* mm/add-p-split-error:
stash -p: demonstrate failure of split with mixed y/n
t3904-stash-patch: factor PERL prereq at the top of the file
t3904-stash-patch: fix test description
add -p: demonstrate failure when running 'edit' after a split
t3701-add-interactive: simplify code

Merge branch 'tb/t0027-crlf'Junio C Hamano Mon, 11 May 2015 21:23:47 +0000 (14:23 -0700)

Merge branch 'tb/t0027-crlf'

More line-ending tests.

* tb/t0027-crlf:
t0027: Add repoMIX and LF_nul
t0027: support NATIVE_CRLF platforms
t0027: cleanup: rename functions; avoid non-leading TABs

Merge branch 'ls/p4-changes-block-size'Junio C Hamano Mon, 11 May 2015 21:23:46 +0000 (14:23 -0700)

Merge branch 'ls/p4-changes-block-size'

"git p4" learned "--changes-block-size <n>" to read the changes in
chunks from Perforce, instead of making one call to "p4 changes"
that may trigger "too many rows scanned" error from Perforce.

* ls/p4-changes-block-size:
git-p4: use -m when running p4 changes

Merge branch 'jc/plug-fmt-merge-msg-leak'Junio C Hamano Mon, 11 May 2015 21:23:45 +0000 (14:23 -0700)

Merge branch 'jc/plug-fmt-merge-msg-leak'

* jc/plug-fmt-merge-msg-leak:
fmt-merge-msg: plug small leak of commit buffer

Merge branch 'nd/slim-index-pack-memory-usage'Junio C Hamano Mon, 11 May 2015 21:23:44 +0000 (14:23 -0700)

Merge branch 'nd/slim-index-pack-memory-usage'

Memory usage of "git index-pack" has been trimmed by tens of
per-cent.

* nd/slim-index-pack-memory-usage:
index-pack: kill union delta_base to save memory
index-pack: reduce object_entry size to save memory

Merge branch 'jk/still-interesting'Junio C Hamano Mon, 11 May 2015 21:23:43 +0000 (14:23 -0700)

Merge branch 'jk/still-interesting'

"git rev-list --objects $old --not --all" to see if everything that
is reachable from $old is already connected to the existing refs
was very inefficient.

* jk/still-interesting:
limit_list: avoid quadratic behavior from still_interesting

Merge branch 'jk/reading-packed-refs'Junio C Hamano Mon, 11 May 2015 21:23:42 +0000 (14:23 -0700)

Merge branch 'jk/reading-packed-refs'

An earlier rewrite to use strbuf_getwholeline() instead of fgets(3)
to read packed-refs file revealed that the former is unacceptably
inefficient.

* jk/reading-packed-refs:
t1430: add another refs-escape test
read_packed_refs: avoid double-checking sane refs
strbuf_getwholeline: use getdelim if it is available
strbuf_getwholeline: avoid calling strbuf_grow
strbuf_addch: avoid calling strbuf_grow
config: use getc_unlocked when reading from file
strbuf_getwholeline: use getc_unlocked
git-compat-util: add fallbacks for unlocked stdio
strbuf_getwholeline: use getc macro

Merge branch 'lm/squelch-bg-progress'Junio C Hamano Mon, 11 May 2015 21:23:42 +0000 (14:23 -0700)

Merge branch 'lm/squelch-bg-progress'

Many long-running operations show progress eye-candy, even when
they are later backgrounded. Hide the eye-candy when the process
is sent to the background instead.

* lm/squelch-bg-progress:
compat/mingw: stubs for getpgid() and tcgetpgrp()
progress: no progress in background

Merge branch 'jk/sha1-file-reduce-useless-warnings'Junio C Hamano Mon, 11 May 2015 21:23:40 +0000 (14:23 -0700)

Merge branch 'jk/sha1-file-reduce-useless-warnings'

* jk/sha1-file-reduce-useless-warnings:
sha1_file: squelch "packfile cannot be accessed" warnings

Merge branch 'nd/multiple-work-trees'Junio C Hamano Mon, 11 May 2015 21:23:39 +0000 (14:23 -0700)

Merge branch 'nd/multiple-work-trees'

A replacement for contrib/workdir/git-new-workdir that does not
rely on symbolic links and make sharing of objects and refs safer
by making the borrowee and borrowers aware of each other.

* nd/multiple-work-trees: (41 commits)
prune --worktrees: fix expire vs worktree existence condition
t1501: fix test with split index
t2026: fix broken &&-chain
t2026 needs procondition SANITY
git-checkout.txt: a note about multiple checkout support for submodules
checkout: add --ignore-other-wortrees
checkout: pass whole struct to parse_branchname_arg instead of individual flags
git-common-dir: make "modules/" per-working-directory directory
checkout: do not fail if target is an empty directory
t2025: add a test to make sure grafts is working from a linked checkout
checkout: don't require a work tree when checking out into a new one
git_path(): keep "info/sparse-checkout" per work-tree
count-objects: report unused files in $GIT_DIR/worktrees/...
gc: support prune --worktrees
gc: factor out gc.pruneexpire parsing code
gc: style change -- no SP before closing parenthesis
checkout: clean up half-prepared directories in --to mode
checkout: reject if the branch is already checked out elsewhere
prune: strategies for linked checkouts
checkout: support checking out into a new working directory
...

Merge branch 'pt/credential-xdg'Junio C Hamano Mon, 11 May 2015 21:23:38 +0000 (14:23 -0700)

Merge branch 'pt/credential-xdg'

Tweak the sample "store" backend of the credential helper to honor
XDG configuration file locations when specified.

* pt/credential-xdg:
t0302: "unreadable" test needs POSIXPERM
t0302: test credential-store support for XDG_CONFIG_HOME
git-credential-store: support XDG_CONFIG_HOME
git-credential-store: support multiple credential files

reflog_expire(): integrate lock_ref_sha1_basic() errors... Michael Haggerty Mon, 11 May 2015 15:25:20 +0000 (17:25 +0200)

reflog_expire(): integrate lock_ref_sha1_basic() errors into ours

Now that lock_ref_sha1_basic() gives us back its error messages via a
strbuf, incorporate its error message into our error message rather
than emitting two separate error messages.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

ref_transaction_commit(): delete extra "the" from error... Michael Haggerty Mon, 11 May 2015 15:25:19 +0000 (17:25 +0200)

ref_transaction_commit(): delete extra "the" from error message

While we are in the area, let's remove a superfluous definite article
from the error message that is emitted when the reference cannot be
locked. This improves how it reads and makes it a bit shorter.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

ref_transaction_commit(): provide better error messagesMichael Haggerty Mon, 11 May 2015 15:25:18 +0000 (17:25 +0200)

ref_transaction_commit(): provide better error messages

Now that lock_ref_sha1_basic() gives us back its error messages via a
strbuf, incorporate its error message into our error message rather
than emitting one error messages to stderr immediately and returning a
second to our caller.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

rename_ref(): integrate lock_ref_sha1_basic() errors... Michael Haggerty Mon, 11 May 2015 15:25:17 +0000 (17:25 +0200)

rename_ref(): integrate lock_ref_sha1_basic() errors into ours

Now that lock_ref_sha1_basic() gives us back its error messages via a
strbuf, incorporate its error message into our error message rather
than emitting two separate error messages.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

lock_ref_sha1_basic(): improve diagnostics for ref... Michael Haggerty Mon, 11 May 2015 15:25:16 +0000 (17:25 +0200)

lock_ref_sha1_basic(): improve diagnostics for ref D/F conflicts

If there is a failure to lock a reference that is likely caused by a
D/F conflict (e.g., trying to lock "refs/foo/bar" when reference
"refs/foo" already exists), invoke verify_refname_available() to try
to generate a more helpful error message.

That function might not detect an error. For example, some
non-reference file might be blocking the deletion of an
otherwise-empty directory tree, or there might be a race with another
process that just deleted the offending reference. In such cases,
generate the strerror-based error message like before.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

lock_ref_sha1_basic(): report errors via a "struct... Michael Haggerty Mon, 11 May 2015 15:25:15 +0000 (17:25 +0200)

lock_ref_sha1_basic(): report errors via a "struct strbuf *err"

For now, change the callers to spew the error to stderr like before.
But soon we will change them to incorporate the reason for the failure
into their own error messages.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

verify_refname_available(): report errors via a "struct... Michael Haggerty Mon, 11 May 2015 15:25:14 +0000 (17:25 +0200)

verify_refname_available(): report errors via a "struct strbuf *err"

It shouldn't be spewing errors directly to stderr.

For now, change its callers to spew the errors to stderr.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

verify_refname_available(): rename functionMichael Haggerty Mon, 11 May 2015 15:25:13 +0000 (17:25 +0200)

verify_refname_available(): rename function

Rename is_refname_available() to verify_refname_available() and change
its return value from 1 for success to 0 for success, to be consistent
with our error-handling convention. In a moment it will also get a
"struct strbuf *err" parameter.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

refs: check for D/F conflicts among refs created in... Michael Haggerty Mon, 11 May 2015 15:25:12 +0000 (17:25 +0200)

refs: check for D/F conflicts among refs created in a transaction

If two references that D/F conflict (e.g., "refs/foo" and
"refs/foo/bar") are created in a single transaction, the old code
discovered the problem only after the "commit" phase of
ref_transaction_commit() had already begun. This could leave some
references updated and others not, which violates the promise of
atomicity.

Instead, check for such conflicts during the "locking" phase:

* Teach is_refname_available() to take an "extras" parameter that can
contain extra reference names with which the specified refname must
not conflict.

* Change lock_ref_sha1_basic() to take an "extras" parameter, which it
passes through to is_refname_available().

* Change ref_transaction_commit() to pass "affected_refnames" to
lock_ref_sha1_basic() as its "extras" argument.

This change fixes a test case in t1404.

This code is a bit stricter than it needs to be. We could conceivably
allow reference "refs/foo/bar" to be created in the same transaction
as "refs/foo" is deleted (or vice versa). But that would be
complicated to implement, because it is not possible to lock
"refs/foo/bar" while "refs/foo" exists as a loose reference, but on
the other hand we don't want to delete some references before adding
others (because that could leave a gap during which required objects
are unreachable). There is also a complication that reflog files'
paths can conflict.

Any less-strict implementation would probably require tricks like the
packing of all references before the start of the real transaction, or
the use of temporary intermediate reference names.

So for now let's accept too-strict checks. Some reference update
transactions will be rejected unnecessarily, but they will be rejected
in their entirety rather than leaving the repository in an
intermediate state, as would happen now.

Please note that there is still one kind of D/F conflict that is *not*
handled correctly. If two processes are running at the same time, and
one tries to create "refs/foo" at the same time that the other tries
to create "refs/foo/bar", then they can race with each other. Both
processes can obtain their respective locks ("refs/foo.lock" and
"refs/foo/bar.lock"), proceed to the "commit" phase of
ref_transaction_commit(), and then the slower process will discover
that it cannot rename its lockfile into place (after possibly having
committed changes to other references). There appears to be no way to
fix this race without changing the locking policy, which in turn would
require a change to *all* Git clients.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

ref_transaction_commit(): use a string_list for detecti... Michael Haggerty Mon, 11 May 2015 15:25:11 +0000 (17:25 +0200)

ref_transaction_commit(): use a string_list for detecting duplicates

Detect duplicates by storing the reference names in a string_list and
sorting that, instead of sorting the ref_updates directly.

* In a moment the string_list will be used for another purpose, too.

* This removes the need for the custom comparison function
ref_update_compare().

* This means that we can carry out the updates in the order that the
user specified them instead of reordering them. This might be handy
someday if, we want to permit multiple updates to a single reference
as long as they are compatible with each other.

Note: we can't use string_list_remove_duplicates() to check for
duplicates, because we need to know the name of the reference that
appeared multiple times, to be used in the error message.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

is_refname_available(): use dirname in first loopMichael Haggerty Mon, 11 May 2015 15:25:10 +0000 (17:25 +0200)

is_refname_available(): use dirname in first loop

In the first loop (over prefixes of refname), use dirname to keep
track of the current prefix. This is not an improvement in itself, but
in a moment we will start using dirname for a role where a
NUL-terminated string is needed.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

struct nonmatching_ref_data: store a refname instead... Michael Haggerty Mon, 11 May 2015 15:25:09 +0000 (17:25 +0200)

struct nonmatching_ref_data: store a refname instead of a ref_entry

Now that we don't need a ref_entry to pass to
report_refname_conflict(), it is sufficient to store the refname of
the conflicting reference.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

report_refname_conflict(): inline functionMichael Haggerty Mon, 11 May 2015 15:25:08 +0000 (17:25 +0200)

report_refname_conflict(): inline function

It wasn't pulling its weight. And we are about to need code similar to
this where no ref_entry is available and with more diverse error
messages. Rather than try to generalize the function, just inline it.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

entry_matches(): inline functionMichael Haggerty Mon, 11 May 2015 15:25:07 +0000 (17:25 +0200)

entry_matches(): inline function

It wasn't pulling its weight. And in a moment we will need similar
tests that take a refname rather than a ref_entry as parameter, which
would have made entry_matches() even less useful.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

is_refname_available(): convert local variable "dirname... Michael Haggerty Mon, 11 May 2015 15:25:06 +0000 (17:25 +0200)

is_refname_available(): convert local variable "dirname" to strbuf

This change wouldn't be worth it by itself, but in a moment we will
use the strbuf for more string juggling.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

is_refname_available(): avoid shadowing "dir" variableMichael Haggerty Mon, 11 May 2015 15:25:05 +0000 (17:25 +0200)

is_refname_available(): avoid shadowing "dir" variable

The function had a "dir" parameter that was shadowed by a local "dir"
variable within a code block. Use the former in place of the latter.
(This is consistent with "dir"'s use elsewhere in the function.)

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

is_refname_available(): revamp the commentsMichael Haggerty Mon, 11 May 2015 15:25:04 +0000 (17:25 +0200)

is_refname_available(): revamp the comments

Change the comments to a running example of running the function with
refname set to "refs/foo/bar". Add some more explanation of the logic.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

t1404: new tests of ref D/F conflicts within transactionsMichael Haggerty Mon, 11 May 2015 15:25:03 +0000 (17:25 +0200)

t1404: new tests of ref D/F conflicts within transactions

Add some tests of reference D/F conflicts (by which I mean the fact
that references like "refs/foo" and "refs/foo/bar" are not allowed to
coexist) in the context of reference transactions.

The test of creating two conflicting references in the same
transaction fails, leaving the transaction half-completed. This will
be fixed later in this patch series.

Please note that the error messages emitted in the case of conflicts
are not very user-friendly. In particular, when the conflicts involve
loose references, then the errors are reported as

error: there are still refs under 'refs/foo'
fatal: Cannot lock the ref 'refs/foo'.

or

error: unable to resolve reference refs/foo/bar: Not a directory
fatal: Cannot lock the ref 'refs/foo/bar'.

This is because lock_ref_sha1_basic() fails while trying to lock the
new reference, before it even gets to the is_refname_available()
check. This situation will also be improved later in this patch
series.

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>

refs.c: remove lock_fd from struct ref_lockStefan Beller Thu, 16 Apr 2015 23:17:37 +0000 (16:17 -0700)

refs.c: remove lock_fd from struct ref_lock

The 'lock_fd' is the same as 'lk->fd'. No need to store it twice so remove
it.

No functional changes intended.

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

update-ref: test handling large transactions properlyStefan Beller Sun, 10 May 2015 02:45:30 +0000 (04:45 +0200)

update-ref: test handling large transactions properly

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

command-list.txt: fix whitespace inconsistencySébastien Guimmara Fri, 8 May 2015 19:29:35 +0000 (21:29 +0200)

command-list.txt: fix whitespace inconsistency

The overwhelming majority of lines were single space aligned,
except a few ones aligned by tabs. Fix inconsistency by using
single space everywhere.

Signed-off-by: Sébastien Guimmara <sebastien.guimmara@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/subtree: portability fix for string printingDanny Lin Fri, 8 May 2015 00:56:59 +0000 (08:56 +0800)

contrib/subtree: portability fix for string printing

'echo -n' is not portable, but this script used it as a way to give
a string followed by a carriage return for progress messages.
Introduce a new helper shell function "progress" and use printf as a
more portable way to do this. As a side effect, this makes it
unnecessary to have a raw CR in our source, which can be munged in
some shells. For example, MsysGit trims CR before executing a shell
script file in order to make it work right on Windows even if it
uses CRLF as linefeeds.

While at it, replace "echo" using printf in debug() and say() to
eliminate the temptation of reintroducing the same bug.

Signed-off-by: Danny Lin <danny0838@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http: add support for specifying an SSL cipher listLars Kellogg-Stedman Fri, 8 May 2015 13:22:15 +0000 (09:22 -0400)

http: add support for specifying an SSL cipher list

Teach git about a new option, "http.sslCipherList", which permits one to
specify a list of ciphers to use when negotiating SSL connections. The
setting can be overwridden by the GIT_SSL_CIPHER_LIST environment
variable.

Signed-off-by: Lars Kellogg-Stedman <lars@redhat.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bundle: verify arguments more strictlyPatrick Steinhardt Fri, 8 May 2015 08:02:00 +0000 (10:02 +0200)

bundle: verify arguments more strictly

The `verify` and `create` subcommands of the bundle builtin do
not properly verify the command line arguments that have been
passed in. While the `verify` subcommand accepts an arbitrary
amount of ignored arguments the `create` subcommand does not
complain about being passed too few arguments, resulting in a
bogus call to `git rev-list`. Fix these errors by verifying that
the correct amount of arguments has been passed in.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

contrib/subtree: there's no push --squashDanny Lin Thu, 7 May 2015 07:52:33 +0000 (15:52 +0800)

contrib/subtree: there's no push --squash

The documentation says that --squash is for 'add', 'merge',
'pull' and 'push', while --squash actually doesn't change
the behavior of 'push'. Correct the documentation.

Signed-off-by: Danny Lin <danny0838@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tests: skip dav http-push tests under NO_EXPAT=NoThanksJunio C Hamano Thu, 7 May 2015 16:06:14 +0000 (09:06 -0700)

tests: skip dav http-push tests under NO_EXPAT=NoThanks

When built with NO_EXPAT=NoThanks, we will not have a working http-push
over webdav.

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

t/lib-httpd.sh: skip tests if NO_CURL is definedJeff King Wed, 6 May 2015 17:42:29 +0000 (13:42 -0400)

t/lib-httpd.sh: skip tests if NO_CURL is defined

If we built git without curl, we can't actually test against
an http server. In fact, all of the test scripts which
include lib-httpd.sh already perform this check, with one
exception: t5540. For those scripts, this is a noop, and for
t5540, this is a bugfix (it used to fail when built with
NO_CURL, though it could go unnoticed if you had a stale
git-remote-https in your build directory).

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

completion: remove credential helpers from porcelain... SZEDER Gábor Tue, 5 May 2015 16:33:13 +0000 (18:33 +0200)

completion: remove credential helpers from porcelain commands

Don't offer the "main" 'git credential' command or any of the credential
helpers from contrib/credential/ when completing git commands.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t1006: add tests for git cat-file --allow-unknown-typeKarthik Nayak Sun, 3 May 2015 14:30:02 +0000 (20:00 +0530)

t1006: add tests for git cat-file --allow-unknown-type

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cat-file: teach cat-file a '--allow-unknown-type' optionKarthik Nayak Sun, 3 May 2015 14:30:01 +0000 (20:00 +0530)

cat-file: teach cat-file a '--allow-unknown-type' option

'git cat-file' throws an error while trying to print the type or
size of a broken/corrupt object. This is because these objects are
usually of unknown types.

Teach git cat-file a '--allow-unknown-type' option where it prints
the type or size of a broken/corrupt object without throwing
an error.

Modify '-t' and '-s' options to call sha1_object_info_extended()
directly to support the '--allow-unknown-type' option.

Add documentation for 'cat-file --allow-unknown-type'.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
cat-file: add documentation for '--allow-unknown-type' option.

Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

cat-file: make the options mutually exclusiveKarthik Nayak Sun, 3 May 2015 14:30:00 +0000 (20:00 +0530)

cat-file: make the options mutually exclusive

We only parse the options if 2 or 3 arguments are specified.
Update 'struct option options[]' to use OPT_CMDMODE rather than
OPT_SET_INT to allow only one mutually exclusive option and avoid the
need for checking number of arguments. This was written by Junio C Hamano,
tested by me.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1_file: support reading from a loose object of unkno... Karthik Nayak Sun, 3 May 2015 14:29:59 +0000 (19:59 +0530)

sha1_file: support reading from a loose object of unknown type

Update sha1_loose_object_info() to optionally allow it to read
from a loose object file of unknown/bogus type; as the function
usually returns the type of the object it read in the form of enum
for known types, add an optional "typename" field to receive the
name of the type in textual form and a flag to indicate the reading
of a loose object file of unknown/bogus type.

Add parse_sha1_header_extended() which acts as a wrapper around
parse_sha1_header() allowing more information to be obtained.

Add unpack_sha1_header_to_strbuf() to unpack sha1 headers of
unknown/corrupt objects which have a unknown sha1 header size to
a strbuf structure. This was written by Junio C Hamano but tested
by me.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
Hepled-by: Jeff King <peff@peff.net>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch: do not call a "remote-tracking branch" a "remot... Danny Lin Wed, 6 May 2015 19:01:55 +0000 (03:01 +0800)

branch: do not call a "remote-tracking branch" a "remote branch"

"git branch -r -d" mentions "delete remote branch", which should be
"remote-tracking branch".

Signed-off-by: Danny Lin <danny0838@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

path.c: remove home_config_paths()Paul Tan Wed, 6 May 2015 08:01:04 +0000 (16:01 +0800)

path.c: remove home_config_paths()

home_config_paths() combines distinct functionality already implemented
by expand_user_path() and xdg_config_home(), and it also hard-codes the
path ~/.gitconfig, which makes it unsuitable to use for other home
config file paths. Since its use will just add unnecessary complexity to
the code, remove it.

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-config: replace use of home_config_paths()Paul Tan Wed, 6 May 2015 08:01:03 +0000 (16:01 +0800)

git-config: replace use of home_config_paths()

Since home_config_paths() combines distinct functionality already
implemented by expand_user_path() and xdg_config_home(), and hides the
home config file path ~/.gitconfig. Make the code more explicit by
replacing the use of home_config_paths() with expand_user_path() and
xdg_config_home().

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-commit: replace use of home_config_paths()Paul Tan Wed, 6 May 2015 08:01:02 +0000 (16:01 +0800)

git-commit: replace use of home_config_paths()

Since home_config_paths() combines two distinct functionality already
implemented by expand_user_path() and xdg_config_home(), and hides the
home config file path ~/.gitconfig. Make the code more explicit by
replacing the use of home_config_paths() with expand_user_path() and
xdg_config_home().

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

credential-store.c: replace home_config_paths() with... Paul Tan Wed, 6 May 2015 08:01:01 +0000 (16:01 +0800)

credential-store.c: replace home_config_paths() with xdg_config_home()

Since only the xdg credentials file path is required, and
home_config_paths() is unable to construct the path ~/.git-credentials,
simplify the code by replacing home_config_paths() with
xdg_config_home().

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

dir.c: replace home_config_paths() with xdg_config_home()Paul Tan Wed, 6 May 2015 08:01:00 +0000 (16:01 +0800)

dir.c: replace home_config_paths() with xdg_config_home()

Since only the xdg excludes file path is required, simplify the code by
replacing use of home_config_paths() with xdg_config_home().

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

attr.c: replace home_config_paths() with xdg_config_home()Paul Tan Wed, 6 May 2015 08:00:59 +0000 (16:00 +0800)

attr.c: replace home_config_paths() with xdg_config_home()

Since only the xdg attributes file path is required, simplify the code
by using xdg_config_home() instead of home_config_paths().

Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

path.c: implement xdg_config_home()Paul Tan Tue, 21 Apr 2015 04:06:27 +0000 (12:06 +0800)

path.c: implement xdg_config_home()

The XDG base dir spec[1] specifies that configuration files be stored in
a subdirectory in $XDG_CONFIG_HOME. To construct such a configuration
file path, home_config_paths() can be used. However, home_config_paths()
combines distinct functionality:

1. Retrieve the home git config file path ~/.gitconfig

2. Construct the XDG config path of the file specified by `file`.

This function was introduced in commit 21cf3227 ("read (but not write)
from $XDG_CONFIG_HOME/git/config file"). While the intention of the
function was to allow the home directory configuration file path and the
xdg directory configuration file path to be retrieved with one function
call, the hard-coding of the path ~/.gitconfig prevents it from being
used for other configuration files. Furthermore, retrieving a file path
relative to the user's home directory can be done with
expand_user_path(). Hence, it can be seen that home_config_paths()
introduces unnecessary complexity, especially if a user just wants to
retrieve the xdg config file path.

As such, implement a simpler function xdg_config_home() for constructing
the XDG base dir spec configuration file path. This function, together
with expand_user_path(), can replace all uses of home_config_paths().

[1] http://standards.freedesktop.org/basedir-spec/basedir-spec-0.7.html

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

First batch for 2.5 cycleJunio C Hamano Wed, 6 May 2015 04:13:30 +0000 (21:13 -0700)

First batch for 2.5 cycle

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

Merge branch 'jk/prune-mtime'Junio C Hamano Wed, 6 May 2015 04:00:37 +0000 (21:00 -0700)

Merge branch 'jk/prune-mtime'

Access to objects in repositories that borrow from another one on a
slow NFS server unnecessarily got more expensive due to recent code
becoming more cautious in a naive way not to lose objects to pruning.

* jk/prune-mtime:
sha1_file: only freshen packs once per run
sha1_file: freshen pack objects before loose
reachable: only mark local objects as recent

Merge branch 'mm/usage-log-l-can-take-regex'Junio C Hamano Wed, 6 May 2015 04:00:36 +0000 (21:00 -0700)

Merge branch 'mm/usage-log-l-can-take-regex'

Documentation fix.

* mm/usage-log-l-can-take-regex:
log -L: improve error message on malformed argument
Documentation: change -L:<regex> to -L:<funcname>

Merge branch 'ep/fix-test-lib-functions-report'Junio C Hamano Wed, 6 May 2015 04:00:35 +0000 (21:00 -0700)

Merge branch 'ep/fix-test-lib-functions-report'

* ep/fix-test-lib-functions-report:
test-lib-functions.sh: fix the second argument to some helper functions

Merge branch 'cn/bom-in-gitignore'Junio C Hamano Wed, 6 May 2015 04:00:34 +0000 (21:00 -0700)

Merge branch 'cn/bom-in-gitignore'

Teach the codepaths that read .gitignore and .gitattributes files
that these files encoded in UTF-8 may have UTF-8 BOM marker at the
beginning; this makes it in line with what we do for configuration
files already.

* cn/bom-in-gitignore:
attr: skip UTF8 BOM at the beginning of the input file
config: use utf8_bom[] from utf.[ch] in git_parse_source()
utf8-bom: introduce skip_utf8_bom() helper
add_excludes_from_file: clarify the bom skipping logic
dir: allow a BOM at the beginning of exclude files

Merge branch 'jc/epochtime-wo-tz'Junio C Hamano Wed, 6 May 2015 04:00:33 +0000 (21:00 -0700)

Merge branch 'jc/epochtime-wo-tz'

"git commit --date=now" or anything that relies on approxidate lost
the daylight-saving-time offset.

* jc/epochtime-wo-tz:
parse_date_basic(): let the system handle DST conversion
parse_date_basic(): return early when given a bogus timestamp

Merge branch 'nd/t1509-chroot-test'Junio C Hamano Wed, 6 May 2015 04:00:31 +0000 (21:00 -0700)

Merge branch 'nd/t1509-chroot-test'

Correct test bitrot.

* nd/t1509-chroot-test:
t1509: update prepare script to be able to run t1509 in chroot again

Merge branch 'oh/fix-config-default-user-name-section'Junio C Hamano Wed, 6 May 2015 04:00:30 +0000 (21:00 -0700)

Merge branch 'oh/fix-config-default-user-name-section'

The default $HOME/.gitconfig file created upon "git config --global"
that edits it had incorrectly spelled user.name and user.email
entries in it.

* oh/fix-config-default-user-name-section:
config: fix settings in default_user_config template

Merge branch 'jk/type-from-string-gently'Junio C Hamano Wed, 6 May 2015 04:00:29 +0000 (21:00 -0700)

Merge branch 'jk/type-from-string-gently'

"git cat-file bl $blob" failed to barf even though there is no
object type that is "bl".

* jk/type-from-string-gently:
type_from_string_gently: make sure length matches

Merge branch 'sb/test-bitmap-free-at-end'Junio C Hamano Wed, 6 May 2015 04:00:28 +0000 (21:00 -0700)

Merge branch 'sb/test-bitmap-free-at-end'

* sb/test-bitmap-free-at-end:
pack-bitmap.c: fix a memleak

Merge branch 'ld/p4-filetype-detection'Junio C Hamano Wed, 6 May 2015 04:00:27 +0000 (21:00 -0700)

Merge branch 'ld/p4-filetype-detection'

* ld/p4-filetype-detection:
git-p4: fix filetype detection on files opened exclusively
git-p4: small fix for locked-file-move-test
git-p4: fix small bug in locked test scripts

Merge branch 'ts/checkout-advice-plural'Junio C Hamano Wed, 6 May 2015 04:00:27 +0000 (21:00 -0700)

Merge branch 'ts/checkout-advice-plural'

* ts/checkout-advice-plural:
checkout: call a single commit "it" intead of "them"

Merge branch 'jk/init-core-worktree-at-root'Junio C Hamano Wed, 6 May 2015 04:00:26 +0000 (21:00 -0700)

Merge branch 'jk/init-core-worktree-at-root'

We avoid setting core.worktree when the repository location is the
".git" directory directly at the top level of the working tree, but
the code misdetected the case in which the working tree is at the
root level of the filesystem (which arguably is a silly thing to
do, but still valid).

* jk/init-core-worktree-at-root:
init: don't set core.worktree when initializing /.git

Merge branch 'mh/show-branch-topic'Junio C Hamano Wed, 6 May 2015 04:00:25 +0000 (21:00 -0700)

Merge branch 'mh/show-branch-topic'

"git show-branch --topics HEAD" (with no other arguments) did not
do anything interesting. Instead, contrast the given revision
against all the local branches by default.

* mh/show-branch-topic:
show-branch: show all local heads when only giving one rev along --topics

Merge branch 'sb/line-log-plug-pairdiff-leak'Junio C Hamano Wed, 6 May 2015 04:00:25 +0000 (21:00 -0700)

Merge branch 'sb/line-log-plug-pairdiff-leak'

* sb/line-log-plug-pairdiff-leak:
line-log.c: fix a memleak

Merge branch 'jc/diff-no-index-d-f'Junio C Hamano Wed, 6 May 2015 04:00:24 +0000 (21:00 -0700)

Merge branch 'jc/diff-no-index-d-f'

The usual "git diff" when seeing a file turning into a directory
showed a patchset to remove the file and create all files in the
directory, but "git diff --no-index" simply refused to work. Also,
when asked to compare a file and a directory, imitate POSIX "diff"
and compare the file with the file with the same name in the
directory, instead of refusing to run.

* jc/diff-no-index-d-f:
diff-no-index: align D/F handling with that of normal Git
diff-no-index: DWIM "diff D F" into "diff D/F F"

Merge branch 'bc/object-id'Junio C Hamano Wed, 6 May 2015 04:00:23 +0000 (21:00 -0700)

Merge branch 'bc/object-id'

Identify parts of the code that knows that we use SHA-1 hash to
name our objects too much, and use (1) symbolic constants instead
of hardcoded 20 as byte count and/or (2) use struct object_id
instead of unsigned char [20] for object names.

* bc/object-id:
apply: convert threeway_stage to object_id
patch-id: convert to use struct object_id
commit: convert parts to struct object_id
diff: convert struct combine_diff_path to object_id
bulk-checkin.c: convert to use struct object_id
zip: use GIT_SHA1_HEXSZ for trailers
archive.c: convert to use struct object_id
bisect.c: convert leaf functions to use struct object_id
define utility functions for object IDs
define a structure for object IDs

git-compat-util.h: implement a different ARRAY_SIZE... Elia Pinto Thu, 30 Apr 2015 12:44:14 +0000 (14:44 +0200)

git-compat-util.h: implement a different ARRAY_SIZE macro for for safely deriving the size of array

To get number of elements in an array git use the ARRAY_SIZE macro
defined as:

#define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))

The problem with it is a possibility of mistakenly passing to it a
pointer instead an array. The ARRAY_SIZE macro as conventionally
defined does not provide good type-safety and the open-coded
approach is more fragile, more verbose and provides no improvement in
type-safety.

Use instead a different but compatible ARRAY_SIZE() macro,
which will also break compile if you try to
use it on a pointer. This implemention revert to the original code
if the compiler doesn't know the typeof and __builtin_types_compatible_p
GCC extensions.

This can ensure our code is robust to changes, without
needing a gratuitous macro or constant. A similar
ARRAY_SIZE implementation also exists in the linux kernel.

Credits to Rusty Russell and his ccan library.

Signed-off-by: Elia Pinto <gitter.spiros@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

daemon: unbreak NO_IPV6 build regressionJunio C Hamano Tue, 5 May 2015 18:03:24 +0000 (11:03 -0700)

daemon: unbreak NO_IPV6 build regression

When 01cec54e (daemon: deglobalize hostname information, 2015-03-07)
wrapped the global variables such as hostname inside a struct, it
forgot to convert one location that spelled "hostname" that needs to
be updated to "hi->hostname".

This was inside NO_IPV6 block, and was not caught by anybody.

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

prefix_path(): unconditionally free results in the... Stefan Beller Mon, 4 May 2015 19:11:54 +0000 (12:11 -0700)

prefix_path(): unconditionally free results in the callers

As of d089ebaa (setup: sanitize absolute and funny paths in
get_pathspec(), 2008-01-28), prefix_path() always returns a
newly allocated string, so callers should free its result.

Additionally, drop the const from variables to which the result of
the prefix_path() is assigned, so they can be free()'d without
having to cast-away the constness.

Signed-off-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

write_sha1_file(): do not use a separate sha1[] arrayJunio C Hamano Mon, 4 May 2015 18:08:10 +0000 (11:08 -0700)

write_sha1_file(): do not use a separate sha1[] array

In the beginning, write_sha1_file() did not have a way to tell the
caller the name of the object it wrote to the caller. This was
changed in d6d3f9d0 (This implements the new "recursive tree"
write-tree., 2005-04-09) by adding the "returnsha1" parameter to the
function so that the callers who are interested in the value can
optionally pass a pointer to receive it.

It turns out that all callers do want to know the name of the object
it just has written. Nobody passes a NULL to this parameter, hence
it is not necessary to use a separate sha1[] array to receive the
result from write_sha1_file_prepare(), and copy the result to the
returnsha1 supplied by the caller.

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

t1007: add hash-object --literally testsEric Sunshine Mon, 4 May 2015 07:25:14 +0000 (03:25 -0400)

t1007: add hash-object --literally tests

git-hash-object learned a --literally option in 5ba9a93
(hash-object: add --literally option, 2014-09-11). Check that
--literally allows object creation with a bogus type, with two
type strings whose length is reasonably short and very long.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

hash-object --literally: fix buffer overrun with extra... Eric Sunshine Mon, 4 May 2015 07:25:15 +0000 (03:25 -0400)

hash-object --literally: fix buffer overrun with extra-long object type

"hash-object" learned in 5ba9a93 (hash-object: add --literally
option, 2014-09-11) to allow crafting a corrupt/broken object of
unknown type.

When the user-provided type is particularly long, however, it can
overflow the relatively small stack-based character array handed to
write_sha1_file_prepare() by hash_sha1_file() and write_sha1_file(),
leading to stack corruption (and crash). Introduce a custom helper
to allow arbitrarily long typenames just for "hash-object --literally".

[jc: Eric's original used a strbuf in the more common codepaths, and
I rewrote it to avoid penalizing the non-literally code. Bugs are mine]

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

config: use error() instead of fprintf(stderr, ...)Jonathan Nieder Mon, 4 May 2015 21:18:39 +0000 (14:18 -0700)

config: use error() instead of fprintf(stderr, ...)

The die() / error() / warning() helpers put a fatal: / error: /
warning: prefix in front of the error message they print describing
the message's severity, which users are likely to be accustomed to
seeing these days.

This change will also be useful when marking the message for
translation: the argument to error() includes no newline at the end,
so it is less fussy for translators to translate without lines running
together in the translated output.

While we're here, start the error messages with a lowercase letter to
match the usual typography of error messages.

A quick web search and a code search at codesearch.debian.net finds no
scripts trying to parse these error messages, so this change should be
safe.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-hash-object.txt: document --literally optionEric Sunshine Mon, 4 May 2015 07:25:13 +0000 (03:25 -0400)

git-hash-object.txt: document --literally option

Document the git-hash-object --literally option added by 5ba9a93
(hash-object: add --literally option, 2014-09-11).

While here, also correct a minor typesetting oversight.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

blame, log: format usage strings similarly to those... Alex Henrie Thu, 2 Apr 2015 21:26:56 +0000 (15:26 -0600)

blame, log: format usage strings similarly to those in documentation

Earlier, 9c9b4f2f (standardize usage info string format, 2015-01-13)
tried to make usage-string in line with the documentation by

- Placing angle brackets around fill-in-the-blank parameters
- Putting dashes in multiword parameter names
- Adding spaces to [-f|--foobar] to make [-f | --foobar]
- Replacing <foobar>* with [<foobar>...]

but it missed a few places.

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: fix and update 'git log --decorate=' optionsSZEDER Gábor Fri, 1 May 2015 17:21:00 +0000 (19:21 +0200)

completion: fix and update 'git log --decorate=' options

'git log --decorate=' understands the 'full', 'short' and 'no' options.
From these the completion script only offered 'short' and it offered
'long' instead of 'full'.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

completion: remove redundant __git_compute_all_commands... SZEDER Gábor Fri, 1 May 2015 15:48:56 +0000 (17:48 +0200)

completion: remove redundant __git_compute_all_commands() call

During lazy-initialization of the lists of all commands and porcelain
commands the function __git_compute_all_commands() is called twice. The
relevant part of the call sequence looks like this:

__git_compute_porcelain_commands()
__git_compute_all_commands()
<finds list of all commands uninitialized>
__git_list_all_commands()
<initializes list of all commands>
__git_list_porcelain_commands()
__git_compute_all_commands()
<finds list of all commands already initialized, does nothing>
<filters porcelains from list of all commands>

Either one of the two calls could be removed and the initialization of
both command lists would still work as a whole, but let's remove the call
from __git_compute_porcelain_commands(), because this way
__git_list_porcelain_commands() will keep working in itself.

Signed-off-by: SZEDER Gábor <szeder@ira.uka.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote.c: drop default_remote_name variableJeff King Fri, 1 May 2015 22:44:41 +0000 (18:44 -0400)

remote.c: drop default_remote_name variable

When we read the remote config from disk, we update a
default_remote_name variable if we see branch.*.remote
config for the current branch. This isn't wrong, or even all
that complicated, but it is a bit simpler (because it
reduces our overall state) to just lazily compute the
default when we need it.

The ulterior motive here is that the push config uses a
similar structure, and _is_ much more complicated as a
result. That will be simplified in a future patch, and it's
more readable if the logic for remotes and push-remotes
matches.

Note that we also used default_remote_name as a signal that
the remote config has been loaded; after this patch, we now
use an explicit flag.

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

pathspec: avoid the need of "--" when wildcard is usedDuy Nguyen Sat, 2 May 2015 02:04:32 +0000 (09:04 +0700)

pathspec: avoid the need of "--" when wildcard is used

When "--" is lacking from the command line and a command can take
both revs and paths, the idea is if an argument can be seen as both
an extended SHA-1 and a path, then "--" is required or git refuses
to continue. It's currently implemented as:

(1) if an argument is rev, then it must not exist in worktree

(2) else, it must exist in worktree

(3) else, "--" is required.

These rules work for literal paths, but when non-literal pathspec is
involved, it almost always requires the user to add "--" because it
fails (2) and (1) is really rarely met (take "*.c" for example, (1)
is met if there is a ref named "*.c").

This patch modifies the rules a bit by considering any valid (*)
wildcard pathspec "exist in worktree". The rules become:

(1) if an arg is a rev, then it must either exist in worktree or
not be a valid wildcard pathspec.

(2) else, it either exists in worktree or is a wildcard pathspec

(3) else, "--" is required.

With the new rules, "--" is not needed most of the time when
wildcard pathspec is involved.

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

blame: CRLF in the working tree and LF in the repoTorsten Bögershausen Sun, 3 May 2015 16:38:01 +0000 (18:38 +0200)

blame: CRLF in the working tree and LF in the repo

A typical setup under Windows is to set core.eol to CRLF, and text
files are marked as "text" in .gitattributes, or core.autocrlf is
set to true.

After 4d4813a5 "git blame" no longer works as expected for such a
set-up. Every line is annotated as "Not Committed Yet", even though
the working directory is clean. This is because the commit removed
the conversion in blame.c for all files, with or without CRLF in the
repo.

Having files with CRLF in the repo and core.autocrlf=input is a
temporary situation, and the files, if committed as is, will be
normalized in the repo, which _will_ be a notable change. Blaming
them with "Not Committed Yet" is the right result. Revert commit
4d4813a5 which was a misguided attempt to "solve" a non-problem.

Add two test cases in t8003 to verify the correct CRLF conversion.

Suggested-By: Stepan Kasal <kasal@ucw.cz>
Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.4 v2.4.0Junio C Hamano Thu, 30 Apr 2015 18:25:06 +0000 (11:25 -0700)

Git 2.4

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

merge: deprecate 'git merge <message> HEAD <commit... Junio C Hamano Thu, 26 Mar 2015 04:58:45 +0000 (21:58 -0700)

merge: deprecate 'git merge <message> HEAD <commit>' syntax

We had this in "git merge" manual for eternity:

'git merge' <msg> HEAD <commit>...

[This] syntax (<msg> `HEAD` <commit>...) is supported for
historical reasons. Do not use it from the command line or in
new scripts. It is the same as `git merge -m <msg> <commit>...`.

With the update to "git merge" to make it understand what is
recorded in FETCH_HEAD directly, including Octopus merge cases, we
now can rewrite the use of this syntax in "git pull" with a simple
"git merge FETCH_HEAD".

Also there are quite a few fallouts in the test scripts, and it
turns out that "git cvsimport" also uses this old syntax to record
a merge.

Judging from this result, I would not be surprised if dropping the
support of the old syntax broke scripts people have written and been
relying on for the past ten years. But at least we can start the
deprecation process by throwing a warning message when the syntax is
used.

With luck, we might be able to drop the support in a few years.

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

merge: handle FETCH_HEAD internallyJunio C Hamano Sun, 26 Apr 2015 01:47:21 +0000 (18:47 -0700)

merge: handle FETCH_HEAD internally

The collect_parents() function now is responsible for

1. parsing the commits given on the command line into a list of
commits to be merged;

2. filtering these parents into independent ones; and

3. optionally calling fmt_merge_msg() via prepare_merge_message()
to prepare an auto-generated merge log message, using fake
contents that FETCH_HEAD would have had if these commits were
fetched from the current repository with "git pull . $args..."

Make "git merge FETCH_HEAD" to be the same as the traditional

git merge "$(git fmt-merge-msg <.git/FETCH_HEAD)" $commits

invocation of the command in "git pull", where $commits are the ones
that appear in FETCH_HEAD that are not marked as not-for-merge, by
making it do a bit more, specifically:

- noticing "FETCH_HEAD" is the only "commit" on the command line
and picking the commits that are not marked as not-for-merge as
the list of commits to be merged (substitute for step #1 above);

- letting the resulting list fed to step #2 above;

- doing the step #3 above, using the contents of the FETCH_HEAD
instead of fake contents crafted from the list of commits parsed
in the step #1 above.

Note that this changes the semantics. "git merge FETCH_HEAD" has
always behaved as if the first commit in the FETCH_HEAD file were
directly specified on the command line, creating a two-way merge
whose auto-generated merge log said "merge commit xyz". With this
change, if the previous fetch was to grab multiple branches (e.g.
"git fetch $there topic-a topic-b"), the new world order is to
create an octopus, behaving as if "git pull $there topic-a topic-b"
were run. This is a deliberate change to make that happen, and
can be seen in the changes to t3033 tests.

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

merge: decide if we auto-generate the message early... Junio C Hamano Sun, 26 Apr 2015 01:39:43 +0000 (18:39 -0700)

merge: decide if we auto-generate the message early in collect_parents()

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

merge: make collect_parents() auto-generate the merge... Junio C Hamano Sun, 26 Apr 2015 01:34:22 +0000 (18:34 -0700)

merge: make collect_parents() auto-generate the merge message

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

merge: extract prepare_merge_message() logic outJunio C Hamano Sun, 26 Apr 2015 01:29:44 +0000 (18:29 -0700)

merge: extract prepare_merge_message() logic out

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

merge: narrow scope of merge_namesJunio C Hamano Sat, 25 Apr 2015 19:31:57 +0000 (12:31 -0700)

merge: narrow scope of merge_names

In order to pass the list of parents to fmt_merge_msg(), cmd_merge()
uses this strbuf to create something that look like FETCH_HEAD that
describes commits that are being merged. This is necessary only
when we are creating the merge commit message ourselves, but was
done unconditionally.

Move the variable and the logic to populate it to confine them in a
block that needs them.

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

merge: split reduce_parents() out of collect_parents()Junio C Hamano Sat, 25 Apr 2015 19:00:14 +0000 (12:00 -0700)

merge: split reduce_parents() out of collect_parents()

The latter does two separate things:

- Parse the list of commits on the command line, and formulate the
list of commits to be merged (including the current HEAD);

- Compute the list of parents to be recorded in the resulting merge
commit.

Split the latter into a separate helper function, so that we can
later supply the list commits to be merged from a different source
(namely, FETCH_HEAD).

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

merge: clarify collect_parents() logicJunio C Hamano Sat, 25 Apr 2015 17:25:43 +0000 (10:25 -0700)

merge: clarify collect_parents() logic

Clarify this small function in three ways.

- The function initially collects all commits to be merged into a
commit_list "remoteheads"; the "remotes" pointer always points at
the tail of this list (either the remoteheads variable itself, or
the ->next slot of the element at the end of the list) to help
elongate the list by repeated calls to commit_list_insert().
Because the new element appended by commit_list_insert() will
always have its ->next slot NULLed out, there is no need for us
to assign NULL to *remotes to terminate the list at the end.

- The variable "head_subsumed" always confused me every time I read
this code. What is happening here is that we inspect what the
caller told us to merge (including the current HEAD) and come up
with the list of parents to be recorded for the resulting merge
commit, omitting commits that are ancestor of other commits.
This filtering may remove the current HEAD from the resulting
parent list---and we signal that fact with this variable, so that
we can later record it as the first parent when "--no-ff" is in
effect.

- The "parents" list is created for this function by reduce_heads()
and was not deallocated after its use, even though the loop
control was written in such a way to allow us to do so by taking
the "next" element in a separate variable so that it can be used
in the next-step part of the loop control.

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

merge: small leakfix and code simplificationJunio C Hamano Thu, 23 Apr 2015 21:37:13 +0000 (14:37 -0700)

merge: small leakfix and code simplification

When parsing a merged object name like "foo~20" to formulate a merge
summary "Merge branch foo (early part)", a temporary strbuf is used,
but we forgot to deallocate it when we failed to find the named
branch.

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

merge: do not check argc to determine number of remote... Junio C Hamano Thu, 23 Apr 2015 20:56:34 +0000 (13:56 -0700)

merge: do not check argc to determine number of remote heads

To reject merging multiple commits into an unborn branch, we check
argc, thinking that collect_parents() that reads the remaining
command line arguments from <argc, argv> will give us the same
number of commits as its input, i.e. argc.

Because what we really care about is the number of commits, let the
function run and then make sure it returns only one commit instead.

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

merge: clarify "pulling into void" special caseJunio C Hamano Thu, 23 Apr 2015 20:46:44 +0000 (13:46 -0700)

merge: clarify "pulling into void" special case

Instead of having it as one of the three if/elseif/.. case arms,
test the condition and handle this special case upfront. This makes
it easier to follow the flow of logic.

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

t5520: test pulling an octopus into an unborn branchJunio C Hamano Thu, 23 Apr 2015 20:34:08 +0000 (13:34 -0700)

t5520: test pulling an octopus into an unborn branch

The code comment for "git merge" in builtin/merge.c, we say

If the merged head is a valid one there is no reason
to forbid "git merge" into a branch yet to be born.
We do the same for "git pull".

and t5520 does have an existing test for that behaviour. However,
there was no test to make sure that 'git pull' to pull multiple
branches into an unborn branch must fail.

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