gitweb.git
Merge branch 'pt/am-abort-fix' into maintJunio C Hamano Mon, 3 Aug 2015 17:41:32 +0000 (10:41 -0700)

Merge branch 'pt/am-abort-fix' into maint

Various fixes around "git am" that applies a patch to a history
that is not there yet.

* pt/am-abort-fix:
am --abort: keep unrelated commits on unborn branch
am --abort: support aborting to unborn branch
am --abort: revert changes introduced by failed 3way merge
am --skip: support skipping while on unborn branch
am -3: support 3way merge on unborn branch
am --skip: revert changes introduced by failed 3way merge

Merge branch 'mh/reporting-broken-refs-from-for-each... Junio C Hamano Mon, 3 Aug 2015 17:41:31 +0000 (10:41 -0700)

Merge branch 'mh/reporting-broken-refs-from-for-each-ref' into maint

"git for-each-ref" reported "missing object" for 0{40} when it
encounters a broken ref. The lack of object whose name is 0{40} is
not the problem; the ref being broken is.

* mh/reporting-broken-refs-from-for-each-ref:
read_loose_refs(): treat NULL_SHA1 loose references as broken
read_loose_refs(): simplify function logic
for-each-ref: report broken references correctly
t6301: new tests of for-each-ref error handling

Merge branch 'sg/commit-cleanup-scissors' into maintJunio C Hamano Mon, 3 Aug 2015 17:41:30 +0000 (10:41 -0700)

Merge branch 'sg/commit-cleanup-scissors' into maint

"git commit --cleanup=scissors" was not careful enough to protect
against getting fooled by a line that looked like scissors.

* sg/commit-cleanup-scissors:
commit: cope with scissors lines in commit message

ref-filter: make 'ref_array_item' use a FLEX_ARRAY... Karthik Nayak Sat, 13 Jun 2015 19:37:29 +0000 (01:07 +0530)

ref-filter: make 'ref_array_item' use a FLEX_ARRAY for refname

This would remove the need of using a pointer to store refname.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

for-each-ref: introduce filter_refs()Karthik Nayak Sat, 13 Jun 2015 19:37:28 +0000 (01:07 +0530)

for-each-ref: introduce filter_refs()

Introduce filter_refs() which will act as an API for filtering
a set of refs. Based on the type of refs the user has requested,
we iterate through those refs and apply filters as per the
given ref_filter structure and finally store the filtered refs
in the ref_array structure.

Currently this will wrap around ref_filter_handler(). Hence,
ref_filter_handler is made file scope static.

As users of this API will no longer send a ref_filter_cbdata
structure directly, we make the elements of ref_filter_cbdata
pointers. We can now use the information given by the users
to obtain our own ref_filter_cbdata structure. Changes are made to
support the change in ref_filter_cbdata structure.

Make 'for-each-ref' use this API.

Helped-by: Junio C Hamano <gitster@pobox.com>
Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

ref-filter: move code from 'for-each-ref'Karthik Nayak Sat, 13 Jun 2015 19:37:27 +0000 (01:07 +0530)

ref-filter: move code from 'for-each-ref'

Move most of the code from 'for-each-ref' to 'ref-filter' to make
it publicly available to other commands, this is to unify the code
of 'tag -l', 'branch -l' and 'for-each-ref' so that they can share
their implementations with each other.

Add 'ref-filter' to the Makefile, this completes the movement of code
from 'for-each-ref' to 'ref-filter'.

Mentored-by: Christian Couder <christian.couder@gmail.com>
Mentored-by: Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Signed-off-by: Karthik Nayak <karthik.188@gmail.com>
Reviewed-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

untracked-cache: support sparse checkoutDavid Turner Fri, 31 Jul 2015 17:35:01 +0000 (13:35 -0400)

untracked-cache: support sparse checkout

Remove a check that would disable the untracked cache for sparse
checkouts. Add tests that ensure that the untracked cache works with
sparse checkouts -- specifically considering the case that a file
foo/bar is checked out, but foo/.gitignore is not.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

sequencer: replace write_cherry_pick_head with update_refDavid Turner Fri, 31 Jul 2015 06:06:21 +0000 (02:06 -0400)

sequencer: replace write_cherry_pick_head with update_ref

Now update_ref (via write_pseudoref) does almost exactly what
write_cherry_pick_head did, so we can remove write_cherry_pick_head
and just use update_ref.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bisect: use update_refDavid Turner Fri, 31 Jul 2015 06:06:20 +0000 (02:06 -0400)

bisect: use update_ref

Instead of manually writing a pseudoref (in one case) and shelling out
to git update-ref (in another), use the update_ref function. This
is much simpler.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pseudorefs: create and use pseudoref update and delete... David Turner Fri, 31 Jul 2015 06:06:19 +0000 (02:06 -0400)

pseudorefs: create and use pseudoref update and delete functions

Pseudorefs should not be updated through the ref transaction
API, because alternate ref backends still need to store pseudorefs
in GIT_DIR (instead of wherever they store refs). Instead,
change update_ref and delete_ref to call pseudoref-specific
functions.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: add ref_type functionDavid Turner Fri, 31 Jul 2015 06:06:18 +0000 (02:06 -0400)

refs: add ref_type function

Add a function ref_type, which categorizes refs as per-worktree,
pseudoref, or normal ref.

Later, we will use this in refs.c to treat pseudorefs specially.
Alternate ref backends may use it to treat both pseudorefs and
per-worktree refs differently.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: introduce pseudoref and per-worktree ref conceptsDavid Turner Fri, 31 Jul 2015 06:06:17 +0000 (02:06 -0400)

refs: introduce pseudoref and per-worktree ref concepts

Add glossary entries for both concepts.

Pseudorefs and per-worktree refs do not yet have special handling,
because the files refs backend already handles them correctly. Later,
we will make the LMDB backend call out to the files backend to handle
per-worktree refs.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

add: remove dead codeStefan Beller Fri, 31 Jul 2015 00:19:16 +0000 (17:19 -0700)

add: remove dead code

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

pull.sh: quote $upload_pack when passing it to git... Matthieu Moy Thu, 30 Jul 2015 20:40:03 +0000 (22:40 +0200)

