gitweb.git
format-patch: introduce format.useAutoBase configurationXiaolong Ye Tue, 26 Apr 2016 07:51:24 +0000 (15:51 +0800)

format-patch: introduce format.useAutoBase configuration

This allows to record the base commit automatically, it is equivalent
to set --base=auto in cmdline.

The format.useAutoBase has lower priority than command line option,
so if user set format.useAutoBase and pass the command line option in
the meantime, base_commit will be the one passed to command line
option.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: introduce --base=auto optionXiaolong Ye Tue, 26 Apr 2016 07:51:23 +0000 (15:51 +0800)

format-patch: introduce --base=auto option

Introduce --base=auto to record the base commit info automatically, the
base_commit will be the merge base of tip commit of the upstream branch
and revision-range specified in cmdline.

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

format-patch: add '--base' option to record base tree... Xiaolong Ye Tue, 26 Apr 2016 07:51:22 +0000 (15:51 +0800)

format-patch: add '--base' option to record base tree info

Maintainers or third party testers may want to know the exact base tree
the patch series applies to. Teach git format-patch a '--base' option
to record the base tree info and append it at the end of the first
message (either the cover letter or the first patch in the series).

The base tree info consists of the "base commit", which is a well-known
commit that is part of the stable part of the project history everybody
else works off of, and zero or more "prerequisite patches", which are
well-known patches in flight that is not yet part of the "base commit"
that need to be applied on top of "base commit" in topological order
before the patches can be applied.

The "base commit" is shown as "base-commit: " followed by the 40-hex of
the commit object name. A "prerequisite patch" is shown as
"prerequisite-patch-id: " followed by the 40-hex "patch id", which can
be obtained by passing the patch through the "git patch-id --stable"
command.

Imagine that on top of the public commit P, you applied well-known
patches X, Y and Z from somebody else, and then built your three-patch
series A, B, C, the history would be like:

---P---X---Y---Z---A---B---C

With "git format-patch --base=P -3 C" (or variants thereof, e.g. with
"--cover-letter" of using "Z..C" instead of "-3 C" to specify the
range), the base tree information block is shown at the end of the
first message the command outputs (either the first patch, or the
cover letter), like this:

base-commit: P
prerequisite-patch-id: X
prerequisite-patch-id: Y
prerequisite-patch-id: Z

Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Wu Fengguang <fengguang.wu@intel.com>
Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

patch-ids: make commit_patch_id() a public helper functionXiaolong Ye Tue, 26 Apr 2016 07:51:21 +0000 (15:51 +0800)

patch-ids: make commit_patch_id() a public helper function

Make commit_patch_id() available to other builtins.

Signed-off-by: Xiaolong Ye <xiaolong.ye@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4 tests: time_in_seconds should use $PYTHON_PATHLuke Diamand Tue, 26 Apr 2016 07:51:01 +0000 (08:51 +0100)

git-p4 tests: time_in_seconds should use $PYTHON_PATH

The time_in_seconds script should use $PYTHON_PATH, rather than
just hard-coded python, so that users can override which version
gets used, as is done for other python invocations.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4 tests: work with python3 as well as python2Luke Diamand Tue, 26 Apr 2016 07:51:00 +0000 (08:51 +0100)

git-p4 tests: work with python3 as well as python2

Update the git-p4 tests so that they work with both
Python2 and Python3.

We have to be explicit about the difference between
Unicode text strings (Python3 default) and raw binary
strings which will be exchanged with Perforce.

Additionally, print always takes parentheses in Python3.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4 tests: cd to / before running pythonLuke Diamand Tue, 26 Apr 2016 07:50:59 +0000 (08:50 +0100)

git-p4 tests: cd to / before running python

The python one-liner for getting the current time prints out
error messages if the current directory is deleted while it is
running if using python3.

Avoid these messages by switching to "/" before running it.

This problem does not arise if using python2.

Signed-off-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

clone: add `--shallow-submodules` flagStefan Beller Tue, 26 Apr 2016 01:12:27 +0000 (18:12 -0700)

clone: add `--shallow-submodules` flag

When creating a shallow clone of a repository with submodules, the depth
argument does not influence the submodules, i.e. the submodules are done
as non-shallow clones. It is unclear what the best default is for the
depth of submodules of a shallow clone, so we need to have the possibility
to do all kinds of combinations:

* shallow super project with shallow submodules
e.g. build bots starting always from scratch. They want to transmit
the least amount of network data as well as using the least amount
of space on their hard drive.
* shallow super project with unshallow submodules
e.g. The superproject is just there to track a collection of repositories
and it is not important to have the relationship between the repositories
intact. However the history of the individual submodules matter.
* unshallow super project with shallow submodules
e.g. The superproject is the actual project and the submodule is a
library which is rarely touched.

The new switch to select submodules to be shallow or unshallow supports
all of these three cases.

It is easy to transition from the first to the second case by just
unshallowing the submodules (`git submodule foreach git fetch
--unshallow`), but it is not possible to transition from the second to the
first case (as we would have already transmitted the non shallow over
the network). That is why we want to make the first case the default in
case of a shallow super project. This leads to the inconvenience in the
second case with the shallow super project and unshallow submodules,
as you need to pass `--no-shallow-submodules`.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

remote.c: spell __attribute__ correctlyJeff King Mon, 25 Apr 2016 21:15:23 +0000 (17:15 -0400)

remote.c: spell __attribute__ correctly

We want to tell the compiler that error_buf() uses
printf()-style arguments via the __attribute__ mechanism,
but the original commit (3a429d0), forgot the trailing "__".
This happens to work with real GNUC-compatible compilers
like gcc and clang, but confuses our fallback macro in
git-compat-util.h, which only matches the official name (and
thus the build fails on compilers like Visual Studio).

Reported-by: Philip Oakley <philipoakley@iee.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Sync with maintJunio C Hamano Mon, 25 Apr 2016 22:18:41 +0000 (15:18 -0700)

Sync with maint

* maint:
l10n: fr: don't translate "merge" as a parameter
l10n: fr: change "id de clé" to match "id-clé"
l10n: fr: fix wrongly translated option name
l10n: fr: fix transcation of "dir"

Seventh batch for post 2.8 cycleJunio C Hamano Mon, 25 Apr 2016 22:18:35 +0000 (15:18 -0700)

Seventh batch for post 2.8 cycle

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

Merge branch 'sb/submodule-path-misc-bugs'Junio C Hamano Mon, 25 Apr 2016 22:17:16 +0000 (15:17 -0700)

Merge branch 'sb/submodule-path-misc-bugs'

"git submodule" reports the paths of submodules the command
recurses into, but this was incorrect when the command was not run
from the root level of the superproject.

