gitweb.git
imap-send: check NULL return of SSL_CTX_new()Kazuki Yamaguchi Fri, 8 Apr 2016 16:22:14 +0000 (01:22 +0900)

imap-send: check NULL return of SSL_CTX_new()

SSL_CTX_new() may fail with return value NULL.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

imap-send: use HMAC() function provided by OpenSSLKazuki Yamaguchi Fri, 8 Apr 2016 16:22:13 +0000 (01:22 +0900)

imap-send: use HMAC() function provided by OpenSSL

Fix compile errors with OpenSSL 1.1.0.

HMAC_CTX is made opaque and HMAC_CTX_cleanup is removed in OpenSSL
1.1.0. But since we just want to calculate one HMAC, we can use HMAC()
here, which exists since OpenSSL 0.9.6 at least.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

set_worktree_head_symref(): fix error messageKazuki Yamaguchi Fri, 8 Apr 2016 08:03:07 +0000 (17:03 +0900)

set_worktree_head_symref(): fix error message

Emit an informative error when failed to hold lock of HEAD.

2233066e (refs: add a new function set_worktree_head_symref,
2016-03-27) added set_worktree_head_symref(), but this is missing a
call to unable_to_lock_message() after hold_lock_file_for_update()
fails, so it emits an empty error message:

% git branch -m oldname newname
error:
error: HEAD of working tree /path/to/wt is not updated
fatal: Branch renamed to newname, but HEAD is not updated!

Thanks to Eric Sunshine for pointing this out.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: do not ignore an empty message given by -m ''Jeff King Thu, 7 Apr 2016 19:56:26 +0000 (12:56 -0700)

commit: do not ignore an empty message given by -m ''

When f9568530 (builtin-commit: resurrect behavior for multiple -m
options, 2007-11-11) converted a "char *message" to "struct strbuf
message" to hold the messages given with the "-m" option, it
incorrectly changed the checks "did we get a message with the -m
option?" to "is message.len 0?". Later, we noticed one breakage
from this change and corrected it with 25206778 (commit: don't start
editor if empty message is given with -m, 2013-05-25).

However, "we got a message with -m, even though an empty one, so we
shouldn't be launching an editor" was not the only breakage.

* "git commit --amend -m '' --allow-empty", even though it looks
strange, is a valid request to amend the commit to have no
message at all. Due to the misdetection of the presence of -m on
the command line, we ended up keeping the log messsage from the
original commit.

* "git commit -m "$msg" -F file" should be rejected whether $msg is
an empty string or not, but due to the same bug, was not rejected
when $msg is empty.

* "git -c template=file -m "$msg"" should ignore the template even
when $msg is empty, but it didn't and instead used the contents
from the template file.

Correct these by checking have_option_m, which the earlier 25206778
introduced to fix the same bug.

Reported-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: --amend -m '' silently fails to wipe messageAdam Dinwoodie Wed, 6 Apr 2016 17:15:03 +0000 (18:15 +0100)

commit: --amend -m '' silently fails to wipe message

`git commit --amend -m ''` seems to be an unambiguous request to blank a
commit message, but it actually leaves the commit message as-is. That's
the case regardless of whether `--allow-empty-message` is specified, and
doesn't so much as drop a non-zero return code.

Add failing tests to show this behaviour.

Signed-off-by: Adam Dinwoodie <adam@dinwoodie.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup.c: do not feed NULL to "%.*s" even with precision 0Junio C Hamano Thu, 7 Apr 2016 19:38:18 +0000 (12:38 -0700)

setup.c: do not feed NULL to "%.*s" even with precision 0

A recent update 75faa45a (replace trivial malloc + sprintf / strcpy
calls with xstrfmt, 2015-09-24) rewrote

prepare an empty buffer
if (len)
append the first len bytes of "prefix" to the buffer
append "path" to the buffer

that computed "path", optionally prefixed by "prefix", into

xstrfmt("%.*s%s", len, prefix, path);

However, passing a NULL pointer to the printf(3) family of functions
to format it with %s conversion, even with the precision set to 0,
i.e.

xstrfmt("%.*s", 0, NULL)

yields undefined results, at least on some platforms.

Avoid this problem by substituting prefix with "" when len==0, as
prefix can legally be NULL in that case. This would mimick the
intent of the original code better.

Reported-by: Tom G. Christensen <tgc@jupiterrise.com>
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

rerere: adjust 'forget' to multi-variant world orderJunio C Hamano Mon, 28 Mar 2016 21:48:13 +0000 (14:48 -0700)

rerere: adjust 'forget' to multi-variant world order