pull.sh: quote $upload_pack when passing it to git-fetch

The previous code broke for example

git pull --upload-pack 'echo --foo'

Reported-by: Joey Hess <id@joeyh.name>
Fix-suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

parse-options: align curly braces for all optionsStefan Beller Wed, 29 Jul 2015 20:18:37 +0000 (13:18 -0700)

parse-options: align curly braces for all options

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

get_remote_group(): use skip_prefix()Michael Haggerty Tue, 28 Jul 2015 21:08:21 +0000 (23:08 +0200)

get_remote_group(): use skip_prefix()

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

get_remote_group(): eliminate superfluous call to strcspn()Michael Haggerty Tue, 28 Jul 2015 21:08:20 +0000 (23:08 +0200)

get_remote_group(): eliminate superfluous call to strcspn()

There is no need to call it if value is the empty string. This also
eliminates code duplication.

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

get_remote_group(): rename local variable "space" to... Michael Haggerty Tue, 28 Jul 2015 21:08:19 +0000 (23:08 +0200)

get_remote_group(): rename local variable "space" to "wordlen"

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

get_remote_group(): handle remotes with single-characte... Michael Haggerty Tue, 28 Jul 2015 21:08:18 +0000 (23:08 +0200)

get_remote_group(): handle remotes with single-character names

The code for splitting a whitespace-separated list of values in
"remotes.<name>" had an off-by-one error that caused it to skip over
remotes whose names consist of a single character.

Also remove unnecessary braces.

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

unpack-trees: populate cache-tree on successful mergeBrian Degenhardt Tue, 28 Jul 2015 19:30:40 +0000 (15:30 -0400)

unpack-trees: populate cache-tree on successful merge

When we unpack trees into an existing index, we discard the old
index and replace it with the new, merged index. Ensure that this
index has its cache-tree populated. This will make subsequent git
status and commit commands faster.

Signed-off-by: Brian Degenhardt <bmd@bmdhacks.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/config: mention "now" and "never" for... Eric Sunshine Tue, 28 Jul 2015 20:06:10 +0000 (16:06 -0400)

Documentation/config: mention "now" and "never" for 'expire' settings

In addition to approxidate-style values ("2.months.ago", "yesterday"),
consumers of 'gc.*expire*' configuration variables also accept and
respect 'now' ("do it immediately") and 'never' ("suppress entirely").

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

Documentation/git-tools: retire manually-maintained... Eric Sunshine Tue, 28 Jul 2015 20:06:15 +0000 (16:06 -0400)

Documentation/git-tools: retire manually-maintained list

When Git was young, people looking for third-party Git-related tools
came to the Git project itself to find them, so it made sense to
maintain a list of tools here. These days, however, search engines fill
that role much more efficiently, so retire the manually-maintained
list.

The list of front-ends and tools on the Git wiki rates perhaps a distant
second to search engines, and may still have value, so retain a
reference to it.

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

Documentation/git-tools: drop references to defunct... Eric Sunshine Tue, 28 Jul 2015 20:06:14 +0000 (16:06 -0400)

Documentation/git-tools: drop references to defunct tools

Cogito -- unmaintained since late 2006[1]
pg -- URL dead; web searches reveal no information
quilt2git -- URL dead; web searches reveal no information
(h)gct -- URL dead; no repository activity since 2007[2]

[1]: http://git.or.cz/cogito/
[2]: http://repo.or.cz/w/hgct.git

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

Documentation/git-tools: fix item text formattingEric Sunshine Tue, 28 Jul 2015 20:06:13 +0000 (16:06 -0400)

Documentation/git-tools: fix item text formatting

Descriptive text for each tool item is incorrectly formatted using a
fixed width font. Fix formatting to use a variable width font by
unindenting the item text.

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

Documentation/git-tools: improve discoverability of... Eric Sunshine Tue, 28 Jul 2015 20:06:12 +0000 (16:06 -0400)

Documentation/git-tools: improve discoverability of Git wiki

These days, the best way to find Git-related tools is via a search
engine. The Git wiki may be a distant second, and git-tools.txt falls in
last place. Therefore, promote the Git wiki reference to the top of
git-tools.txt so the reader will encounter it first, rather than hiding
it away at the very bottom.

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

docs/config.txt: reorder hideRefs configJeff King Tue, 28 Jul 2015 19:59:11 +0000 (15:59 -0400)

docs/config.txt: reorder hideRefs config

The descriptions for receive.hideRefs and
uploadpack.hideRefs are largely the same, and then
transfer.hideRefs refers to both of them. Instead, let's
make transfer.hideRefs the "master" source, and refer to it
from the other sites (with appropriate program-specific
annotations).

This avoids duplication, and will make it easier to document
changes to the config option without having to copy and
paste the description in two places.

While we're at it, this fixes some bogus subject/verb
agreement in the original description.

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

tests: remove some direct access to .git/logsDavid Turner Mon, 27 Jul 2015 22:57:08 +0000 (18:57 -0400)

tests: remove some direct access to .git/logs

Alternate refs backends might store reflogs somewhere other than
.git/logs. Change most test code that directly accesses .git/logs to
instead use git reflog commands.

There are still a few tests which need direct access to reflogs: to
check reflog permissions, to manually create reflogs from scratch, to
save/restore reflogs, to check the format of raw reflog data, and to
remove not just reflog contents, but the reflogs themselves. All cases
which don't need direct access have been modified.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t/t7509: remove unnecessary manipulation of reflogDavid Turner Mon, 27 Jul 2015 22:57:07 +0000 (18:57 -0400)

t/t7509: remove unnecessary manipulation of reflog

Remove unnecessary reflog manipulation. The test does not rely in any
way on this reflog manipulation, and the case that the test
exercises is unrelated to reflogs.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

typofix for index-format.txtThomas Ackermann Tue, 28 Jul 2015 17:45:14 +0000 (19:45 +0200)

typofix for index-format.txt

Signed-off-by: Thomas Ackermann <th.acker@arcor.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.5 v2.5.0Junio C Hamano Mon, 27 Jul 2015 19:29:47 +0000 (12:29 -0700)