* sb/submodule-path-misc-bugs:
t7407: make expectation as clear as possible
submodule update: test recursive path reporting from subdirectory
submodule update: align reporting path for custom command execution
submodule status: correct path handling in recursive submodules
submodule update --init: correct path handling in recursive submodules
submodule foreach: correct path display in recursive submodules

Merge branch 'en/merge-trivial-fix'Junio C Hamano Mon, 25 Apr 2016 22:17:15 +0000 (15:17 -0700)

Merge branch 'en/merge-trivial-fix'

When "git merge" notices that the merge can be resolved purely at
the tree level (without having to merge blobs) and the resulting
tree happens to already exist in the object store, it forgot to
update the index, which lead to an inconsistent state for later
operations.

* en/merge-trivial-fix:
builtin/merge.c: fix a bug with trivial merges
t7605: add a testcase demonstrating a bug with trivial merges

Merge branch 'en/merge-octopus-fix'Junio C Hamano Mon, 25 Apr 2016 22:17:15 +0000 (15:17 -0700)

Merge branch 'en/merge-octopus-fix'

"merge-octopus" strategy did not ensure that the index is clean
when merge begins.

* en/merge-octopus-fix:
merge-octopus: abort if index does not match HEAD
t6044: new merge testcases for when index doesn't match HEAD

Merge branch 'dt/pre-refs-backend'Junio C Hamano Mon, 25 Apr 2016 22:17:15 +0000 (15:17 -0700)

Merge branch 'dt/pre-refs-backend'

Code restructuring around the "refs" area to prepare for pluggable
refs backends.

* dt/pre-refs-backend: (24 commits)
refs: on symref reflog expire, lock symref not referrent
refs: move resolve_ref_unsafe into common code
show_head_ref(): check the result of resolve_ref_namespace()
check_aliased_update(): check that dst_name is non-NULL
checkout_paths(): remove unneeded flag variable
cmd_merge(): remove unneeded flag variable
fsck_head_link(): remove unneeded flag variable
read_raw_ref(): change flags parameter to unsigned int
files-backend: inline resolve_ref_1() into resolve_ref_unsafe()
read_raw_ref(): manage own scratch space
files-backend: break out ref reading
resolve_ref_1(): eliminate local variable "bad_name"
resolve_ref_1(): reorder code
resolve_ref_1(): eliminate local variable
resolve_ref_unsafe(): ensure flags is always set
resolve_ref_unsafe(): use for loop to count up to MAXDEPTH
resolve_missing_loose_ref(): simplify semantics
t1430: improve test coverage of deletion of badly-named refs
t1430: test for-each-ref in the presence of badly-named refs
t1430: don't rely on symbolic-ref for creating broken symrefs
...

Merge branch 'jc/rerere-multi'Junio C Hamano Mon, 25 Apr 2016 22:17:14 +0000 (15:17 -0700)

Merge branch 'jc/rerere-multi'

"git rerere" can encounter two or more files with the same conflict
signature that have to be resolved in different ways, but there was
no way to record these separate resolutions.

* jc/rerere-multi:
rerere: adjust 'forget' to multi-variant world order
rerere: split code to call ll_merge() further
rerere: move code related to "forget" together
rerere: gc and clear
rerere: do use multiple variants
t4200: rerere a merge with two identical conflicts
rerere: allow multiple variants to exist
rerere: delay the recording of preimage
rerere: handle leftover rr-cache/$ID directory and postimage files
rerere: scan $GIT_DIR/rr-cache/$ID when instantiating a rerere_id
rerere: split conflict ID further

difftool/mergetool: make the form of yes/no questions... Nikola Forró Tue, 12 Apr 2016 14:44:20 +0000 (16:44 +0200)

difftool/mergetool: make the form of yes/no questions consistent

Every yes/no question in difftool/mergetool scripts has slightly
different form, and none of them is consistent with the form git
itself uses.

Make the form of all the questions consistent with the form used
by git.

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

match-trees: convert several leaf functions to use... brian m. carlson Sun, 17 Apr 2016 23:10:41 +0000 (23:10 +0000)

match-trees: convert several leaf functions to use struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tree-walk: convert tree_entry_extract() to use struct... brian m. carlson Sun, 17 Apr 2016 23:10:40 +0000 (23:10 +0000)

tree-walk: convert tree_entry_extract() to use struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

struct name_entry: use struct object_id instead of... brian m. carlson Sun, 17 Apr 2016 23:10:39 +0000 (23:10 +0000)

struct name_entry: use struct object_id instead of unsigned char sha1[20]

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge tag 'l10n-2.8.0-rnd3-fr' of git://github.com... Junio C Hamano Mon, 25 Apr 2016 20:36:26 +0000 (13:36 -0700)

Merge tag 'l10n-2.8.0-rnd3-fr' of git://github.com/git-l10n/git-po into maint

l10n-2.8.0-rnd3-fr

* tag 'l10n-2.8.0-rnd3-fr' of git://github.com/git-l10n/git-po:
l10n: fr: don't translate "merge" as a parameter
l10n: fr: change "id de clé" to match "id-clé"
l10n: fr: fix wrongly translated option name
l10n: fr: fix transcation of "dir"

send-email: fix grammo in the prompt that asks e-mail... Junio C Hamano Sun, 24 Apr 2016 19:31:44 +0000 (12:31 -0700)

send-email: fix grammo in the prompt that asks e-mail recipients

The message, which dates back to the very original version 83b24437
made in 2005, sounds clumsy, grammatically incorrect, and is hard to
understand.

Reported-by: John Darrington <john@darrington.wattle.id.au>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

convert.c: ident + core.autocrlf didn't workTorsten Bögershausen Mon, 25 Apr 2016 16:56:32 +0000 (18:56 +0200)

convert.c: ident + core.autocrlf didn't work

When the ident attributes is set, get_stream_filter() did not obey
core.autocrlf=true, and the file was checked out with LF.

Change the rule when a streaming filter can be used:
- if an external filter is specified, don't use a stream filter.
- if the worktree eol is CRLF and "auto" is active, don't use a stream filter.
- Otherwise the stream filter can be used.

Add test cases in t0027.

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

t0027: test cases for combined attributesTorsten Bögershausen Mon, 25 Apr 2016 16:56:31 +0000 (18:56 +0200)

t0027: test cases for combined attributes

Add more test cases for the not normalized files ("NNO"). The
"text" attribute is most important, use it as the first parameter.
"ident", if set, is the second paramater followed by the eol
attribute. The eol attribute overrides core.autocrlf, which
overrides core.eol.
indent is not yet used, this will be done in the next commit.