Because conflicts with the same contents inside conflict blocks
enclosed by "<<<<<<<" and ">>>>>>>" can now have multiple variants
to help three-way merge to adjust to the differences outside the
conflict blocks, "rerere forget $path" needs to be taught that there
may be multiple recorded resolutions that share the same conflict
hash (which groups the conflicts with "the same contents inside
conflict blocks"), among which there are some that would not be
relevant to the conflict we are looking at. These "other variants"
that happen to share the same conflict hash should not be cleared,
and the variant that would apply to the current conflict may not be
the zero-th one (which is the only one that is cleared by the
current code).

After finding the conflict hash, iterate over the existing variants
and try to resolve the conflict using each of them to find the one
that "cleanly" resolves the current conflict. That is the one we
want to forget and record the preimage for, so that the user can
record the corrected resolution.

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

rerere: split code to call ll_merge() furtherJunio C Hamano Fri, 11 Mar 2016 22:53:05 +0000 (14:53 -0800)

rerere: split code to call ll_merge() further

The merge() helper function is given an existing rerere ID (i.e. the
name of the .git/rr-cache/* subdirectory, and the variant number)
that identifies one <preimage, postimage> pair, try to see if the
conflicted state in the given path can be resolved by using the pair,
and if this succeeds, then update the conflicted path with the
result in the working tree.

To implement rerere_forget() in the multiple variant world, we'd
need a helper to do the "see if a <preimage, postimage> pair cleanly
resolves a conflicted state we have in-core" part, without actually
touching any file in the working tree, in order to identify which
variant(s) to remove. Split the logic to do so into a separate
helper function try_merge() out of merge().

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

rerere: move code related to "forget" togetherJunio C Hamano Mon, 14 Mar 2016 22:10:39 +0000 (15:10 -0700)

rerere: move code related to "forget" together

"rerere forget" is the only user of handle_cache() helper, which in
turn is the only user of rerere_io that reads from an in-core buffer
whose getline method is implemented as rerere_mem_getline(). Gather
them together.

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

rerere: gc and clearJunio C Hamano Tue, 8 Mar 2016 20:11:00 +0000 (12:11 -0800)

rerere: gc and clear

Adjust "git rerere gc" and "git rerere clear" to the new world order
with rerere database with multiple variants for the same shape of
conflicts.

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

send-email: do not load Data::DumperEric Wong Wed, 6 Apr 2016 20:25:38 +0000 (20:25 +0000)

send-email: do not load Data::Dumper

We never used Data::Dumper in this script. The only reference
of it was always commented out and removed over a decade ago in
commit 4bc87a28be020a6bf7387161c65ea3d8e4a0228b
("send-email: Change from Mail::Sendmail to Net::SMTP")

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

send-email: more meaningful Message-IDEric Wong Wed, 6 Apr 2016 20:07:14 +0000 (20:07 +0000)

send-email: more meaningful Message-ID

Using a YYYYmmddHHMMSS date representation is more meaningful to
humans, especially when used for lookups on NNTP servers or linking
to archive sites via Message-ID (e.g. mid.gmane.org or
mid.mail-archive.com). This timestamp format more easily gives a
reader of the URL itself a rough date of a linked message compared
to having them calculate the seconds since the Unix epoch.

Furthermore, having the MUA name in the Message-ID seems to be a
rare oddity I haven't noticed outside of git-send-email. We
already have an optional X-Mailer header field to advertise for
us, so extending the Message-ID by 15 characters can make for
unpleasant Message-ID-based URLs to archive sites.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Makefile: stop pretending to support rpmbuildJunio C Hamano Tue, 5 Apr 2016 06:42:41 +0000 (23:42 -0700)

Makefile: stop pretending to support rpmbuild

Nobody in the active development community seems to watch breakages
in the rpmbuild target. As most major RPM based distros use their
own specfile when packaging us, they aren't looking after us as
their pristine upstream tree, either. At this point, it is turning
to be a disservice to the users to pretend that our tree natively
supports "make rpmbuild" target when we do not properly maintain it.

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

Second batch for post 2.8 cycleJunio C Hamano Wed, 6 Apr 2016 18:44:24 +0000 (11:44 -0700)

Second batch for post 2.8 cycle

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

Merge branch 'la/tag-force-signing-annotated-tags'Junio C Hamano Wed, 6 Apr 2016 18:39:13 +0000 (11:39 -0700)

Merge branch 'la/tag-force-signing-annotated-tags'

"git tag" can create an annotated tag without explicitly given an
"-a" (or "-s") option (i.e. when a tag message is given). A new
configuration variable, tag.forceSignAnnotated, can be used to tell
the command to create signed tag in such a situation.

* la/tag-force-signing-annotated-tags:
tag: add the option to force signing of annotated tags

Merge branch 'jk/submodule-c-credential'Junio C Hamano Wed, 6 Apr 2016 18:39:12 +0000 (11:39 -0700)

Merge branch 'jk/submodule-c-credential'

"git -c credential.<var>=<value> submodule" can now be used to
propagate configuration variables related to credential helper
down to the submodules.

* jk/submodule-c-credential:
git_config_push_parameter: handle empty GIT_CONFIG_PARAMETERS
git: submodule honor -c credential.* from command line
quote: implement sq_quotef()
submodule: fix segmentation fault in submodule--helper clone
submodule: fix submodule--helper clone usage
submodule: check argc count for git submodule--helper clone
submodule: don't pass empty string arguments to submodule--helper clone

Merge branch 'jv/merge-nothing-into-void'Junio C Hamano Wed, 6 Apr 2016 18:39:11 +0000 (11:39 -0700)

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

"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'Junio C Hamano Wed, 6 Apr 2016 18:39:10 +0000 (11:39 -0700)

Merge branch 'ss/commit-squash-msg'

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

Merge branch 'sb/rebase-x'Junio C Hamano Wed, 6 Apr 2016 18:39:09 +0000 (11:39 -0700)

Merge branch 'sb/rebase-x'

"git rebase -x" can be used without passing "-i" option.

* sb/rebase-x:
t3404: cleanup double empty lines between tests
rebase: decouple --exec from --interactive

Merge branch 'jk/test-httpd-config-nosystem'Junio C Hamano Wed, 6 Apr 2016 18:39:08 +0000 (11:39 -0700)

Merge branch 'jk/test-httpd-config-nosystem'

The tests that involve running httpd leaked the system-wide
configuration in /etc/gitconfig to the tested environment.

* jk/test-httpd-config-nosystem:
t/lib-httpd: pass through GIT_CONFIG_NOSYSTEM env

Merge branch 'jk/send-email-rtrim-mailrc-alias'Junio C Hamano Wed, 6 Apr 2016 18:39:07 +0000 (11:39 -0700)

Merge branch 'jk/send-email-rtrim-mailrc-alias'

"git send-email" had trouble parsing alias file in mailrc format
when lines in it had trailing whitespaces on them.

* jk/send-email-rtrim-mailrc-alias:
send-email: ignore trailing whitespace in mailrc alias file

Merge branch 'jk/credential-cache-comment-exit'Junio C Hamano Wed, 6 Apr 2016 18:39:06 +0000 (11:39 -0700)

Merge branch 'jk/credential-cache-comment-exit'

A code clarification.

* jk/credential-cache-comment-exit:
credential-cache--daemon: clarify "exit" action semantics

Merge branch 'sb/clone-t57-t56'Junio C Hamano Wed, 6 Apr 2016 18:39:05 +0000 (11:39 -0700)

Merge branch 'sb/clone-t57-t56'

Rename bunch of tests on "git clone" for better organization.

* sb/clone-t57-t56:
clone tests: rename t57* => t56*

Merge branch 'ls/p4-map-user'Junio C Hamano Wed, 6 Apr 2016 18:39:05 +0000 (11:39 -0700)

Merge branch 'ls/p4-map-user'

"git p4" now allows P4 author names to be mapped to Git author
names.

* ls/p4-map-user:
git-p4: map a P4 user to Git author name and email address

Merge branch 'cc/doc-recommend-performance-trace-to... Junio C Hamano Wed, 6 Apr 2016 18:39:04 +0000 (11:39 -0700)

Merge branch 'cc/doc-recommend-performance-trace-to-file'

A minor documentation update.

* cc/doc-recommend-performance-trace-to-file:
Documentation: talk about pager in api-trace.txt

Merge branch 'pb/t7502-drop-dup'Junio C Hamano Wed, 6 Apr 2016 18:39:03 +0000 (11:39 -0700)

Merge branch 'pb/t7502-drop-dup'

Code clean-up.

* pb/t7502-drop-dup:
t/t7502 : drop duplicate test

Merge branch 'da/mergetool-delete-delete-conflict'Junio C Hamano Wed, 6 Apr 2016 18:39:02 +0000 (11:39 -0700)

Merge branch 'da/mergetool-delete-delete-conflict'

"git mergetool" did not work well with conflicts that both sides
deleted.

* da/mergetool-delete-delete-conflict:
mergetool: honor tempfile configuration when resolving delete conflicts
mergetool: support delete/delete conflicts

Merge branch 'sb/submodule-parallel-update'Junio C Hamano Wed, 6 Apr 2016 18:39:01 +0000 (11:39 -0700)

Merge branch 'sb/submodule-parallel-update'

A major part of "git submodule update" has been ported to C to take
advantage of the recently added framework to run download tasks in
parallel.

* sb/submodule-parallel-update:
clone: allow an explicit argument for parallel submodule clones
submodule update: expose parallelism to the user
submodule helper: remove double 'fatal: ' prefix
git submodule update: have a dedicated helper for cloning
run_processes_parallel: rename parameters for the callbacks
run_processes_parallel: treat output of children as byte array
submodule update: direct error message to stderr
fetching submodules: respect `submodule.fetchJobs` config option
submodule-config: drop check against NULL
submodule-config: keep update strategy around

Merge branch 'ss/receive-pack-parse-options'Junio C Hamano Wed, 6 Apr 2016 18:38:59 +0000 (11:38 -0700)

Merge branch 'ss/receive-pack-parse-options'

The command line argument parser for "receive-pack" has been
rewritten to use parse-options.

* ss/receive-pack-parse-options:
builtin/receive-pack.c: use parse_options API

Merge branch 'ss/exc-flag-is-a-collection-of-bits'Junio C Hamano Wed, 6 Apr 2016 18:38:59 +0000 (11:38 -0700)

Merge branch 'ss/exc-flag-is-a-collection-of-bits'

Code clean-up.

* ss/exc-flag-is-a-collection-of-bits:
dir: store EXC_FLAG_* values in unsigned integers

builtin/verify-tag.c: ignore SIGPIPE in gpg-interfaceSantiago Torres Tue, 5 Apr 2016 16:07:24 +0000 (12:07 -0400)

builtin/verify-tag.c: ignore SIGPIPE in gpg-interface

The verify_signed_buffer() function may trigger a SIGPIPE when the
GPG child process terminates early (due to a bad keyid, for example)
and Git tries to write to it afterwards. Previously, ignoring
SIGPIPE was done in builtin/verify-tag.c to avoid this issue.

However, any other caller who wants to call verify_signed_buffer()
would have to do the same.

Use sigchain_push(SIGPIPE, SIG_IGN) in verify_signed_buffer(),
pretty much like in sign_buffer(), so that any caller is not
required to perform this task.

This will avoid possible mistakes by further developers using
verify_signed_buffer().

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

correct blame for files commited with CRLFTorsten Bögershausen Tue, 5 Apr 2016 19:23:54 +0000 (21:23 +0200)

correct blame for files commited with CRLF

git blame reports lines as not "Not Committed Yet" when they have
CRLF in the index, CRLF in the worktree and core.autocrlf is true.

Since commit c4805393 (autocrlf: Make it work also for un-normalized
repositories, 2010-05-12), files that have CRLF in the index are not
normalized at commit when core.autocrl is set.

Add a call to read_cache() early in fake_working_tree_commit(),
before calling convert_to_git().

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

completion: complete --cherry-mark for git logMichael J Gruber Tue, 5 Apr 2016 10:45:35 +0000 (12:45 +0200)

completion: complete --cherry-mark for git log

Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

api-trace.txt: fix typoElia Pinto Tue, 5 Apr 2016 10:05:23 +0000 (10:05 +0000)

api-trace.txt: fix typo

The correct api is trace_printf_key(), not trace_print_key().

Also do not throw a random string at printf(3)-like function;
instead, feed it as a parameter that is fed to a "%s" conversion
specifier.

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

Makefile: fix misdirected redirectionsJunio C Hamano Tue, 5 Apr 2016 07:02:14 +0000 (00:02 -0700)

Makefile: fix misdirected redirections

In general "echo 2>&1 $msg" to redirect a possible error message
that comes from 'echo' itself into the same standard output stream
$msg is getting written to does not make any sense; it is not like
we are expecting to see any errors out of 'echo' in these statements,
and even if it were the case, there is no reason to prevent the
error messages from being sent to the standard error stream.

These are clearly meant to send the argument given to echo to the
standard error stream as error messages. Correctly redirect by
saying "send what is written to the standard output to the standard
error", i.e. "1>&2" aka ">&2".

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

branch: fix shortening of non-remote symrefsJeff King Sun, 3 Apr 2016 04:14:26 +0000 (00:14 -0400)

branch: fix shortening of non-remote symrefs

Commit aedcb7d (branch.c: use 'ref-filter' APIs, 2015-09-23)
adjusted the symref-printing code to look like this:

if (item->symref) {
skip_prefix(item->symref, "refs/remotes/", &desc);
strbuf_addf(&out, " -> %s", desc);
}

This has three bugs in it:

1. It always skips past "refs/remotes/", instead of
skipping past the prefix associated with the branch we
are showing (so commonly we see "refs/remotes/" for the
refs/remotes/origin/HEAD symref, but the previous code
would skip "refs/heads/" when showing a symref it found
in refs/heads/.

2. If skip_prefix() does not match, it leaves "desc"
untouched, and we show whatever happened to be in it
(which is the refname from a call to skip_prefix()
earlier in the function).

3. If we do match with skip_prefix(), we stomp on the
"desc" variable, which is later passed to
add_verbose_info(). We probably want to retain the
original refname there (though it likely doesn't matter
in practice, since after all, one points to the other).

The fix to match the original code is fairly easy: record
the prefix to strip based on item->kind, and use it here.
However, since we already have a local variable named "prefix",
let's give the two prefixes verbose names so we don't
confuse them.

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

pretty: test --expand-tabsJunio C Hamano Mon, 4 Apr 2016 23:09:18 +0000 (16:09 -0700)

pretty: test --expand-tabs

The test prepares a simple commit with HT on its log message lines,
and makes sure that

- formats that should or should not expand tabs by default do or do
not expand tabs respectively,

- with explicit --expand-tabs=<N> and short-hands --expand-tabs
(equivalent to --expand-tabs=8) and --no-expand-tabs (equivalent
to --expand-tabs=0) before or after the explicit --pretty=$fmt,
the tabs are expanded (or not expanded) accordingly.

The tests use the second line of the log message for formats other
than --pretty=short, primarily because the first line of the email
format is handled specially to add the [PATCH] prefix, etc. in a
separate codepath (--pretty=short uses the first line because there
is no other line to test).

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

Windows: shorten code by re-using convert_slashes()Johannes Sixt Sat, 2 Apr 2016 19:03:14 +0000 (21:03 +0200)

Windows: shorten code by re-using convert_slashes()

Make a few more spots more readable by using the recently introduced,
Windows-specific helper.

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

git-format-patch.txt: don't show -s as shorthand for... Eric Sunshine Sun, 27 Mar 2016 21:26:07 +0000 (17:26 -0400)

git-format-patch.txt: don't show -s as shorthand for multiple options

git-format-patch recognizes -s as shorthand only for --signoff, however,
its documentation shows -s as shorthand for both --signoff and
--no-patch. Resolve this confusion by suppressing the bogus -s shorthand
for --no-patch.

While here, also avoid showing the --no-patch option in git-format-patch
documentation since it doesn't make sense to ask to suppress the patch
while at the same time explicitly asking to format the patch (which,
after all, is the purpose of git-format-patch).

Reported-by: Kevin Brodsky <corax26@gmail.com>
Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

branch -m: update all per-worktree HEADsKazuki Yamaguchi Sun, 27 Mar 2016 14:37:14 +0000 (23:37 +0900)

branch -m: update all per-worktree HEADs

When renaming a branch, currently only the HEAD of current working tree
is updated, but it must update HEADs of all working trees which point at
the old branch.

This is the current behavior, /path/to/wt's HEAD is not updated:

% git worktree list
/path/to 2c3c5f2 [master]
/path/to/wt 2c3c5f2 [oldname]
% git branch -m master master2
% git worktree list
/path/to 2c3c5f2 [master2]
/path/to/wt 2c3c5f2 [oldname]
% git branch -m oldname newname
% git worktree list
/path/to 2c3c5f2 [master2]
/path/to/wt 0000000 [oldname]

This patch fixes this issue by updating all relevant worktree HEADs
when renaming a branch.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: add a new function set_worktree_head_symrefKazuki Yamaguchi Sun, 27 Mar 2016 14:37:13 +0000 (23:37 +0900)

refs: add a new function set_worktree_head_symref

Add a new function set_worktree_head_symref, to update HEAD symref for
the specified worktree.

To update HEAD of a linked working tree,
create_symref("worktrees/$work_tree/HEAD", "refs/heads/$branch", msg)
could be used. However when it comes to updating HEAD of the main
working tree, it is unusable because it uses $GIT_DIR for
worktree-specific symrefs (HEAD).

The new function takes git_dir (real directory) as an argument, and
updates HEAD of the working tree. This function will be used when
renaming a branch.

Signed-off-by: Kazuki Yamaguchi <k@rhe.jp>
Acked-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5520: test --[no-]autostash with pull.rebase=trueMehul Jain Sat, 2 Apr 2016 17:58:32 +0000 (23:28 +0530)

t5520: test --[no-]autostash with pull.rebase=true

The "--[no-]autostash" options for git-pull are only valid in
rebase mode (i.e. either --rebase is used or pull.rebase=true).
Existing tests already check the cases when --rebase is used but
fail to check for pull.rebase=true case.

Add two new tests to check that the --[no-]autostash options work
with pull.rebase=true.

Signed-off-by: Mehul Jain <mehul.jain2029@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5520: reduce commom lines of codeMehul Jain Sat, 2 Apr 2016 17:58:31 +0000 (23:28 +0530)

t5520: reduce commom lines of code

These two tests are almost similar and thus can be folded in a for-loop.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Mehul Jain <mehul.jain2029@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5520: factor out common "failing autostash" codeMehul Jain Sat, 2 Apr 2016 17:58:30 +0000 (23:28 +0530)

t5520: factor out common "failing autostash" code

Three tests contains repetitive lines of code.

Factor out common code into test_pull_autostash_fail() and then call it in
these tests.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Mehul Jain <mehul.jain2029@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5520: factor out common "successful autostash" codeMehul Jain Sat, 2 Apr 2016 17:58:29 +0000 (23:28 +0530)

t5520: factor out common "successful autostash" code

Four tests contains repetitive lines of code.

Factor out common code into test_pull_autostash() and then call it in
these tests.

Helped-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Mehul Jain <mehul.jain2029@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5520: use better test to check stderr outputMehul Jain Sat, 2 Apr 2016 17:58:28 +0000 (23:28 +0530)

t5520: use better test to check stderr output

Checking stderr output using test_i18ncmp may lead to test failure as
some shells write trace output to stderr when run under 'set -x'.

Use test_i18ngrep instead of test_i18ncmp.

Signed-off-by: Mehul Jain <mehul.jain2029@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5520: ensure consistent test conditionsMehul Jain Sat, 2 Apr 2016 17:58:27 +0000 (23:28 +0530)

t5520: ensure consistent test conditions

Test title says that tests are done with rebase.autostash unset,
but does not take any action to make sure that it is indeed unset.
This may lead to test failure if future changes somehow pollutes
the configuration globally.

Ensure consistent test conditions by explicitly unsetting
rebase.autostash.

Signed-off-by: Mehul Jain <mehul.jain2029@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t5520: use consistent capitalization in test titlesMehul Jain Sat, 2 Apr 2016 17:58:26 +0000 (23:28 +0530)

t5520: use consistent capitalization in test titles

Signed-off-by: Mehul Jain <mehul.jain2029@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetools: add support for ExamDiffJacob Nisnevich Fri, 25 Mar 2016 23:17:57 +0000 (16:17 -0700)

mergetools: add support for ExamDiff

Signed-off-by: Jacob Nisnevich <jacob.nisnevich@gmail.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mergetools: create mergetool_find_win32_cmd() helper... Jacob Nisnevich Fri, 25 Mar 2016 23:17:56 +0000 (16:17 -0700)

mergetools: create mergetool_find_win32_cmd() helper function for winmerge

Signed-off-by: Jacob Nisnevich <jacob.nisnevich@gmail.com>
Acked-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

First batch for post 2.8 cycleJunio C Hamano Sun, 3 Apr 2016 17:55:36 +0000 (10:55 -0700)

First batch for post 2.8 cycle

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

Sync with Git 2.8.1Junio C Hamano Sun, 3 Apr 2016 17:54:38 +0000 (10:54 -0700)

Sync with Git 2.8.1

Merge branch 'jk/startup-info'Junio C Hamano Sun, 3 Apr 2016 17:29:35 +0000 (10:29 -0700)

Merge branch 'jk/startup-info'

The startup_info data, which records if we are working inside a
repository (among other things), are now uniformly available to Git
subcommand implementations, and Git avoids attempting to touch
references when we are not in a repository.

* jk/startup-info:
use setup_git_directory() in test-* programs
grep: turn off gitlink detection for --no-index
mailmap: do not resolve blobs in a non-repository
remote: don't resolve HEAD in non-repository
setup: set startup_info->have_repository more reliably
setup: make startup_info available everywhere

Merge branch 'es/test-gpg-tags'Junio C Hamano Sun, 3 Apr 2016 17:29:35 +0000 (10:29 -0700)

Merge branch 'es/test-gpg-tags'

A test for tags has been restructured so that more parts of it can
easily be run on a platform without a working GnuPG.

* es/test-gpg-tags:
t6302: skip only signed tags rather than all tests when GPG is missing
t6302: also test annotated in addition to signed tags
t6302: normalize names and descriptions of signed tags
lib-gpg: drop unnecessary "missing GPG" warning

Merge branch 'jk/getwholeline-getdelim-empty'Junio C Hamano Sun, 3 Apr 2016 17:29:34 +0000 (10:29 -0700)

Merge branch 'jk/getwholeline-getdelim-empty'

strbuf_getwholeline() did not NUL-terminate the buffer on certain
corner cases in its error codepath.

* jk/getwholeline-getdelim-empty:
strbuf_getwholeline: NUL-terminate getdelim buffer on error

Merge branch 'rj/xdiff-prepare-plug-leak-on-error-codepath'Junio C Hamano Sun, 3 Apr 2016 17:29:33 +0000 (10:29 -0700)

Merge branch 'rj/xdiff-prepare-plug-leak-on-error-codepath'

A small memory leak in an error codepath has been plugged in xdiff
code.

* rj/xdiff-prepare-plug-leak-on-error-codepath:
xdiff/xprepare: fix a memory leak
xdiff/xprepare: use the XDF_DIFF_ALG() macro to access flag bits

Merge branch 'jc/index-pack'Junio C Hamano Sun, 3 Apr 2016 17:29:31 +0000 (10:29 -0700)

Merge branch 'jc/index-pack'

Code clean-up.

* jc/index-pack:
index-pack: add a helper function to derive .idx/.keep filename

Merge branch 'gf/fetch-pack-direct-object-fetch'Junio C Hamano Sun, 3 Apr 2016 17:29:29 +0000 (10:29 -0700)

Merge branch 'gf/fetch-pack-direct-object-fetch'

Fetching of history by naming a commit object name directly didn't
work across remote-curl transport.

* gf/fetch-pack-direct-object-fetch:
fetch-pack: update the documentation for "<refs>..." arguments
fetch-pack: fix object_id of exact sha1

Merge branch 'jc/maint-index-pack-keep'Junio C Hamano Sun, 3 Apr 2016 17:29:29 +0000 (10:29 -0700)

Merge branch 'jc/maint-index-pack-keep'

"git index-pack --keep[=<msg>] pack-$name.pack" simply did not work.

* jc/maint-index-pack-keep:
index-pack: correct --keep[=<msg>]

Merge branch 'mm/lockfile-error-message'Junio C Hamano Sun, 3 Apr 2016 17:29:27 +0000 (10:29 -0700)

Merge branch 'mm/lockfile-error-message'

* mm/lockfile-error-message:
lockfile: improve error message when lockfile exists
lockfile: mark strings for translation

Merge branch 'jk/rev-parse-local-env-vars'Junio C Hamano Sun, 3 Apr 2016 17:29:26 +0000 (10:29 -0700)

Merge branch 'jk/rev-parse-local-env-vars'

The "--local-env-vars" and "--resolve-git-dir" options of "git
rev-parse" failed to work outside a repository when the command's
option parsing was rewritten in 1.8.5 era.

* jk/rev-parse-local-env-vars:
rev-parse: let some options run outside repository
t1515: add tests for rev-parse out-of-repo helpers

Merge branch 'jk/config-get-urlmatch'Junio C Hamano Sun, 3 Apr 2016 17:29:26 +0000 (10:29 -0700)

Merge branch 'jk/config-get-urlmatch'

"git config --get-urlmatch", unlike other variants of the "git
config --get" family, did not signal error with its exit status
when there was no matching configuration.

* jk/config-get-urlmatch:
Documentation/git-config: fix --get-all description
Documentation/git-config: use bulleted list for exit codes
config: fail if --get-urlmatch finds no value

Merge branch 'jk/add-i-highlight'Junio C Hamano Sun, 3 Apr 2016 17:29:25 +0000 (10:29 -0700)

Merge branch 'jk/add-i-highlight'

* jk/add-i-highlight:
add--interactive: allow custom diff highlighting programs

Merge branch 'jk/credential-clear-config'Junio C Hamano Sun, 3 Apr 2016 17:29:24 +0000 (10:29 -0700)

Merge branch 'jk/credential-clear-config'

The credential.helper configuration variable is cumulative and
there is no good way to override it from the command line. As
a special case, giving an empty string as its value now serves
as the signal to clear the values specified in various files.

* jk/credential-clear-config:
credential: let empty credential specs reset helper list

Merge branch 'mp/upload-pack-use-embedded-args'Junio C Hamano Sun, 3 Apr 2016 17:29:23 +0000 (10:29 -0700)

Merge branch 'mp/upload-pack-use-embedded-args'

The embedded args argv-array in the child process is used to build
the command line to run pack-objects instead of using a separate
array of strings.

* mp/upload-pack-use-embedded-args:
upload-pack: use argv_array for pack_objects

Merge branch 'mm/diff-renames-default'Junio C Hamano Sun, 3 Apr 2016 17:29:22 +0000 (10:29 -0700)

Merge branch 'mm/diff-renames-default'

The end-user facing Porcelain level commands like "diff" and "log"
now enables the rename detection by default.

* mm/diff-renames-default:
diff: activate diff.renames by default
log: introduce init_log_defaults()
t: add tests for diff.renames (true/false/unset)
t4001-diff-rename: wrap file creations in a test
Documentation/diff-config: fix description of diff.renames

Merge branch 'mm/readme-markdown'Junio C Hamano Sun, 3 Apr 2016 17:27:22 +0000 (10:27 -0700)

Merge branch 'mm/readme-markdown'

Fix a few broken links in README.md and also teach rpmbuild
that there is no README.

* mm/readme-markdown:
README.md: don't take 'commandname' literally
git.spec.in: use README.md, not README

Git 2.8.1 v2.8.1Junio C Hamano Sun, 3 Apr 2016 17:11:35 +0000 (10:11 -0700)

Git 2.8.1

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

Merge branch 'mm/readme-markdown' into maintJunio C Hamano Sun, 3 Apr 2016 17:13:09 +0000 (10:13 -0700)

Merge branch 'mm/readme-markdown' into maint

* 'mm/readme-markdown':
git.spec.in: use README.md, not README

README.md: don't take 'commandname' literallyMatthieu Moy Sat, 27 Feb 2016 10:46:12 +0000 (11:46 +0100)

README.md: don't take 'commandname' literally

The link to Documentation/git-commandname.txt was obviously broken.
Remove the link and make it clear that it is not a literal path name by
using *italics* in makdown.

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

git.spec.in: use README.md, not READMEMatthieu Moy Fri, 1 Apr 2016 07:10:51 +0000 (09:10 +0200)

git.spec.in: use README.md, not README

The file was renamed in 4ad21f5 (README: use markdown syntax,
2016-02-25), but that commit forgot to update git.spec.in, which
caused the rpmbuild target in the Makefile to fail.

Reported-by: Ron Isaacson <isaacson.ljits@gmail.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ident: give "please tell me" message upon useConfigOnly... Marios Titas Wed, 30 Mar 2016 19:29:43 +0000 (22:29 +0300)

ident: give "please tell me" message upon useConfigOnly error

The env_hint message applies perfectly to the case when
user.useConfigOnly is set and at least one of the user.name and the
user.email are not provided.

Additionally, use a less descriptive error message to discourage
users from disabling user.useConfigOnly configuration variable to
work around this error condition. We want to encourage them to set
user.name or user.email instead.

Signed-off-by: Marios Titas <redneb@gmx.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ident: check for useConfigOnly before auto-detection... Marios Titas Wed, 30 Mar 2016 19:29:42 +0000 (22:29 +0300)

ident: check for useConfigOnly before auto-detection of name/email

If user.useConfigOnly is set, it does not make sense to try to
auto-detect the name and/or the email. The auto-detection may
even result in a bogus name and trigger an error message.

Check if the use-config-only is set and die if no explicit name was
given, before attempting to auto-detect, to correct this.

Signed-off-by: Marios Titas <redneb@gmx.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule--helper, module_clone: catch fprintf failureStefan Beller Fri, 1 Apr 2016 00:17:29 +0000 (17:17 -0700)

submodule--helper, module_clone: catch fprintf failure

The return value of fprintf is unchecked, which may lead to
unreported errors. Use fprintf_or_die to report the error to the user.

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

submodule--helper: do not borrow absolute_path() result... Junio C Hamano Fri, 1 Apr 2016 19:23:16 +0000 (12:23 -0700)

submodule--helper: do not borrow absolute_path() result for too long

absolute_path() is designed to allow its callers to take a brief
peek of the result (typically, to be fed to functions like
strbuf_add() and relative_path() as a parameter) without having to
worry about freeing it, but the other side of the coin of that
memory model is that the caller shouldn't rely too much on the
result living forever--there may be a helper function the caller
subsequently calls that makes its own call to absolute_path(),
invalidating the earlier result.

Use xstrdup() to make our own copy, and free(3) it when we are done.
While at it, remove an unnecessary sm_gitdir_rel variable that was
only used to as a parameter to call absolute_path() and never used
again.

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

submodule--helper, module_clone: always operate on... Stefan Beller Fri, 1 Apr 2016 00:17:28 +0000 (17:17 -0700)

submodule--helper, module_clone: always operate on absolute paths

When giving relative paths to `relative_path` to compute a relative path
from one directory to another, this may fail in `relative_path`.
Make sure both arguments to `relative_path` are always absolute.

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

credential-cache, send_request: close fd when doneStefan Beller Fri, 1 Apr 2016 00:35:46 +0000 (17:35 -0700)

credential-cache, send_request: close fd when done

No need to keep it open any further.

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

bundle: don't leak an fd in case of early returnStefan Beller Fri, 1 Apr 2016 00:35:45 +0000 (17:35 -0700)

bundle: don't leak an fd in case of early return

In successful operation `write_pack_data` will close the `bundle_fd`,
but when we exit early, we need to take care of the file descriptor
as well as the lock file ourselves. The lock file may be deleted at the
end of running the program, but we are in library code, so we should
not rely on that.

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

abbrev_sha1_in_line: don't leak memoryStefan Beller Fri, 1 Apr 2016 00:35:44 +0000 (17:35 -0700)

abbrev_sha1_in_line: don't leak memory

`split` is of type `struct strbuf **`, and currently we are leaking split
itself as well as each element in split[i]. We have a dedicated free
function for `struct strbuf **`, which takes care of freeing all
related memory.

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

notes: don't leak memory in git_config_get_notes_strategyStefan Beller Fri, 1 Apr 2016 00:35:43 +0000 (17:35 -0700)

notes: don't leak memory in git_config_get_notes_strategy

This function asks for the value of a configuration and after
using the value does not have to retain ownership of it.
git_config_get_string_const() however is a function to get a
copy of the value, but we forget to free it before we return.

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

builtin/apply: free patch when parse_chunk() failsChristian Couder Wed, 16 Mar 2016 19:35:11 +0000 (20:35 +0100)

builtin/apply: free patch when parse_chunk() fails

When parse_chunk() fails it can return -1, for example
when find_header() doesn't find a patch header.

In this case it's better in apply_patch() to free the
"struct patch" that we just allocated instead of
leaking it.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/apply: handle parse_binary() failureChristian Couder Fri, 18 Mar 2016 12:30:41 +0000 (13:30 +0100)

builtin/apply: handle parse_binary() failure

In parse_binary() there is:

forward = parse_binary_hunk(&buffer, &size, &status, &used);
if (!forward && !status)
/* there has to be one hunk (forward hunk) */
return error(_("unrecognized binary patch at line %d"), linenr-1);

so parse_binary() can return -1, because that's what error() returns.

Also parse_binary_hunk() sets "status" to -1 in case of error and
parse_binary() does "if (status) return status;".

In this case parse_chunk() should not add -1 to the patchsize it computes.
It is better for future libification efforts to make it just return -1.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

submodule--helper clone: create the submodule path... Stefan Beller Thu, 31 Mar 2016 21:04:38 +0000 (14:04 -0700)

submodule--helper clone: create the submodule path just once

We make sure that the parent directory of path exists (or create it
otherwise) and then do the same for path + "/.git".

That is equivalent to just making sure that the parent directory of
path + "/.git" exists (or create it otherwise).

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

submodule--helper: fix potential NULL-dereferenceStefan Beller Thu, 31 Mar 2016 21:04:37 +0000 (14:04 -0700)

submodule--helper: fix potential NULL-dereference

Don't dereference NULL 'path' if it was never assigned. Also
protect against an empty --path argument.

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

recursive submodules: test for relative pathsStefan Beller Thu, 31 Mar 2016 21:04:36 +0000 (14:04 -0700)

recursive submodules: test for relative paths

"git submodule update --init --recursive" uses full path to refer to
the true location of the repository in the "gitdir:" pointer for
nested submodules; the command used to use relative paths.

This was reported by Norio Nomura in $gmane/290280.

The root cause for that bug is in using recursive submodules as
their relative path handling was broken in ee8838d (2015-09-08,
submodule: rewrite `module_clone` shell function in C).

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

git-send-pack: fix --all option when used with directoryStanislav Kolotinskiy Thu, 31 Mar 2016 13:55:09 +0000 (16:55 +0300)

git-send-pack: fix --all option when used with directory

When using git send-pack with --all option
and a target repository specification ([<host>:]<directory>),
usage message is being displayed instead of performing
the actual transmission.

The reason for this issue is that destination and refspecs are being set
in the same conditional and are populated from argv. When a target
repository is passed, refspecs is being populated as well with its value.
This makes the check for refspecs not being NULL to always return true,
which, in conjunction with the check for --all or --mirror options,
is always true as well and returns usage message instead of proceeding.

This ensures that send-pack will stop execution only when --all
or --mirror switch is used in conjunction with any refspecs passed.

Signed-off-by: Stanislav Kolotinskiy <stanislav@assembla.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

for-each-ref: fix description of '--contains' in manpageSZEDER Gábor Wed, 30 Mar 2016 13:48:30 +0000 (15:48 +0200)

for-each-ref: fix description of '--contains' in manpage

'git for-each-ref's manpage says that '--contains' only lists tags,
but it lists all kinds of refs.

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

diffcore: fix iteration order of identical files during... SZEDER Gábor Wed, 30 Mar 2016 08:35:07 +0000 (10:35 +0200)

diffcore: fix iteration order of identical files during rename detection

If the two paths 'dir/A/file' and 'dir/B/file' have identical content
and the parent directory is renamed, e.g. 'git mv dir other-dir', then
diffcore reports the following exact renames:

renamed: dir/B/file -> other-dir/A/file
renamed: dir/A/file -> other-dir/B/file

While technically not wrong, this is confusing not only for the user,
but also for git commands that make decisions based on rename
information, e.g. 'git log --follow other-dir/A/file' follows
'dir/B/file' past the rename.

This behavior is a side effect of commit v2.0.0-rc4~8^2~14
(diffcore-rename.c: simplify finding exact renames, 2013-11-14): the
hashmap storing sources returns entries from the same bucket, i.e.
sources matching the current destination, in LIFO order. Thus the
iteration first examines 'other-dir/A/file' and 'dir/B/file' and, upon
finding identical content and basename, reports an exact rename.

Other hashmap users are apparently happy with the current iteration
order over the entries of a bucket. Changing the iteration order
would risk upsetting other hashmap users and would increase the memory
footprint of each bucket by a pointer to the tail element.

Fill the hashmap with source entries in reverse order to restore the
original exact rename detection behavior.

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

t7407: make expectation as clear as possibleStefan Beller Wed, 30 Mar 2016 01:27:46 +0000 (18:27 -0700)

t7407: make expectation as clear as possible

Not everyone (including me) grasps the sed expression in a split second as
they would grasp the 4 lines printed as is.

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

submodule update: test recursive path reporting from... Stefan Beller Wed, 30 Mar 2016 01:27:45 +0000 (18:27 -0700)

submodule update: test recursive path reporting from subdirectory

This patch is just a test and fixes no bug as there is currently no bug
in the path handling of `submodule update`.

In `submodule update` we make a call to `submodule--helper list --prefix
"$wt_prefix"` which looks a bit brittle and likely to introduce a bug
for the path handling. It is not a bug as the prefix is ignored inside
the submodule helper for now. If this test breaks eventually, we want
to make sure the `wt_prefix` is passed correctly into recursive submodules.
Hint: In recursive submodules we expect `wt_prefix` to be empty.

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

submodule update: align reporting path for custom comma... Stefan Beller Wed, 30 Mar 2016 01:27:44 +0000 (18:27 -0700)

submodule update: align reporting path for custom command execution

In the predefined actions (merge, rebase, none, checkout), we use
the display path, which is relative to the current working directory.
Also use the display path when running a custom command.

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

submodule status: correct path handling in recursive... Stefan Beller Wed, 30 Mar 2016 01:27:43 +0000 (18:27 -0700)

submodule status: correct path handling in recursive submodules

The new test which is a replica of the previous test except
that it executes from a sub directory. Prior to this patch
the test failed by having too many '../' prefixed:

--- expect 2016-03-29 19:02:33.087336115 +0000
+++ actual 2016-03-29 19:02:33.359343311 +0000
@@ -1,7 +1,7 @@
b23f134787d96fae589a6b76da41f4db112fc8db ../nested1 (heads/master)
-+25d56d1ddfb35c3e91ff7d8f12331c2e53147dcc ../nested1/nested2 (file2)
- 5ec83512b76a0b8170b899f8e643913c3e9b72d9 ../nested1/nested2/nested3 (heads/master)
- 509f622a4f36a3e472affcf28fa959174f3dd5b5 ../nested1/nested2/nested3/submodule (heads/master)
++25d56d1ddfb35c3e91ff7d8f12331c2e53147dcc ../../nested1/nested2 (file2)
+ 5ec83512b76a0b8170b899f8e643913c3e9b72d9 ../../../nested1/nested2/nested3 (heads/master)
+ 509f622a4f36a3e472affcf28fa959174f3dd5b5 ../../../../nested1/nested2/nested3/submodule (heads/master)
0c90624ab7f1aaa301d3bb79f60dcfed1ec4897f ../sub1 (0c90624)
0c90624ab7f1aaa301d3bb79f60dcfed1ec4897f ../sub2 (0c90624)
509f622a4f36a3e472affcf28fa959174f3dd5b5 ../sub3 (heads/master)

The path code in question:
displaypath=$(relative_path "$prefix$sm_path")
prefix=$displaypath
if recursive:
eval cmd_status

That way we change `prefix` each iteration to contain another
'../', because of the the relative_path computation is done
on an already computed relative path.

We must call relative_path exactly once with `wt_prefix` non empty.
Further calls in recursive instances to to calculate the displaypath
already incorporate the correct prefix from before. Fix the issue by
clearing `wt_prefix` in recursive calls.

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

submodule update --init: correct path handling in recur... Stefan Beller Wed, 30 Mar 2016 01:27:42 +0000 (18:27 -0700)

submodule update --init: correct path handling in recursive submodules

When calling `git submodule init` from a recursive instance of
`git submodule update --recursive`, the reported path is wrong as it
skips the nested submodules.

The new test demonstrates a failure in the code prior to this patch.
Instead of getting the expected
Submodule 'submodule' (${pwd}/submodule) registered for path '../super/submodule'
the `super` directory is omitted and you get
Submodule 'submodule' (${pwd}/submodule) registered for path '../submodule'
instead.

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

submodule foreach: correct path display in recursive... Stefan Beller Wed, 30 Mar 2016 01:27:41 +0000 (18:27 -0700)

submodule foreach: correct path display in recursive submodules

The `prefix` was put in front of the display path unconditionally.
This is wrong as any relative path computation would need to be at
the front, so include the prefix into the display path.

The new test replicates the previous test with the difference of executing
from a sub directory. By executing from a sub directory all we would
expect all displayed paths to be prefixed by '../'.

Prior to this patch the test would report
Entering 'nested1/nested2/../nested3'
instead of the expected
Entering '../nested1/nested2/nested3'

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

pretty: allow tweaking tabwidth in --expand-tabsJunio C Hamano Tue, 29 Mar 2016 23:05:39 +0000 (16:05 -0700)

pretty: allow tweaking tabwidth in --expand-tabs

When the local convention of the project is to use tab width that is
not 8, it may make sense to allow "git log --expand-tabs=<n>" to
tweak the output to match it.

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

pretty: enable --expand-tabs by default for selected... Junio C Hamano Tue, 29 Mar 2016 22:49:24 +0000 (15:49 -0700)

pretty: enable --expand-tabs by default for selected pretty formats

"git log --pretty={medium,full,fuller}" and "git log" by default
prepend 4 spaces to the log message, so it makes sense to enable
the new "expand-tabs" facility by default for these formats.
Add --no-expand-tabs option to override the new default.

The change alone breaks a test in t4201 that runs "git shortlog"
on the output from "git log", and expects that the output from
"git log" does not do such a tab expansion. Adjust the test to
explicitly disable expand-tabs with --no-expand-tabs.

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

pretty: expand tabs in indented logs to make things... Linus Torvalds Wed, 16 Mar 2016 16:15:53 +0000 (09:15 -0700)

pretty: expand tabs in indented logs to make things line up properly

A commit log message sometimes tries to line things up using tabs,
assuming fixed-width font with the standard 8-place tab settings.
Viewing such a commit however does not work well in "git log", as
we indent the lines by prefixing 4 spaces in front of them.

This should all line up:

Column 1 Column 2
-------- --------
A B
ABCD EFGH
SPACES Instead of Tabs

Even with multi-byte UTF8 characters:

Column 1 Column 2
-------- --------
Ä B
åäö 100
A Møøse once bit my sister..

Tab-expand the lines in "git log --expand-tabs" output before
prefixing 4 spaces.

This is based on the patch by Linus Torvalds, but at this step, we
require an explicit command line option to enable the behaviour.

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

MSVC: use shipped headers instead of fallback definitionsSven Strickroth Wed, 30 Mar 2016 11:37:36 +0000 (13:37 +0200)

MSVC: use shipped headers instead of fallback definitions

VS2010 comes with stdint.h [1]
VS2013 comes with inttypes.h [2]

[1] https://stackoverflow.com/a/2628014/3906760
[2] https://blogs.msdn.microsoft.com/vcblog/2013/07/19/c99-library-support-in-visual-studio-2013/

Signed-off-by: Sven Strickroth <sven@cs-ware.de>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

MSVC: vsnprintf in Visual Studio 2015 doesn't need... Sven Strickroth Tue, 29 Mar 2016 16:25:28 +0000 (18:25 +0200)

MSVC: vsnprintf in Visual Studio 2015 doesn't need SNPRINTF_SIZE_CORR any more

In MSVC2015 the behavior of vsnprintf was changed.
W/o this fix there is one character missing at the end.

Signed-off-by: Sven Strickroth <sven@cs-ware.de>
Acked-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation: git diff --check detects conflict markersOri Avtalion Tue, 29 Mar 2016 18:59:45 +0000 (21:59 +0300)

Documentation: git diff --check detects conflict markers

Signed-off-by: Ori Avtalion <ori@avtalion.name>
Signed-off-by: Junio C Hamano <gitster@pobox.com>