Git 2.5

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

Sync with 2.4.7Junio C Hamano Mon, 27 Jul 2015 19:26:36 +0000 (12:26 -0700)

Sync with 2.4.7

Git 2.4.7 v2.4.7Junio C Hamano Mon, 27 Jul 2015 19:25:42 +0000 (12:25 -0700)

Git 2.4.7

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

Merge branch 'jk/pretty-encoding-doc' into maintJunio C Hamano Mon, 27 Jul 2015 19:21:48 +0000 (12:21 -0700)

Merge branch 'jk/pretty-encoding-doc' into maint

Doc update.

* jk/pretty-encoding-doc:
docs: clarify that --encoding can produce invalid sequences

Merge branch 'tb/checkout-doc' into maintJunio C Hamano Mon, 27 Jul 2015 19:21:47 +0000 (12:21 -0700)

Merge branch 'tb/checkout-doc' into maint

Doc update.

* tb/checkout-doc:
git-checkout.txt: document "git checkout <pathspec>" better

Merge branch 'ls/hint-rev-list-count' into maintJunio C Hamano Mon, 27 Jul 2015 19:21:47 +0000 (12:21 -0700)

Merge branch 'ls/hint-rev-list-count' into maint

* ls/hint-rev-list-count:
rev-list: add --count to usage guide

Merge branch 'mm/branch-doc-updates' into maintJunio C Hamano Mon, 27 Jul 2015 19:21:46 +0000 (12:21 -0700)

Merge branch 'mm/branch-doc-updates' into maint

* mm/branch-doc-updates:
Documentation/branch: document -M and -D in terms of --force
Documentation/branch: document -d --force and -m --force

Merge branch 'jc/fsck-retire-require-eoh' into maintJunio C Hamano Mon, 27 Jul 2015 19:21:45 +0000 (12:21 -0700)

Merge branch 'jc/fsck-retire-require-eoh' into maint

A fix to a minor regression to "git fsck" in v2.2 era that started
complaining about a body-less tag object when it lacks a separator
empty line after its header to separate it with a non-existent body.

* jc/fsck-retire-require-eoh:
fsck: it is OK for a tag and a commit to lack the body

Merge branch 'et/http-proxyauth' into maintJunio C Hamano Mon, 27 Jul 2015 19:21:44 +0000 (12:21 -0700)

Merge branch 'et/http-proxyauth' into maint

We used to ask libCURL to use the most secure authentication method
available when talking to an HTTP proxy only when we were told to
talk to one via configuration variables. We now ask libCURL to
always use the most secure authentication method, because the user
can tell libCURL to use an HTTP proxy via an environment variable
without using configuration variables.

* et/http-proxyauth:
http: always use any proxy auth method available

Merge branch 'jc/unexport-git-pager-in-use-in-pager... Junio C Hamano Mon, 27 Jul 2015 19:21:43 +0000 (12:21 -0700)

Merge branch 'jc/unexport-git-pager-in-use-in-pager' into maint

When you say "!<ENTER>" while running say "git log", you'd confuse
yourself in the resulting shell, that may look as if you took
control back to the original shell you spawned "git log" from but
that isn't what is happening. To that new shell, we leaked
GIT_PAGER_IN_USE environment variable that was meant as a local
communication between the original "Git" and subprocesses that was
spawned by it after we launched the pager, which caused many
"interesting" things to happen, e.g. "git diff | cat" still paints
its output in color by default.

Stop leaking that environment variable to the pager's half of the
fork; we only need it on "Git" side when we spawn the pager.

* jc/unexport-git-pager-in-use-in-pager:
pager: do not leak "GIT_PAGER_IN_USE" to the pager

Merge branch 'mh/strbuf-read-file-returns-ssize-t'... Junio C Hamano Mon, 27 Jul 2015 19:21:43 +0000 (12:21 -0700)

Merge branch 'mh/strbuf-read-file-returns-ssize-t' into maint

Avoid possible ssize_t to int truncation.

* mh/strbuf-read-file-returns-ssize-t:
strbuf: strbuf_read_file() should return ssize_t

Merge branch 'kb/config-unmap-before-renaming' into... Junio C Hamano Mon, 27 Jul 2015 19:21:42 +0000 (12:21 -0700)

Merge branch 'kb/config-unmap-before-renaming' into maint

"git config" failed to update the configuration file when the
underlying filesystem is incapable of renaming a file that is still
open.

* kb/config-unmap-before-renaming:
config.c: fix writing config files on Windows network shares

Merge branch 'jk/rev-list-no-bitmap-while-pruning'... Junio C Hamano Mon, 27 Jul 2015 19:21:42 +0000 (12:21 -0700)

Merge branch 'jk/rev-list-no-bitmap-while-pruning' into maint

A minor bugfix when pack bitmap is used with "rev-list --count".

* jk/rev-list-no-bitmap-while-pruning:
rev-list: disable --use-bitmap-index when pruning commits

Merge branch 'rh/test-color-avoid-terminfo-in-original... Junio C Hamano Mon, 27 Jul 2015 19:21:41 +0000 (12:21 -0700)

Merge branch 'rh/test-color-avoid-terminfo-in-original-home' into maint

An ancient test framework enhancement to allow color was not
entirely correct; this makes it work even when tput needs to read
from the ~/.terminfo under the user's real HOME directory.

* rh/test-color-avoid-terminfo-in-original-home:
test-lib.sh: fix color support when tput needs ~/.terminfo
Revert "test-lib.sh: do tests for color support after changing HOME"

Merge branch 'jk/fix-refresh-utime' into maintJunio C Hamano Mon, 27 Jul 2015 19:21:40 +0000 (12:21 -0700)

Merge branch 'jk/fix-refresh-utime' into maint

Fix a small bug in our use of umask() return value.

* jk/fix-refresh-utime:
check_and_freshen_file: fix reversed success-check

Merge branch 'cb/rebase-am-exit-code' into maintJunio C Hamano Mon, 27 Jul 2015 19:21:39 +0000 (12:21 -0700)