Use loops to test more combinations of attributes, like
"* text eol=crlf" or especially "*text=auto eol=crlf".

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

convert: allow core.autocrlf=input and core.eol=crlfTorsten Bögershausen Mon, 25 Apr 2016 16:56:29 +0000 (18:56 +0200)

convert: allow core.autocrlf=input and core.eol=crlf

Even though the configuration parser errors out when core.autocrlf
is set to 'input' when core.eol is set to 'crlf', there is no need
to do so, because the core.autocrlf setting trumps core.eol.

Allow all combinations of core.crlf and core.eol and document
that core.autocrlf overrides core.eol.

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

t0027: make commit_chk_wrnNNO() reliableTorsten Bögershausen Mon, 25 Apr 2016 16:56:27 +0000 (18:56 +0200)

t0027: make commit_chk_wrnNNO() reliable

When the content of a commited file is unchanged and the attributes
are changed, Git may not detect that the next commit must treat the
file as changed. This happens when lstat() doesn't detect a change,
since neither inode, mtime nor size are changed.

Add a single "Z" character to change the file size and content.
When the files are compared later in checkout_files(), the "Z" is
removed before the comparison.

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

string_list: use string-list API in unsorted_string_lis... Ralf Thielow Mon, 25 Apr 2016 17:40:00 +0000 (19:40 +0200)

string_list: use string-list API in unsorted_string_list_lookup()

Using the string-list API in function unsorted_string_list_lookup()
makes the code more readable.

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t9824: fix broken &&-chain in a subshellSZEDER Gábor Sun, 24 Apr 2016 11:50:21 +0000 (13:50 +0200)

t9824: fix broken &&-chain in a subshell

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

git-rebase--merge: don't include absent parent as a... Ben Woosley Wed, 20 Apr 2016 18:20:56 +0000 (18:20 +0000)

git-rebase--merge: don't include absent parent as a base

Absent this fix, attempts to rebase an orphan branch using "rebase -m"
fails with:

$ git rebase -m ORPHAN_TARGET_BASE
First, rewinding head to replay your work on top of it...
fatal: Could not parse object 'ORPHAN_ROOT_SHA^'
Unknown exit code (128) from command: git-merge-recursive ORPHAN_ROOT_SHA^ -- HEAD ORPHAN_ROOT_SHA

To fix, this will only include the rebase root's parent as a base if it exists,
so that in cases of rebasing an orphan branch, it is a simple two-way merge.

Note the default rebase behavior does not fail:

$ git rebase ORPHAN_TARGET_BASE
First, rewinding head to replay your work on top of it...
Applying: ORPHAN_ROOT_COMMIT_MSG
Using index info to reconstruct a base tree...

A few tests were expecting the old behaviour to forbid rebasing such
a history with "rebase -m", which now need to expect them to succeed.

Signed-off-by: Ben Woosley <ben.woosley@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'fr_v2.8.0_r3' of git://github.com/jnavila... Jiang Xin Sun, 24 Apr 2016 12:36:34 +0000 (20:36 +0800)

Merge branch 'fr_v2.8.0_r3' of git://github.com/jnavila/git into maint

* 'fr_v2.8.0_r3' of git://github.com/jnavila/git:
l10n: fr: don't translate "merge" as a parameter
l10n: fr: change "id de clé" to match "id-clé"
l10n: fr: fix wrongly translated option name
l10n: fr: fix transcation of "dir"

Sixth batch for post 2.8 cycleJunio C Hamano Fri, 22 Apr 2016 22:48:03 +0000 (15:48 -0700)

Sixth batch for post 2.8 cycle

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

Merge branch 'ad/cygwin-wants-rename'Junio C Hamano Fri, 22 Apr 2016 22:45:10 +0000 (15:45 -0700)

Merge branch 'ad/cygwin-wants-rename'

On Cygwin, object creation uses the "create a temporary and then
rename it to the final name" pattern, not "create a temporary,
hardlink it to the final name and then unlink the temporary"
pattern.

This is necessary to use Git on Windows shared directories, and is
already enabled for the MinGW and plain Windows builds. It also
has been used in Cygwin packaged versions of Git for quite a while.
See http://thread.gmane.org/gmane.comp.version-control.git/291853

($gmane/275680, $gmane/291853).

* ad/cygwin-wants-rename:
config.mak.uname: Cygwin needs OBJECT_CREATION_USES_RENAMES

Merge branch 'jk/use-write-script-more'Junio C Hamano Fri, 22 Apr 2016 22:45:09 +0000 (15:45 -0700)

Merge branch 'jk/use-write-script-more'

Code clean-up.

* jk/use-write-script-more:
t3404: use write_script
t1020: do not overuse printf and use write_script
t5532: use write_script

Merge branch 'jk/do-not-printf-NULL'Junio C Hamano Fri, 22 Apr 2016 22:45:09 +0000 (15:45 -0700)

Merge branch 'jk/do-not-printf-NULL'

"git config" had a codepath that tried to pass a NULL to
printf("%s"), which nobody seems to have noticed.

* jk/do-not-printf-NULL:
git_config_set_multivar_in_file: handle "unset" errors
git_config_set_multivar_in_file: all non-zero returns are errors
config: lower-case first word of error strings

Merge branch 'jc/http-socks5h'Junio C Hamano Fri, 22 Apr 2016 22:45:09 +0000 (15:45 -0700)

Merge branch 'jc/http-socks5h'

The socks5:// proxy support added back in 2.6.4 days was not aware
that socks5h:// proxies behave differently.

* jc/http-socks5h:
http: differentiate socks5:// and socks5h://

Merge branch 'ky/imap-send-openssl-1.1.0'Junio C Hamano Fri, 22 Apr 2016 22:45:08 +0000 (15:45 -0700)

Merge branch 'ky/imap-send-openssl-1.1.0'

Upcoming OpenSSL 1.1.0 will break compilation b updating a few APIs
we use in imap-send, which has been adjusted for the change.

* ky/imap-send-openssl-1.1.0:
configure: remove checking for HMAC_CTX_cleanup
imap-send: avoid deprecated TLSv1_method()
imap-send: check NULL return of SSL_CTX_new()
imap-send: use HMAC() function provided by OpenSSL

Merge branch 'ky/imap-send'Junio C Hamano Fri, 22 Apr 2016 22:45:08 +0000 (15:45 -0700)

Merge branch 'ky/imap-send'

Support for CRAM-MD5 authentication method in "git imap-send" did
not work well.

* ky/imap-send:
imap-send: fix CRAM-MD5 response calculation
imap-send: check for NOLOGIN capability only when using LOGIN command