Merge branch 'cb/rebase-am-exit-code' into maint

"git rebase" did not exit with failure when format-patch it invoked
failed for whatever reason.

* cb/rebase-am-exit-code:
rebase: return non-zero error code if format-patch fails

Merge branch 'jk/index-pack-reduce-recheck' into maintJunio C Hamano Mon, 27 Jul 2015 19:21:38 +0000 (12:21 -0700)

Merge branch 'jk/index-pack-reduce-recheck' into maint

Disable "have we lost a race with competing repack?" check while
receiving a huge object transfer that runs index-pack.

* jk/index-pack-reduce-recheck:
index-pack: avoid excessive re-reading of pack directory

refs: loosen restriction on wildcard "*" refspecsJacob Keller Wed, 22 Jul 2015 21:05:33 +0000 (14:05 -0700)

refs: loosen restriction on wildcard "*" refspecs

Loosen restrictions on refspecs by allowing patterns that have a "*"
within a component instead of only as the whole component.

Remove the logic to accept a single "*" as a whole component from
check_refname_format(), and implement an extended form of that logic
in check_refname_component(). Pass the pointer to the flags argument
to the latter, as it has to clear REFNAME_REFSPEC_PATTERN bit when
it sees "*".

Teach check_refname_component() function to allow an asterisk "*"
only when REFNAME_REFSPEC_PATTERN is set in the flags, and drop the
bit after seeing a "*", to ensure that one side of a refspec
contains at most one asterisk.

This will allow us to accept refspecs such as `for/bar*:foo/baz*`.
Any refspec which functioned before shall continue functioning with
the new logic.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: cleanup comments regarding check_refname_component()Jacob Keller Wed, 22 Jul 2015 21:05:32 +0000 (14:05 -0700)

refs: cleanup comments regarding check_refname_component()

Correctly specify all characters which are rejected under the '4: a
bad character' disposition, which did not list all characters that
are treated as such.

Cleanup comment style for rejected refs by inserting a ", or" at the
end of each statement.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Documentation/git: drop outdated Cogito referenceEric Sunshine Fri, 24 Jul 2015 04:00:54 +0000 (00:00 -0400)

Documentation/git: drop outdated Cogito reference

Cogito hasn't been maintained since late 2006, so drop the reference
to it. The warning that SCMS front-ends might override listed
environment variables, however, may still be valuable, so keep it but
generalize the wording.

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

RelNotes: am.threeWay does not exist (yet)Junio C Hamano Fri, 24 Jul 2015 21:31:23 +0000 (14:31 -0700)

RelNotes: am.threeWay does not exist (yet)

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

Revert "git-am: add am.threeWay config variable"Junio C Hamano Fri, 24 Jul 2015 17:55:24 +0000 (10:55 -0700)

Revert "git-am: add am.threeWay config variable"

This reverts commit d96a275b91bae1800cd43be0651e886e7e042a17.

It used to be possible to apply a patch series with "git am mbox"
and then only after seeing a failure, switch to three-way mode via
"git am -3" (no other options or arguments). The commit being
reverted broke this workflow.

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

Documentation/git-worktree: fix broken 'linkgit' invocationEric Sunshine Fri, 24 Jul 2015 04:00:52 +0000 (00:00 -0400)

Documentation/git-worktree: fix broken 'linkgit' invocation

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

contrib/subtree: ignore log.date configurationDavid Aguilar Wed, 22 Jul 2015 00:01:02 +0000 (17:01 -0700)

contrib/subtree: ignore log.date configuration

git-subtree's log format string uses "%ad" and "%cd", which
respect the user's configured log.date value.

This is problematic for git-subtree because it needs to use real
dates so that copied commits come through unchanged.

Add a test and tweak the format strings to use %aD and %cD
so that the default date format is used instead.

Reported-by: Bryan Jacobs <b@q3q.us>
Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

userdiff: add support for Fountain documentsZoë Blade Tue, 21 Jul 2015 13:22:46 +0000 (14:22 +0100)

userdiff: add support for Fountain documents

Add support for Fountain, a plain text screenplay format. Git
facilitates not just programming specifically, but creative writing
in general, so it makes sense to also support other plain text
documents besides source code.

In the structure of a screenplay specifically, scenes are roughly
analogous to functions, in the sense that it makes your job easier
if you can see which ones were changed in a given range of patches.

More information about the Fountain format can be found on its
official website, at http://fountain.io .

Signed-off-by: Zoë Blade <zoe@bytenoise.co.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

receive-pack: crash when checking with non-exist HEADJiang Xin Wed, 22 Jul 2015 01:49:40 +0000 (09:49 +0800)

receive-pack: crash when checking with non-exist HEAD

If HEAD of a repository points to a conflict reference, such as:

* There exist a reference named 'refs/heads/jx/feature1', but HEAD
points to 'refs/heads/jx', or

* There exist a reference named 'refs/heads/feature', but HEAD points
to 'refs/heads/feature/bad'.

When we push to delete a reference for this repo, such as:

git push /path/to/bad-head-repo.git :some/good/reference

The git-receive-pack process will crash.

This is because if HEAD points to a conflict reference, the function
`resolve_refdup("HEAD", ...)` does not return a valid reference name,
but a null buffer. Later matching the delete reference against the null
buffer will cause git-receive-pack crash.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

pull: allow dirty tree when rebase.autostash enabledKevin Daudt Sat, 4 Jul 2015 21:42:38 +0000 (23:42 +0200)

pull: allow dirty tree when rebase.autostash enabled

rebase learned to stash changes when it encounters a dirty work tree,
but git pull --rebase does not.

Only verify if the working tree is dirty when rebase.autostash is not
enabled.

Signed-off-by: Kevin Daudt <me@ikke.info>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

builtin/send-pack.c: respect user.signingkeyJunio C Hamano Tue, 21 Jul 2015 22:06:43 +0000 (15:06 -0700)

builtin/send-pack.c: respect user.signingkey

When git-send-pack is exec'ed, as is done by git-remote-http, it
does not read the config, and configured value of user.signingkey is
ignored. Thus it was impossible to specify a signing key over HTTP,
other than the default key in the keyring having a User ID matching
the "Name <email>" format.

This patch at least partially fixes the problem by reading in the GPG
config from within send-pack. It does not address the related problem
of plumbing a value for this configuration option using
`git -c user.signingkey push ...`.

Signed-off-by: Dave Borowitz <dborowitz@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Git 2.5.0-rc3 v2.5.0-rc3Junio C Hamano Tue, 21 Jul 2015 21:11:54 +0000 (14:11 -0700)

Git 2.5.0-rc3

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

git-stash: use update-ref --create-reflog instead of... David Turner Tue, 21 Jul 2015 21:04:56 +0000 (17:04 -0400)

git-stash: use update-ref --create-reflog instead of creating files

This is in support of alternate ref backends which don't necessarily
store reflogs as files.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

update-ref and tag: add --create-reflog argDavid Turner Tue, 21 Jul 2015 21:04:55 +0000 (17:04 -0400)

update-ref and tag: add --create-reflog arg

Allow the creation of a ref (e.g. stash) with a reflog already in
place. For most refs (e.g. those under refs/heads), this happens
automatically, but for others, we need this option.

Currently, git does this by pre-creating the reflog, but alternate ref
backends might store reflogs somewhere other than .git/logs. Code
that now directly manipulates .git/logs should instead use git
plumbing commands.

I also added --create-reflog to git tag, just for completeness.

In a moment, we will use this argument to make git stash work with
alternate ref backends.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: add REF_FORCE_CREATE_REFLOG flagDavid Turner Tue, 21 Jul 2015 21:04:54 +0000 (17:04 -0400)

refs: add REF_FORCE_CREATE_REFLOG flag

Add a flag to allow forcing the creation of a reflog even if the ref
name and core.logAllRefUpdates setting would not ordinarily cause ref
creation.

In a moment, we will use this to add options to git tag and git
update-ref to force reflog creation.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

git-reflog: add exists commandDavid Turner Tue, 21 Jul 2015 21:04:53 +0000 (17:04 -0400)

git-reflog: add exists command

This is necessary because alternate ref backends might store reflogs
somewhere other than .git/logs. Code that now directly manipulates
.git/logs should instead go through git-reflog.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: new public ref function: safe_create_reflogDavid Turner Tue, 21 Jul 2015 21:04:52 +0000 (17:04 -0400)

refs: new public ref function: safe_create_reflog

The safe_create_reflog function creates a reflog, if it does not
already exist.

The log_ref_setup function becomes private and gains a force_create
parameter to force the creation of a reflog even if log_all_ref_updates
is false or the refname is not one of the special refnames.

The new parameter also reduces the need to store, modify, and restore
the log_all_ref_updates global before reflog creation.

In a moment, we will use this to add reflog creation commands to
git-reflog.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs: break out check for reflog autocreationDavid Turner Tue, 21 Jul 2015 21:04:51 +0000 (17:04 -0400)

refs: break out check for reflog autocreation

This is just for clarity.

Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

refs.c: add err arguments to reflog functionsDavid Turner Tue, 21 Jul 2015 21:04:50 +0000 (17:04 -0400)

refs.c: add err arguments to reflog functions

Add an err argument to log_ref_setup that can explain the reason
for a failure. This then eliminates the need to manage errno through
this function since we can just add strerror(errno) to the err string
when meaningful. No callers relied on errno from this function for
anything else than the error message.

Also add err arguments to private functions write_ref_to_lockfile,
log_ref_write_1, commit_ref_update. This again eliminates the need to
manage errno in these functions.

Some error messages are slightly reordered.

Update of a patch by Ronnie Sahlberg.

Signed-off-by: Ronnie Sahlberg <sahlberg@google.com>
Signed-off-by: David Turner <dturner@twopensource.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

unpack-trees: don't update files with CE_WT_REMOVE setDavid Turner Fri, 17 Jul 2015 21:19:27 +0000 (17:19 -0400)

unpack-trees: don't update files with CE_WT_REMOVE set

Don't update files in the worktree from cache entries which are
flagged with CE_WT_REMOVE.

When a user does a sparse checkout, git removes files that are
marked with CE_WT_REMOVE (because they are out-of-scope for the
sparse checkout). If those files are also marked CE_UPDATE (for
instance, because they differ in the branch that is being checked
out and the outgoing branch), git would previously recreate them.
This patch prevents them from being recreated.

These erroneously-created files would also interfere with merges,
causing pre-merge revisions of out-of-scope files to appear in the
worktree.

apply_sparse_checkout() is the function where all "action"
manipulation (add, delete, update files..) for sparse checkout
occurs; it should not ask to delete and update both at the same
time.

Signed-off-by: Anatole Shaw <git-devel@omni.poc.net>
Signed-off-by: David Turner <dturner@twopensource.com>
Helped-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'tf/gitweb-typofix'Junio C Hamano Tue, 21 Jul 2015 19:45:27 +0000 (12:45 -0700)

Merge branch 'tf/gitweb-typofix'

* tf/gitweb-typofix:
gitweb: fix typo in man page

Merge tag 'l10n-2.5.0-rnd2' of git://github.com/git... Junio C Hamano Tue, 21 Jul 2015 17:27:33 +0000 (10:27 -0700)

Merge tag 'l10n-2.5.0-rnd2' of git://github.com/git-l10n/git-po

l10n-2.5.0-rnd2

* tag 'l10n-2.5.0-rnd2' of git://github.com/git-l10n/git-po:
l10n: ca.po: update translation
l10n: de.po: translate 9 new messages
l10n: Updated Bulgarian translation of git (2359t,0f,0u)
l10n: zh_CN: for git v2.5.0 l10n round 2
l10n: sv.po: Update Swedish translation (2359t0f0u)
l10n: fr v2.5.0 round 2 (2359t)
l10n: ru.po: update Russian translation
l10n: Updated Vietnamese translation (2359t)
l10n: git.pot: v2.5.0 round 2 (9 new, 5 removed)

strbuf: make strbuf_addftime more robustJeff King Tue, 30 Jun 2015 13:26:53 +0000 (09:26 -0400)