Merge branch 'jc/xstrfmt-null-with-prec-0'Junio C Hamano Fri, 22 Apr 2016 22:45:07 +0000 (15:45 -0700)

Merge branch 'jc/xstrfmt-null-with-prec-0'

* jc/xstrfmt-null-with-prec-0:
setup.c: do not feed NULL to "%.*s" even with precision 0

Merge branch 'ad/commit-have-m-option'Junio C Hamano Fri, 22 Apr 2016 22:45:07 +0000 (15:45 -0700)

Merge branch 'ad/commit-have-m-option'

"git commit" misbehaved in a few minor ways when an empty message
is given via -m '', all of which has been corrected.

* ad/commit-have-m-option:
commit: do not ignore an empty message given by -m ''
commit: --amend -m '' silently fails to wipe message

Merge branch 'ew/send-email-drop-data-dumper'Junio C Hamano Fri, 22 Apr 2016 22:45:06 +0000 (15:45 -0700)

Merge branch 'ew/send-email-drop-data-dumper'

Code clean-up.

* ew/send-email-drop-data-dumper:
send-email: do not load Data::Dumper

Merge branch 'ew/send-email-readable-message-id'Junio C Hamano Fri, 22 Apr 2016 22:45:05 +0000 (15:45 -0700)

Merge branch 'ew/send-email-readable-message-id'

"git send-email" now uses a more readable timestamps when
formulating a message ID.

* ew/send-email-readable-message-id:
send-email: more meaningful Message-ID

Merge branch 'sb/submodule-helper-clone-regression... Junio C Hamano Fri, 22 Apr 2016 22:45:03 +0000 (15:45 -0700)

Merge branch 'sb/submodule-helper-clone-regression-fix'

A partial rewrite of "git submodule" in the 2.7 timeframe changed
the way the gitdir: pointer in the submodules point at the real
repository location to use absolute paths by accident. This has
been corrected.

* sb/submodule-helper-clone-regression-fix:
submodule--helper, module_clone: catch fprintf failure
submodule--helper: do not borrow absolute_path() result for too long
submodule--helper, module_clone: always operate on absolute paths
submodule--helper clone: create the submodule path just once
submodule--helper: fix potential NULL-dereference
recursive submodules: test for relative paths

mmap(win32): avoid expensive fstat() callJohannes Schindelin Fri, 22 Apr 2016 14:31:32 +0000 (16:31 +0200)

mmap(win32): avoid expensive fstat() call

On Windows, we have to emulate the fstat() call to fill out information
that takes extra effort to obtain, such as the file permissions/type.

If all we want is the file size, we can use the much cheaper
GetFileSizeEx() function (available since Windows XP).

Suggested by Philip Kelley.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mmap(win32): avoid copy-on-write when it is unnecessaryJohannes Schindelin Fri, 22 Apr 2016 14:31:26 +0000 (16:31 +0200)

mmap(win32): avoid copy-on-write when it is unnecessary

Often we are mmap()ing read-only. In those cases, it is wasteful to map in
copy-on-write mode. Even worse: it can cause errors where we run out of
space in the page file.

So let's be extra careful to map files in read-only mode whenever
possible.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

win32mmap: set errno appropriatelyJohannes Schindelin Fri, 22 Apr 2016 14:31:22 +0000 (16:31 +0200)

win32mmap: set errno appropriately

It is not really helpful when a `git fetch` fails with the message:

fatal: mmap failed: No error

In the particular instance encountered by a colleague of yours truly,
the Win32 error code was ERROR_COMMITMENT_LIMIT which means that the
page file is not big enough.

Let's make the message

fatal: mmap failed: File too large

instead, which is only marginally better, but which can be associated
with the appropriate work-around: setting `core.packedGitWindowSize` to
a relatively small value.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch: do not rename a branch under bisect or rebaseNguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:36 +0000 (20:01 +0700)

branch: do not rename a branch under bisect or rebase

The branch name in that case could be saved in rebase's head_name or
bisect's BISECT_START files. Ideally we should try to update them as
well. But it's trickier (*). Let's play safe and see if the user
complains about inconveniences before doing that.

(*) If we do it, bisect and rebase need to provide an API to rename
branches. We can't do it in worktree.c or builtin/branch.c because
when other people change rebase/bisect code, they may not be aware of
this code and accidentally break it (e.g. rename the branch file, or
refer to the branch in new files). It's a lot more work.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree.c: check whether branch is bisected in another... Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:35 +0000 (20:01 +0700)

worktree.c: check whether branch is bisected in another worktree

Similar to the rebase case, we want to detect if "HEAD" in some worktree
is being bisected because

1) we do not want to checkout this branch in another worktree, after
bisect is done it will want to go back to this branch

2) we do not want to delete the branch is either or git bisect will
fail to return to the (long gone) branch

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status.c: split bisect detection out of wt_status_ge... Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:34 +0000 (20:01 +0700)

wt-status.c: split bisect detection out of wt_status_get_state()

And make it work with any given worktree, in preparation for (again)
find_shared_symref(). read_and_strip_branch() is deleted because it's
no longer used.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree.c: check whether branch is rebased in another... Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:33 +0000 (20:01 +0700)

worktree.c: check whether branch is rebased in another worktree

This function find_shared_symref() is used in a couple places:

1) in builtin/branch.c: it's used to detect if a branch is checked out
elsewhere and refuse to delete the branch.

2) in builtin/notes.c: it's used to detect if a note is being merged in
another worktree

3) in branch.c, the function die_if_checked_out() is actually used by
"git checkout" and "git worktree add" to see if a branch is already
checked out elsewhere and refuse the operation.

In cases 1 and 3, if a rebase is ongoing, "HEAD" will be in detached
mode, find_shared_symref() fails to detect it and declares "no branch is
checked out here", which is not really what we want.

This patch tightens the test. If the given symref is "HEAD", we try to
detect if rebase is ongoing. If so return the branch being rebased. This
makes checkout and branch delete operations safer because you can't
checkout a branch being rebased in another place, or delete it.

Special case for checkout. If the current branch is being rebased,
git-rebase.sh may use "git checkout" to abort and return back to the
original branch. The updated test in find_shared_symref() will prevent
that and "git rebase --abort" will fail as a result.
find_shared_symref() and die_if_checked_out() have to learn a new
option ignore_current_worktree to loosen the test a bit.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree.c: avoid referencing to worktrees[i] multiple... Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:32 +0000 (20:01 +0700)

worktree.c: avoid referencing to worktrees[i] multiple times

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status.c: make wt_status_check_rebase() work on... Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:31 +0000 (20:01 +0700)

wt-status.c: make wt_status_check_rebase() work on any worktree

This is a preparation step for find_shared_symref() to detect if any
worktree is being rebased.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wt-status.c: split rebase detection out of wt_status_ge... Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:30 +0000 (20:01 +0700)

wt-status.c: split rebase detection out of wt_status_get_state()

worktree.c:find_shared_symref() later needs to know if a branch is being
rebased, and only rebase, no cherry-pick, do detached branch... Split
this code so it can be used independently from other in-progress tests.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

path.c: refactor and add worktree_git_path()Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:29 +0000 (20:01 +0700)

path.c: refactor and add worktree_git_path()

do_git_path(), which is the common code for all git_path* functions, is
modified to take a worktree struct and can produce paths for any
worktree.

worktree_git_path() is the first function that makes use of this. It can
be used to write code that can examine any worktree. For example,
wt_status_get_state() will be converted using this to take
am/rebase/... state of any worktree.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree.c: mark current worktreeNguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:28 +0000 (20:01 +0700)

worktree.c: mark current worktree

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree.c: make find_shared_symref() return struct... Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:27 +0000 (20:01 +0700)

worktree.c: make find_shared_symref() return struct worktree *

This gives the caller more information and they can answer things like,
"is it the main worktree" or "is it the current worktree". The latter
question is needed for the "checkout a rebase branch" case later.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

worktree.c: store "id" instead of "git_dir"Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:26 +0000 (20:01 +0700)

worktree.c: store "id" instead of "git_dir"

We can reconstruct git_dir from id quite easily. It's a bit hackier to
do the reverse.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

path.c: add git_common_path() and strbuf_git_common_path()Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:25 +0000 (20:01 +0700)

path.c: add git_common_path() and strbuf_git_common_path()

These are mostly convenient functions to reduce code duplication. Most
of the time, we should be able to get by with git_path() which handles
$GIT_COMMON_DIR internally. However there are a few cases where we need
to construct paths manually, for example some paths from a specific
worktree. These functions will enable that.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

dir.c: rename str(n)cmp_icase to fspath(n)cmpNguyễn Thái Ngọc Duy Fri, 22 Apr 2016 13:01:24 +0000 (20:01 +0700)

dir.c: rename str(n)cmp_icase to fspath(n)cmp

These functions compare two paths that are taken from file system.
Depending on the running file system, paths may need to be compared
case-sensitively or not, and maybe even something else in future. The
current names do not convey that well.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

wrapper.c: delete dead function git_mkstemps()Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 12:25:16 +0000 (19:25 +0700)

wrapper.c: delete dead function git_mkstemps()

Its last call site was replaced by mks_tempfile_ts() in 284098f (diff:
use tempfile module - 2015-08-12) and there's a good chance
mks_tempfile_ts will continue to successfully handle this job. Delete
it.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

dir.c: remove dead function fnmatch_icase()Nguyễn Thái Ngọc Duy Fri, 22 Apr 2016 12:25:15 +0000 (19:25 +0700)

dir.c: remove dead function fnmatch_icase()

It was largely replaced by fnmatch_icase_mem() and its last use was in
84b8b5d (remove match_pathspec() in favor of match_pathspec_depth() -
2013-07-14).

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tag -v: verify directly rather than exec-ing verify-tagSantiago Torres Fri, 22 Apr 2016 14:52:05 +0000 (10:52 -0400)

tag -v: verify directly rather than exec-ing verify-tag

Instead of having tag -v fork to run verify-tag, use the
gpg_verify_tag() function directly.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Santiago Torres <santiago@nyu.edu>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

verify-tag: move tag verification code to tag.cSantiago Torres Fri, 22 Apr 2016 14:52:04 +0000 (10:52 -0400)

verify-tag: move tag verification code to tag.c

The PGP verification routine for tags could be accessed by other modules
that require to do so.

Publish the verify_tag function in tag.c and rename it to gpg_verify_tag
so it does not conflict with builtin/mktag's static function.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Santiago Torres <santiago@nyu.edu>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

verify-tag: prepare verify_tag for libificationSantiago Torres Tue, 19 Apr 2016 17:47:19 +0000 (13:47 -0400)

verify-tag: prepare verify_tag for libification

The current interface of verify_tag() resolves reference names to SHA1,
however, the plan is to make this functionality public and the current
interface is cumbersome for callers: they are expected to supply the
textual representation of a sha1/refname. In many cases, this requires
them to turn the sha1 to hex representation, just to be converted back
inside verify_tag.

Add a SHA1 parameter to use instead of the name parameter, and rename
the name parameter to "name_to_report" for reporting purposes only.

Helped-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Santiago Torres <santiago@nyu.edu>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-lib: simplify '--option=value' parsingSZEDER Gábor Fri, 22 Apr 2016 20:32:21 +0000 (22:32 +0200)

test-lib: simplify '--option=value' parsing

To get the 'value' from '--option=value', test-lib.sh parses said
option running 'expr' with a regexp. This involves a subshell, an
external process, and a lot of non-alphanumeric characters in the
regexp.

Use a much simpler POSIX-defined shell parameter expansion instead to
do the same.

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

name-rev: include taggerdate in considering the best... Johannes Schindelin Fri, 22 Apr 2016 13:39:01 +0000 (15:39 +0200)

name-rev: include taggerdate in considering the best name

We most likely want the oldest tag that contained the commit to be
reported. So let's remember the taggerdate, and make it more important
than anything else when choosing the best name for a given commit.

Suggested by Linus Torvalds.

Note that we need to update t9903 because it tested for the old behavior
(which preferred the description "b1~1" over "tags/t2~1").

We might want to introduce a --heed-taggerdate option, and make the new
behavior dependent on that, if it turns out that some scripts rely on the
old name-rev method.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pull: pass --allow-unrelated-histories to "git merge"Junio C Hamano Fri, 18 Mar 2016 20:21:09 +0000 (13:21 -0700)

pull: pass --allow-unrelated-histories to "git merge"

The previous commit said:

We could add the same option to "git pull" and have it passed
through to underlying "git merge". I do not have a fundamental
opposition against such a feature, but this commit does not do
so and instead leaves it as low-hanging fruit for others,
because such a "two project merge" would be done after fetching
the other project into some location in the working tree of an
existing project and making sure how well they fit together, it
is sufficient to allow a local merge without such an option
pass-through from "git pull" to "git merge".

Prepare a patch to make it a reality, just in case it is needed.

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

t3033: avoid 'ambiguous refs' warningJunio C Hamano Thu, 21 Apr 2016 18:52:33 +0000 (11:52 -0700)

t3033: avoid 'ambiguous refs' warning