strbuf: make strbuf_addftime more robust

The return value of strftime is poorly designed; when it
returns 0, the caller cannot tell if the buffer was not
large enough, or if the output was actually 0 bytes. In the
original implementation of strbuf_addftime, we simply punted
and guessed that our 128-byte hint would be large enough.

We can do better, though, if we're willing to treat strftime
like less of a black box. We can munge the incoming format
to make sure that it never produces 0-length output, and
then "fix" the resulting output. That lets us reliably grow
the buffer based on strftime's return value.

Clever-idea-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

bash prompt: faster untracked status indicator with... SZEDER Gábor Sun, 19 Jul 2015 11:28:06 +0000 (13:28 +0200)

bash prompt: faster untracked status indicator with untracked directories

If the untracked status indicator is enabled, __git_ps1() looks for
untracked files by running 'git ls-files'. This can be perceptibly slow
in case of an untracked directory containing lot of files, because it
lists all files found in the untracked directory only to be redirected
into /dev/null right away (this is the actual command run by __git_ps1()):

$ ls untracked-dir/ |wc -l
100000
$ time git ls-files --others --exclude-standard --error-unmatch \
-- ':/*' >/dev/null 2>/dev/null

real 0m0.955s
user 0m0.936s
sys 0m0.016s

Eliminate this delay by additionally passing the '--directory
--no-empty-directory' options to 'git ls-files' to show only the name of
non-empty untracked directories instead of all their content:

$ time git ls-files --others --exclude-standard --directory \
--no-empty-directory --error-unmatch -- ':/*' >/dev/null 2>/dev/null

real 0m0.010s
user 0m0.008s
sys 0m0.000s

This follows suit of ea95c7b8f5 (completion: improve untracked directory
filtering for filename completion, 2013-09-18).

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

bash prompt: test untracked files status indicator... SZEDER Gábor Sun, 19 Jul 2015 11:28:05 +0000 (13:28 +0200)

bash prompt: test untracked files status indicator with untracked dirs

The next commit will tweak the way __git_ps1() decides whether to display
the untracked files status indicator in the presence of untracked
directories. Add tests to make sure it doesn't change current behavior,
in particular that an empty untracked directory doesn't trigger the
untracked files status indicator.

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

checkout: drop intimate knowledge of newly created... Eric Sunshine Fri, 17 Jul 2015 23:00:17 +0000 (19:00 -0400)

checkout: drop intimate knowledge of newly created worktree

Now that git-worktree no longer relies upon git-checkout for new branch
creation, new worktree HEAD set up, or initial worktree population,
git-checkout no longer needs intimate knowledge that it may be operating
in a newly created worktree. Therefore, drop 'new_worktree_mode' and the
private GIT_CHECKOUT_NEW_WORKTREE environment variable by which
git-worktree communicated to git-checkout that it was being invoked to
manipulate a new worktree.

This reverts the remaining changes to checkout.c by 529fef2 (checkout:
support checking out into a new working directory, 2014-11-30).

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

worktree: populate via "git reset --hard" rather than... Eric Sunshine Fri, 17 Jul 2015 23:00:16 +0000 (19:00 -0400)

worktree: populate via "git reset --hard" rather than "git checkout"

Now that git-worktree handles all functionality (--force, --detach,
-b/-B) previously delegated to git-checkout, actual population of the
new worktree can be accomplished more directly and lightweight with
"git reset --hard" in place of "git checkout".

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

worktree: avoid resolving HEAD unnecessarilyEric Sunshine Fri, 17 Jul 2015 23:00:15 +0000 (19:00 -0400)

worktree: avoid resolving HEAD unnecessarily

Now that git-worktree sets HEAD explicitly to its final value via either
git-symbolic-ref or git-update-ref, rather than relying upon
git-checkout to do so, the "hack" for pacifying is_git_directory() with
a temporary HEAD, though still necessary, can be simplified.

Since the real HEAD is now populated with its proper final value, the
value of the temporary HEAD truly no longer matters, and any value which
looks like an object ID is good enough to satisfy is_git_directory().
Therefore, just set the temporary HEAD to a literal value rather than
going through the effort of resolving the current branch's HEAD.

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

worktree: make setup of new HEAD distinct from worktree... Eric Sunshine Fri, 17 Jul 2015 23:00:14 +0000 (19:00 -0400)

worktree: make setup of new HEAD distinct from worktree population

git-worktree currently conflates setting of HEAD in the new worktree and
initial worktree population into a single git-checkout invocation which
requires git-checkout to have special knowledge that it is operating on
a newly created worktree. The eventual goal is to rid git-checkout of
that overly-intimate knowledge.

Once these operations are separate, git-worktree will no longer be able
to delegate to git-branch the setting of the new worktree's HEAD to the
desired branch (or commit, if detached). Therefore, make git-worktree
itself responsible for setting up HEAD as either a symbolic reference,
if associated with a branch, or detached, if not.

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

worktree: detect branch-name/detached and error conditi... Eric Sunshine Fri, 17 Jul 2015 23:00:13 +0000 (19:00 -0400)

worktree: detect branch-name/detached and error conditions locally

git-worktree currently conflates setting of HEAD in the new worktree
with initial worktree population via a single git-checkout invocation,
which requires git-checkout to have special knowledge that it is
operating in a newly created worktree. The eventual goal is to separate
these operations and rid git-checkout of that overly-intimate knowledge.

Once these operations are separate, git-worktree will no longer be able
to rely upon git-branch to determine the state of the worktree (branch
name or detached), or to check for error conditions, such as the
requested branch already checked out elsewhere, or an invalid reference.
Therefore, imbue git-worktree with the intelligence to determine a
branch name or detached state locally, and to perform error checking on
its own.

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

worktree: add_worktree: construct worktree-population... Eric Sunshine Fri, 17 Jul 2015 23:00:12 +0000 (19:00 -0400)

worktree: add_worktree: construct worktree-population command locally