Because "test_commit five" creates a commit and point it with a tag
'five', doing so on a branch whose name is 'five' will later result
in an 'ambiguous refs' warning. Even though it is harmless because
all the later references are for the tag, there is no reason for the
branch to be called 'five'. Give it a name that describes its
purpose more clearly, i.e. "newroot".

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

t5504: drop sigpipe=ok from push testsJeff King Tue, 19 Apr 2016 22:51:25 +0000 (18:51 -0400)

t5504: drop sigpipe=ok from push tests

These were added by 8bf4bec (add "ok=sigpipe" to
test_must_fail and use it to fix flaky tests, 2015-11-27)
because we would racily die via SIGPIPE when the pack was
rejected by the other side.

But since we have recently de-flaked send-pack, we should be
able to tighten up these tests (including re-adding the
expected output checks).

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

fetch-pack: isolate sigpipe in demuxer threadJeff King Tue, 19 Apr 2016 22:50:29 +0000 (18:50 -0400)

fetch-pack: isolate sigpipe in demuxer thread

In commit 9ff18fa (fetch-pack: ignore SIGPIPE in sideband
demuxer, 2016-02-24), we started using sigchain_push() to
ignore SIGPIPE in the async demuxer thread. However, this is
rather clumsy, as it ignores SIGPIPE for the entire process,
including the main thread. At the time we didn't have any
per-thread signal support, but we now we do. Let's use it.

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

send-pack: isolate sigpipe in demuxer threadJeff King Tue, 19 Apr 2016 22:50:17 +0000 (18:50 -0400)

send-pack: isolate sigpipe in demuxer thread

If we get an error from pack-objects, we may exit
send_pack() early, before reading the server's status
response. In such a case, we may racily see SIGPIPE from our
async demuxer (which is trying to write that status back to
us), and we'd prefer to continue pushing the error up the
call stack, rather than taking down the whole process with
signal death.

This is safe to do because our demuxer just calls
recv_sideband, whose data writes are all done with
write_or_die(), which will notice SIGPIPE.

We do also write sideband 2 to stderr, and we would no
longer die on SIGPIPE there (if it were piped in the first
place, and if the piped program went away). But that's
probably a good thing, as it likewise should not abort the
push process at all (neither immediately by signal, nor
eventually by reporting failure back to the main thread).

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

run-command: teach async threads to ignore SIGPIPEJeff King Tue, 19 Apr 2016 22:49:41 +0000 (18:49 -0400)

run-command: teach async threads to ignore SIGPIPE

Async processes can be implemented as separate forked
processes, or as threads (depending on the NO_PTHREADS
setting). In the latter case, if an async thread gets
SIGPIPE, it takes down the whole process. This is obviously
bad if the main process was not otherwise going to die, but
even if we were going to die, it means the main process does
not have a chance to report a useful error message.

There's also the small matter that forked async processes
will not take the main process down on a signal, meaning git
will behave differently depending on the NO_PTHREADS
setting.

This patch fixes it by adding a new flag to "struct async"
to block SIGPIPE just in the async thread. In theory, this
should always be on (which makes async threads behave more
like async processes), but we would first want to make sure
that each async process we spawn is careful about checking
return codes from write() and would not spew endlessly into
a dead pipe. So let's start with it as optional, and we can
enable it for specific sites in future patches.

The natural name for this option would be "ignore_sigpipe",
since that's what it does for the threaded case. But since
that name might imply that we are ignoring it in all cases
(including the separate-process one), let's call it
"isolate_sigpipe". What we are really asking for is
isolation. I.e., not to have our main process taken down by
signals spawned by the async process. How that is
implemented is up to the run-command code.

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

send-pack: close demux pipe before finishing async... Jeff King Tue, 19 Apr 2016 22:45:17 +0000 (18:45 -0400)

send-pack: close demux pipe before finishing async process

This fixes a deadlock on the client side when pushing a
large number of refs from a corrupted repo. There's a
reproduction script below, but let's start with a
human-readable explanation.

The client side of a push goes something like this:

1. Start an async process to demux sideband coming from
the server.

2. Run pack-objects to send the actual pack, and wait for
its status via finish_command().

3. If pack-objects failed, abort immediately.

4. If pack-objects succeeded, read the per-ref status from
the server, which is actually coming over a pipe from
the demux process started in step 1.

We run finish_async() to wait for and clean up the demux
process in two places. In step 3, if we see an error, we
want it to end early. And after step 4, it should be done
writing any data and we are just cleaning it up.

Let's focus on the error case first. We hand the output
descriptor to the server over to pack-objects. So by the
time it has returned an error to us, it has closed the
descriptor and the server has gotten EOF. The server will
mark all refs as failed with "unpacker error" and send us
back the status for each (followed by EOF).

This status goes to the demuxer thread, which relays it over
a pipe to the main thread. But the main thread never even
tries reading the status. It's trying to bail because of the
pack-objects error, and is waiting for the demuxer thread to
finish. If there are a small number of refs, that's OK; the
demuxer thread writes into the pipe buffer, sees EOF from
the server, and quits. But if there are a large number of
refs, it may block on write() back to the main thread,
leading to a deadlock (the main thread is waiting for the
demuxer to finish, the demuxer is waiting for the main
thread to read).

We can break this deadlock by closing the pipe between the
demuxer and the main thread before calling finish_async().
Then the demuxer gets a write() error and exits.

The non-error case usually just works, because we will have
read all of the data from the other side. We do close
demux.out already, but we only do so _after_ calling
finish_async(). This is OK because there shouldn't be any
more data coming from the server. But technically we've only
read to a flush packet, and a broken or malicious server
could be sending more cruft. In such a case, we would hit
the same deadlock. Closing the pipe first doesn't affect the
normal case, and means that for a cruft-sending server,
we'll notice a write() error rather than deadlocking.