The caller of add_worktree() provides it with a command to invoke to
populate the new worktree. This was a useful abstraction during the
conversion of "git checkout --to" functionality to "git worktree add"
since git-checkout and git-worktree constructed the population command
differently. However, now that "git checkout --to" has been retired, and
add_worktree() has access to the options given to "worktree add", this
extra indirection is no longer useful and makes the code a bit
convoluted.

Moreover, the eventual goal is for git-worktree to make setting of HEAD
and worktree population distinct operations, whereas they are currently
conflated into a single git-checkout invocation. As such, add_worktree()
will eventually invoke other commands in addition to the worktree
population command, so it will be doing command construction itself
anyhow.

Therefore, relocate construction of the worktree population command from
add() to add_worktree().

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

worktree: elucidate environment variables intended... Eric Sunshine Fri, 17 Jul 2015 23:00:11 +0000 (19:00 -0400)

worktree: elucidate environment variables intended for child processes

Take advantage of 'struct child_process.env' to make it obvious that
environment variables set by add_worktree() are intended specifically
for sub-commands it invokes to operate in the new worktree.

We assign a local 'struct argv_array' to child_process.env, rather than
utilizing the child_process.env_array 'struct argv_array', because
future patches will make add_worktree() invoke additional sub-commands,
and it's simpler to populate the environment array just once, whereas
child_process.env_array gets cleared after each invocation, thus would
require re-population for each sub-command.

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

worktree: make branch creation distinct from worktree... Eric Sunshine Fri, 17 Jul 2015 23:00:10 +0000 (19:00 -0400)

worktree: make branch creation distinct from worktree population

git-worktree currently conflates branch creation, setting of HEAD in the
new worktree, and worktree population into a single sub-invocation of
git-checkout, which requires git-checkout to be specially aware that it
is operating in a newly-created worktree. The goal is to free
git-checkout of that special knowledge, and to do so, git-worktree will
eventually perform those operations separately. Thus, as a first step,
rather than piggybacking on git-checkout's -b/-B ability to create a new
branch at checkout time, make git-worktree responsible for branch
creation itself.

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

worktree: add: suppress auto-vivication with --detach... Eric Sunshine Fri, 17 Jul 2015 23:00:09 +0000 (19:00 -0400)

worktree: add: suppress auto-vivication with --detach and no <branch>

Fix oversight where branch auto-vivication incorrectly kicks in when
--detach is specified and <branch> omitted. Instead, treat:

git worktree add --detach <path>

as shorthand for:

git worktree add --detach <path> HEAD

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

worktree: make --detach mutually exclusive with -b/-BEric Sunshine Fri, 17 Jul 2015 23:00:08 +0000 (19:00 -0400)

worktree: make --detach mutually exclusive with -b/-B

Be consistent with git-checkout which disallows this (not particularly
meaningful) combination.

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

worktree: introduce options containerEric Sunshine Fri, 17 Jul 2015 23:00:07 +0000 (19:00 -0400)

worktree: introduce options container

add_worktree() will eventually need to deal with some options itself, so
introduce a structure into which options can be conveniently bundled,
and pass it along to add_worktree().

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

worktree: simplify new branch (-b/-B) option checkingEric Sunshine Fri, 17 Jul 2015 23:00:06 +0000 (19:00 -0400)

worktree: simplify new branch (-b/-B) option checking

Make 'new_branch' be the name of the new branch for both forced and
non-forced cases; and add boolean 'force_new_branch' to indicate forced
branch creation. This will simplify logic later on when git-worktree
handles branch creation locally rather than delegating it to
git-checkout as part of the worktree population phase.

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

worktree: improve worktree setup messageEric Sunshine Fri, 17 Jul 2015 23:00:05 +0000 (19:00 -0400)

worktree: improve worktree setup message

When git-worktree creates a new worktree, it reports:

Enter "<path>" (identifier <tag>)

which misleadingly implies that it is setting <path> as the working
directory (as if "cd <path>" had been invoked), whereas it's actually
preparing the new worktree by creating its administrative files, setting
HEAD, and populating it. Make this more clear by instead saying:

Preparing "<path>" (identifier <tag>)

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

branch: publish die_if_checked_out()Eric Sunshine Fri, 17 Jul 2015 23:00:04 +0000 (19:00 -0400)

branch: publish die_if_checked_out()

git-worktree currently conflates new branch creation, setting of HEAD in
the new wortkree, and worktree population into a single sub-invocation
of git-checkout. However, these operations will eventually be separated,
and git-worktree itself will need to be able to detect if the branch is
already checked out elsewhere, rather than relying upon git-branch to
make this determination, so publish die_if_checked_out().

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

checkout: teach check_linked_checkout() about symbolic... Eric Sunshine Fri, 17 Jul 2015 23:00:03 +0000 (19:00 -0400)

checkout: teach check_linked_checkout() about symbolic link HEAD