Note that when write() sees this error, we'll actually
deliver SIGPIPE to the thread, which will take down the
whole process (unless we're compiled with NO_PTHREADS). This
isn't ideal, but it's an improvement over the status quo,
which is deadlocking. And SIGPIPE handling in async threads
is a bigger problem that we can deal with separately.

A simple reproduction for the error case is below. It's
technically racy (we could exit the main process and take
down the async thread with us before it even reads the
status), though in practice it seems to fail pretty
consistently.

git init repo &&
cd repo &&

# make some commits; we need two so we can simulate corruption
# in the history later.
git commit --allow-empty -m one &&
one=$(git rev-parse HEAD) &&
git commit --allow-empty -m two &&
two=$(git rev-parse HEAD) &&

# now make a ton of refs; our goal here is to overflow the pipe buffer
# when reporting the ref status, which will cause the demuxer to block
# on write()
for i in $(seq 20000); do
echo "create refs/heads/this-is-a-really-long-branch-name-$i $two"
done |
git update-ref --stdin &&

# now make a corruption in the history such that pack-objects will fail
rm -vf .git/objects/$(echo $one | sed 's}..}&/}') &&

# and then push the result
git init --bare dst.git &&
git push --mirror dst.git

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

replace --edit: respect core.editorJohannes Schindelin Wed, 20 Apr 2016 06:38:03 +0000 (08:38 +0200)

replace --edit: respect core.editor

We simply need to read the config, is all.

This fixes https://github.com/git-for-windows/git/issues/733

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

match-trees: convert shift_tree() and shift_tree_by... brian m. carlson Sun, 17 Apr 2016 23:10:38 +0000 (23:10 +0000)

match-trees: convert shift_tree() and shift_tree_by() to use object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-match-trees: convert to use struct object_idbrian m. carlson Sun, 17 Apr 2016 23:10:37 +0000 (23:10 +0000)

test-match-trees: convert to use struct object_id

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sha1-name: introduce a get_oid() functionbrian m. carlson Sun, 17 Apr 2016 23:10:36 +0000 (23:10 +0000)

sha1-name: introduce a get_oid() function

The get_oid() function is equivalent to the get_sha1() function, but
uses a struct object_id instead.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test-parse-options: print quiet as integerPranit Bauva Tue, 12 Apr 2016 23:02:17 +0000 (23:02 +0000)

test-parse-options: print quiet as integer

We would want to see how multiple --quiet options affect the value of
the underlying variable (we may want "--quiet --quiet" to still be 1, or
we may want to see the value incremented to 2). Show the value as
integer to allow us to inspect it.

Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t0040-test-parse-options.sh: fix style issuesPranit Bauva Tue, 12 Apr 2016 23:02:17 +0000 (23:02 +0000)

t0040-test-parse-options.sh: fix style issues

Signed-off-by: Pranit Bauva <pranit.bauva@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: add P4 jobs to git commit messageJan Durovec Tue, 19 Apr 2016 19:49:41 +0000 (19:49 +0000)

git-p4: add P4 jobs to git commit message

When migrating from Perforce to git the information about P4 jobs
associated with P4 changelists is lost.

Having these jobs listed on messages of related git commits enables smooth
migration for projects that take advantage of e.g. JIRA integration
(which uses jobs on Perforce side and parses commit messages on git side).

The jobs are added to the message in the same format as is expected when
migrating in the reverse direction.

Signed-off-by: Jan Durovec <jan.durovec@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-p4: clean-up code style in testsJan Durovec Tue, 19 Apr 2016 19:49:41 +0000 (19:49 +0000)

git-p4: clean-up code style in tests

Preliminary clean-up of testing libraries for git-p4.

* spaces added to both sides of () in function definitions in lib-git-p4
* tab indentation added to git-p4 tests when <<- redirection is used

Signed-off-by: Jan Durovec <jan.durovec@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

travis-ci: update Git-LFS and P4 to the latest versionLars Schneider Tue, 19 Apr 2016 20:08:49 +0000 (22:08 +0200)

travis-ci: update Git-LFS and P4 to the latest version

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

verify-tag: update variable name and typeSantiago Torres Tue, 19 Apr 2016 17:47:18 +0000 (13:47 -0400)

verify-tag: update variable name and type

The run_gpg_verify() function has two variables, size and len.

This may come off as confusing when reading the code. Clarify which one
pertains to the length of the tag headers by renaming len to
payload_size. Additionally, change the type of payload_size to size_t to
match the return type of parse_signature.

Signed-off-by: Santiago Torres <santiago@nyu.edu>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: builtin/pull.c: split strings marked for translationVasco Almeida Tue, 19 Apr 2016 13:19:22 +0000 (13:19 +0000)

i18n: builtin/pull.c: split strings marked for translation

Split string "If you wish to set tracking information
for this branch you can do so with:\n" to match occurring string in
git-parse-remote.sh. In this case, the translator handles it only once.

On the other hand, the translations of the string that were already made
are mark as fuzzy and the translator needs to correct it herself.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: builtin/pull.c: mark placeholders for translationVasco Almeida Tue, 19 Apr 2016 13:19:21 +0000 (13:19 +0000)

i18n: builtin/pull.c: mark placeholders for translation

Some translations might also translate "<remote>" and "<branch>".

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

i18n: git-parse-remote.sh: mark strings for translationVasco Almeida Tue, 19 Apr 2016 13:19:20 +0000 (13:19 +0000)

i18n: git-parse-remote.sh: mark strings for translation

Change Makefile to include git-parse-remote.sh in LOCALIZED_SH.

TODO: remove 3rd argument of error_on_missing_default_upstream function
that is no longer required.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mv: allow moving nested submodulesStefan Beller Tue, 19 Apr 2016 18:32:04 +0000 (11:32 -0700)

mv: allow moving nested submodules

When directories are moved using `git mv` all files in the directory
have been just moved, but no further action was taken on them. This
was done by assigning the mode = WORKING_DIRECTORY to the files
inside a moved directory.

submodules however need to update their link to the git directory as
well as updates to the .gitmodules file. By removing the condition of
`mode != INDEX` (the remaining modes are BOTH and WORKING_DIRECTORY) for
the required submodule actions, we perform these for submodules in a
moved directory.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff: implement empty line chunk heuristicStefan Beller Tue, 19 Apr 2016 15:21:30 +0000 (08:21 -0700)

xdiff: implement empty line chunk heuristic

In order to produce the smallest possible diff and combine several diff
hunks together, we implement a heuristic from GNU Diff which moves diff
hunks forward as far as possible when we find common context above and
below a diff hunk. This sometimes produces less readable diffs when
writing C, Shell, or other programming languages, ie:

...
/*
+ *
+ *
+ */
+
+/*
...

instead of the more readable equivalent of

...
+/*
+ *
+ *
+ */
+
/*
...

Implement the following heuristic to (optionally) produce the desired
output.

If there are diff chunks which can be shifted around, shift each hunk
such that the last common empty line is below the chunk with the rest
of the context above.

This heuristic appears to resolve the above example and several other
common issues without producing significantly weird results. However, as
with any heuristic it is not really known whether this will always be
more optimal. Thus, it can be disabled via diff.compactionHeuristic.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t7030: test verifying multiple tagsSantiago Torres Sun, 17 Apr 2016 22:26:57 +0000 (18:26 -0400)

t7030: test verifying multiple tags

The verify-tag command supports multiple tag names to verify, but
existing tests only test for invocation with a single tag.

Add a test invoking it with multiple tags.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Santiago Torres <santiago@nyu.edu>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

xdiff: add recs_match helper functionJacob Keller Fri, 15 Apr 2016 23:01:45 +0000 (16:01 -0700)

xdiff: add recs_match helper function

It is a common pattern in xdl_change_compact to check that hashes and
strings match. The resulting code to perform this change causes very
long lines and makes it hard to follow the intention. Introduce a helper
function recs_match which performs both checks to increase
code readability.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fifth batch for post 2.8 cycleJunio C Hamano Mon, 18 Apr 2016 17:51:09 +0000 (10:51 -0700)

Fifth batch for post 2.8 cycle

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

Merge branch 'jk/branch-shortening-funny-symrefs'Junio C Hamano Mon, 18 Apr 2016 17:49:14 +0000 (10:49 -0700)

Merge branch 'jk/branch-shortening-funny-symrefs'

A change back in version 2.7 to "git branch" broke display of a
symbolic ref in a non-standard place in the refs/ hierarchy (we
expect symbolic refs to appear in refs/remotes/*/HEAD to point at
the primary branch the remote has, and as .git/HEAD to point at the
branch we locally checked out).