check_linked_checkout() only understands symref-style HEAD (i.e. "ref:
refs/heads/master"), however, HEAD may also be a an actual symbolic link
(on platforms which support it). To accurately detect if a branch is
checked out elsewhere, it needs to handle symbolic link HEAD, as well.

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

checkout: check_linked_checkout: simplify symref parsingEric Sunshine Fri, 17 Jul 2015 23:00:02 +0000 (19:00 -0400)

checkout: check_linked_checkout: simplify symref parsing

check_linked_checkout() only understands symref-style HEAD (i.e. "ref:
refs/heads/master"), however, HEAD may also be a an actual symbolic link
(on platforms which support it), thus it will need to check that style
HEAD, as well (via readlink()). As a preparatory step, simplify parsing
of symref-style HEAD so the actual branch check can be re-used easily
for symbolic links (in an upcoming patch).

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

checkout: check_linked_checkout: improve "already check... Eric Sunshine Fri, 17 Jul 2015 23:00:01 +0000 (19:00 -0400)

checkout: check_linked_checkout: improve "already checked out" aesthetic

When check_linked_checkout() discovers that the branch is already
checked out elsewhere, it emits the diagnostic:

'blorp' is already checked out at '/some/path/.git'

which is misleading since "checked out at" implies the working tree, but
".git" is the location of the repository administrative files. Fix by
dropping ".git" from the message.

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

checkout: generalize die_if_checked_out() branch name... Eric Sunshine Fri, 17 Jul 2015 23:00:00 +0000 (19:00 -0400)

checkout: generalize die_if_checked_out() branch name argument

The plan is to publish die_if_checked_out() so that callers other than
git-checkout can take advantage of it, however, those callers won't have
access to git-checkout's "struct branch_info". Therefore, change it to
accept the full name of the branch as a simple string instead.

While here, also give the argument a more meaningful name ("branch"
instead of "new").

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

checkout: die_if_checked_out: simplify strbuf managementEric Sunshine Fri, 17 Jul 2015 22:59:59 +0000 (18:59 -0400)

checkout: die_if_checked_out: simplify strbuf management

There is no reason to keep the strbuf active long after its last use.
By releasing it as early as possible, resource management is simplified
and there is less worry about future changes resulting in a leak.

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

checkout: improve die_if_checked_out() robustnessEric Sunshine Fri, 17 Jul 2015 22:59:58 +0000 (18:59 -0400)

checkout: improve die_if_checked_out() robustness

die_if_checked_out() is intended to check if the branch about to be
checked out is already checked out either in the main worktree or in a
linked worktree. However, if .git/worktrees directory does not exist,
then it never bothers checking the main worktree, even though the
specified branch might indeed be checked out there, which is fragile
behavior.

This hasn't been a problem in practice since the current implementation
of "git worktree add" (and, earlier, "git checkout --to") always creates
.git/worktrees before die_if_checked_out() is called by the child "git
checkout" invocation which populates the new worktree.

However, git-worktree will eventually want to call die_if_checked_out()
itself rather than only doing so indirectly as a side-effect of invoking
git-checkout, and reliance upon order of operations (creating
.git/worktrees before checking if a branch is already checked out) is
fragile. As a general function, callers should not be expected to abide
by this undocumented and unwarranted restriction. Therefore, make
die_if_checked_out() more robust by checking the main worktree whether
.git/worktrees exists or not.

While here, also move a comment explaining why die_if_checked_out()'s
helper parses HEAD manually. Such information resides more naturally
with the helper itself rather than at its first point of call.

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

checkout: name check_linked_checkouts() more meaningfullyEric Sunshine Fri, 17 Jul 2015 22:59:57 +0000 (18:59 -0400)

checkout: name check_linked_checkouts() more meaningfully

check_linked_checkouts() doesn't just "check" linked checkouts for
"something"; specifically, it aborts the operation if the branch about
to be checked out is already checked out elsewhere. Therefore, rename it
to die_if_checked_out() to give a better indication of its function.
The more meaningful name will be particularly important when this
function is later published for use by other callers.

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

checkout: avoid resolving HEAD unnecessarilyEric Sunshine Fri, 17 Jul 2015 22:59:56 +0000 (18:59 -0400)

checkout: avoid resolving HEAD unnecessarily

When --ignore-other-worktree is specified, we unconditionally skip the
check to see if the requested branch is already checked out in a linked
worktree. Since we know that we will be skipping that check, there is no
need to resolve HEAD in order to detect other conditions under which we
may skip the check.

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

config: rename "gc.pruneWorktreesExpire" to "gc.worktre... Eric Sunshine Mon, 20 Jul 2015 05:29:22 +0000 (01:29 -0400)

config: rename "gc.pruneWorktreesExpire" to "gc.worktreePruneExpire"

As of df0b6cf (worktree: new place for "git prune --worktrees",
2015-06-29), linked worktree pruning functionality moved from
"git prune --worktrees" to "git worktree prune". Rename the
associated configuration variable accordingly.

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

Documentation/git-worktree: wordsmith worktree-related... Michael Haggerty Mon, 20 Jul 2015 05:29:21 +0000 (01:29 -0400)

Documentation/git-worktree: wordsmith worktree-related manpages

[es: reword .git/worktrees and .git/worktrees/<id>/locked descriptions]

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

Documentation/config: fix stale "git prune --worktree... Michael Haggerty Mon, 20 Jul 2015 05:29:20 +0000 (01:29 -0400)

Documentation/config: fix stale "git prune --worktree" reference

This should have been changed to "git worktree prune" by df0b6cf
(worktree: new place for "git prune --worktrees", 2015-06-29)

[es: reword commit message]

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

Documentation/git-worktree: fix incorrect reference... Michael Haggerty Mon, 20 Jul 2015 05:29:19 +0000 (01:29 -0400)

Documentation/git-worktree: fix incorrect reference to file "locked"

The administrative file to suppress pruning is named "locked", not "lock".

[es: don't touch unrelated "git worktree lock" command; reword commit
message]

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

Documentation/git-worktree: consistently use term ... Michael Haggerty Mon, 20 Jul 2015 05:29:18 +0000 (01:29 -0400)

Documentation/git-worktree: consistently use term "linked working tree"

Sometimes linked working trees were called "linked working
directories" or "linked worktrees". Always refer to them as "linked
working trees" for consistency.

[es: fix additional occurrences]

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

l10n: ca.po: update translationAlex Henrie Mon, 20 Jul 2015 17:54:40 +0000 (11:54 -0600)

l10n: ca.po: update translation

Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>

t3901: test git-am encoding conversionPaul Tan Sun, 19 Jul 2015 15:49:18 +0000 (23:49 +0800)

t3901: test git-am encoding conversion

Since d1c5f2a (Add git-am, applymbox replacement., 2005-10-07), git-am
supported the --utf8 and --no-utf8 options, and if set, would pass the
-u flag and the -k flag respectively.

git mailinfo -u will re-code the commit log message and authorship info
in the charset specified by i18n.commitencoding setting, while
git mailinfo -n will disable the re-coding.

Since d84029b (--utf8 is now default for 'git-am', 2007-01-08), --utf8
is set by default in git-am.

Add various encoding conversion tests to t3901 to test git-mailinfo's
encoding conversion. In addition, add a test for --no-utf8 to check that
no encoding conversion will occur if that option is set.

Helped-by: Johannes Sixt <j6t@kdbg.org>
Reviewed-by: Stefan Beller <sbeller@google.com>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Paul Tan <pyokagan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>