* jk/branch-shortening-funny-symrefs:
branch: fix shortening of non-remote symrefs

Merge branch 'ky/branch-m-worktree'Junio C Hamano Mon, 18 Apr 2016 17:48:11 +0000 (10:48 -0700)

Merge branch 'ky/branch-m-worktree'

When "git worktree" feature is in use, "git branch -m" renamed a
branch that is checked out in another worktree without adjusting
the HEAD symbolic ref for the worktree.

* ky/branch-m-worktree:
set_worktree_head_symref(): fix error message
branch -m: update all per-worktree HEADs
refs: add a new function set_worktree_head_symref

submodule: port init from shell to CStefan Beller Sat, 16 Apr 2016 00:50:13 +0000 (17:50 -0700)

submodule: port init from shell to C

By having the `submodule init` functionality in C, we can reference it
easier from other parts in the code in later patches. The code is split
up to have one function to initialize one submodule and a calling function
that takes care of the rest, such as argument handling and translating the
arguments to the paths of the submodules.

This is the first submodule subcommand that is fully converted to C
except for the usage string, so this is actually removing a call to
the `submodule--helper list` function, which is supposed to be used in
this transition. Instead we'll make a direct call to `module_list_compute`.

An explanation why we need to edit the prefixes in cmd_update in
git-submodule.sh in this patch:

By having no processing in the shell part, we need to convey the notion
of wt_prefix and prefix to the C parts, which former patches punted on
and did the processing of displaying path in the shell.

`wt_prefix` used to hold the path from the repository root to the current
directory, e.g. wt_prefix would be t/ if the user invoked the
`git submodule` command in ~/repo/t and ~repo is the GIT_DIR.

`prefix` used to hold the relative path from the repository root to the
operation, e.g. if you have recursive submodules, the shell script would
modify the `prefix` in each recursive step by adding the submodule path.

We will pass `wt_prefix` into the C helper via `git -C <dir>` as that
will setup git in the directory the user actually called git-submodule.sh
from. The `prefix` will be passed in via the `--prefix` option.

Having `prefix` and `wt_prefix` relative to the GIT_DIR of the
calling superproject is unfortunate with this patch as the C code doesn't
know about a possible recursion from a superproject via `submodule update
--init --recursive`.

To fix this, we change the meaning of `wt_prefix` to point to the current
project instead of the superproject and `prefix` to include any relative
paths issues in the superproject. That way `prefix` will become the leading
part for displaying paths and `wt_prefix` will be empty in recursive
calls for now.

The new notion of `wt_prefix` and `prefix` still allows us to reconstruct
the calling directory in the superproject by just traveling reverse of
`prefix`.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule: port resolve_relative_url from shell to CStefan Beller Sat, 16 Apr 2016 00:50:12 +0000 (17:50 -0700)

submodule: port resolve_relative_url from shell to C

Later on we want to automatically call `git submodule init` from
other commands, such that the users don't have to initialize the
submodule themselves. As these other commands are written in C
already, we'd need the init functionality in C, too. The
`resolve_relative_url` function is a large part of that init
functionality, so start by porting this function to C.

To create the tests in t0060, the function `resolve_relative_url`
was temporarily enhanced to write all inputs and output to disk
when running the test suite. The added tests in this patch are
a small selection thereof.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

test helpers: move test-* to t/helper/ subdirectoryNguyễn Thái Ngọc Duy Wed, 13 Apr 2016 13:22:42 +0000 (20:22 +0700)

test helpers: move test-* to t/helper/ subdirectory

This keeps top dir a bit less crowded. And because these programs are
for testing purposes, it makes sense that they stay somewhere in t/

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: clean *.o files we createJunio C Hamano Fri, 15 Apr 2016 17:06:52 +0000 (10:06 -0700)

Makefile: clean *.o files we create

The part that removes object files in the 'clean' target predates
various Makefile macros that list object files we create, and
instead removes the objects with shell glob, perpetually requiring
updates whenever a new location that builds object files is added.

Simplify the target by removing $(OBJECTS), which is supposed to
have all the objects we create during the build.

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

Merge branch 'maint'Junio C Hamano Fri, 15 Apr 2016 01:59:09 +0000 (18:59 -0700)

Merge branch 'maint'

* maint:
Prepare for 2.8.2
Start preparing for 2.8.2

Prepare for 2.8.2Junio C Hamano Fri, 15 Apr 2016 01:58:11 +0000 (18:58 -0700)

Prepare for 2.8.2

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

Merge branch 'jv/merge-nothing-into-void' into maintJunio C Hamano Fri, 15 Apr 2016 01:57:49 +0000 (18:57 -0700)

Merge branch 'jv/merge-nothing-into-void' into maint

"git merge FETCH_HEAD" dereferenced NULL pointer when merging
nothing into an unborn history (which is arguably unusual usage,
which perhaps was the reason why nobody noticed it).

* jv/merge-nothing-into-void:
merge: fix NULL pointer dereference when merging nothing into void

Merge branch 'ss/commit-squash-msg' into maintJunio C Hamano Fri, 15 Apr 2016 01:57:48 +0000 (18:57 -0700)

Merge branch 'ss/commit-squash-msg' into maint

When "git merge --squash" stopped due to conflict, the concluding
"git commit" failed to read in the SQUASH_MSG that shows the log
messages from all the squashed commits.

* ss/commit-squash-msg:
commit: do not lose SQUASH_MSG contents