OSDN Git Service

git-core/git.git
8 years agoMerge branch 'nd/fixup-linked-gitdir' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:53 +0000 (19:17 -0700)]
Merge branch 'nd/fixup-linked-gitdir' into maint

The code in "multiple-worktree" support that attempted to recover
from an inconsistent state updated an incorrect file.

* nd/fixup-linked-gitdir:
  setup: update the right file in multiple checkouts

8 years agoMerge branch 'jk/rev-list-has-no-notes' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:52 +0000 (19:17 -0700)]
Merge branch 'jk/rev-list-has-no-notes' into maint

"git rev-list" does not take "--notes" option, but did not complain
when one is given.

* jk/rev-list-has-no-notes:
  rev-list: make it obvious that we do not support notes

8 years agoMerge branch 'jk/fix-alias-pager-config-key-warnings' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:52 +0000 (19:17 -0700)]
Merge branch 'jk/fix-alias-pager-config-key-warnings' into maint

Because the configuration system does not allow "alias.0foo" and
"pager.0foo" as the configuration key, the user cannot use '0foo'
as a custom command name anyway, but "git 0foo" tried to look these
keys up and emitted useless warnings before saying '0foo is not a
git command'.  These warning messages have been squelched.

* jk/fix-alias-pager-config-key-warnings:
  config: silence warnings for command names with invalid keys

8 years agoMerge branch 'nd/dwim-wildcards-as-pathspecs' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:51 +0000 (19:17 -0700)]
Merge branch 'nd/dwim-wildcards-as-pathspecs' into maint

Test updates for Windows.

* nd/dwim-wildcards-as-pathspecs:
  t2019: skip test requiring '*' in a file name non Windows

8 years agoMerge branch 'sg/help-group' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:51 +0000 (19:17 -0700)]
Merge branch 'sg/help-group' into maint

We rewrote one of the build scripts in Perl but this reimplements
in Bourne shell.

* sg/help-group:
  generate-cmdlist: re-implement as shell script

8 years agoMerge branch 'ps/t1509-chroot-test-fixup' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:50 +0000 (19:17 -0700)]
Merge branch 'ps/t1509-chroot-test-fixup' into maint

t1509 test that requires a dedicated VM environment had some
bitrot, which has been corrected.

* ps/t1509-chroot-test-fixup:
  tests: fix cleanup after tests in t1509-root-worktree
  tests: fix broken && chains in t1509-root-worktree

8 years agoMerge branch 'jh/strbuf-read-use-read-in-full' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:50 +0000 (19:17 -0700)]
Merge branch 'jh/strbuf-read-use-read-in-full' into maint

strbuf_read() used to have one extra iteration (and an unnecessary
strbuf_grow() of 8kB), which was eliminated.

* jh/strbuf-read-use-read-in-full:
  strbuf_read(): skip unnecessary strbuf_grow() at eof

8 years agoMerge branch 'jk/long-error-messages' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:49 +0000 (19:17 -0700)]
Merge branch 'jk/long-error-messages' into maint

The codepath to produce error messages had a hard-coded limit to
the size of the message, primarily to avoid memory allocation while
calling die().

* jk/long-error-messages:
  vreportf: avoid intermediate buffer
  vreportf: report to arbitrary filehandles

8 years agoMerge branch 'cb/open-noatime-clear-errno' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:49 +0000 (19:17 -0700)]
Merge branch 'cb/open-noatime-clear-errno' into maint

When trying to see that an object does not exist, a state errno
leaked from our "first try to open a packfile with O_NOATIME and
then if it fails retry without it" logic on a system that refuses
O_NOATIME.  This confused us and caused us to die, saying that the
packfile is unreadable, when we should have just reported that the
object does not exist in that packfile to the caller.

* cb/open-noatime-clear-errno:
  git_open_noatime: return with errno=0 on success

8 years agoMerge branch 'mh/get-remote-group-fix' into maint
Junio C Hamano [Fri, 4 Sep 2015 02:17:47 +0000 (19:17 -0700)]
Merge branch 'mh/get-remote-group-fix' into maint

An off-by-one error made "git remote" to mishandle a remote with a
single letter nickname.

* mh/get-remote-group-fix:
  get_remote_group(): use skip_prefix()
  get_remote_group(): eliminate superfluous call to strcspn()
  get_remote_group(): rename local variable "space" to "wordlen"
  get_remote_group(): handle remotes with single-character names

8 years agoGit 2.5.1 v2.5.1
Junio C Hamano [Fri, 28 Aug 2015 18:19:57 +0000 (11:19 -0700)]
Git 2.5.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMingw: verify both ends of the pipe () call
Jose F. Morales [Fri, 28 Aug 2015 09:43:37 +0000 (09:43 +0000)]
Mingw: verify both ends of the pipe () call

The code to open and test the second end of the pipe clearly imitates
the code for the first end. A little too closely, though... Let's fix
the obvious copy-edit bug.

Signed-off-by: Jose F. Morales <jfmcjf@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'jk/guess-repo-name-regression-fix' into maint
Junio C Hamano [Tue, 25 Aug 2015 23:09:17 +0000 (16:09 -0700)]
Merge branch 'jk/guess-repo-name-regression-fix' into maint

"git clone $URL" in recent releases of Git contains a regression in
the code that invents a new repository name incorrectly based on
the $URL.  This has been corrected.

* jk/guess-repo-name-regression-fix:
  clone: use computed length in guess_dir_name
  clone: add tests for output directory

8 years agoMerge branch 'jk/test-with-x' into maint
Junio C Hamano [Tue, 25 Aug 2015 23:09:16 +0000 (16:09 -0700)]
Merge branch 'jk/test-with-x' into maint

Running tests with the "-x" option to make them verbose had some
unpleasant interactions with other features of the test suite.

* jk/test-with-x:
  test-lib: disable trace when test is not verbose
  test-lib: turn off "-x" tracing during chain-lint check

8 years agoMerge branch 'sb/check-return-from-read-ref' into maint
Junio C Hamano [Tue, 25 Aug 2015 23:09:16 +0000 (16:09 -0700)]
Merge branch 'sb/check-return-from-read-ref' into maint

* sb/check-return-from-read-ref:
  transport-helper: die on errors reading refs.

8 years agoMerge branch 'mm/pull-upload-pack' into maint
Junio C Hamano [Tue, 25 Aug 2015 23:09:15 +0000 (16:09 -0700)]
Merge branch 'mm/pull-upload-pack' into maint

"git pull" in recent releases of Git has a regression in the code
that allows custom path to the --upload-pack=<program>.  This has
been corrected.

Note that this is irrelevant for 'master' with "git pull" rewritten
in C.

* mm/pull-upload-pack:
  pull: pass upload_pack only when it was given
  pull.sh: quote $upload_pack when passing it to git-fetch

8 years agopull: pass upload_pack only when it was given
Junio C Hamano [Tue, 25 Aug 2015 23:06:53 +0000 (16:06 -0700)]
pull: pass upload_pack only when it was given

The upload_pack shell variable is initialized to an empty string, so
conditional expansion with ${upload_pack+"$upload_pack"} would not
work very well.  You need a colon there.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agogenerate-cmdlist: re-implement as shell script
Eric Sunshine [Sun, 23 Aug 2015 21:31:09 +0000 (17:31 -0400)]
generate-cmdlist: re-implement as shell script

527ec39 (generate-cmdlist: parse common group commands, 2015-05-21)
replaced generate-cmdlist.sh with a more functional Perl version,
generate-cmdlist.perl. The Perl version gleans named tags from a new
"common groups" section in command-list.txt and recognizes those
tags in "command list" section entries in place of the old 'common'
tag. This allows git-help to, not only recognize, but also group
common commands.

Although the tests require Perl, 527ec39 creates an unconditional
dependence upon Perl in the build system itself, which can not be
overridden with NO_PERL. Such a dependency may be undesirable; for
instance, the 'git-lite' package in the FreeBSD ports tree is
intended as a minimal Git installation (which may, for example, be
useful on servers needing only local clone and update capability),
which, historically, has not depended upon Perl[1].

Therefore, revive generate-cmdlist.sh and extend it to recognize
"common groups" and its named tags. Retire generate-cmdlist.perl.

[1]: http://thread.gmane.org/gmane.comp.version-control.git/275905/focus=276132

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agosetup: update the right file in multiple checkouts
Nguyễn Thái Ngọc Duy [Tue, 25 Aug 2015 10:30:46 +0000 (17:30 +0700)]
setup: update the right file in multiple checkouts

This code is introduced in 23af91d (prune: strategies for linked
checkouts - 2014-11-30), and it's supposed to implement this rule from
that commit's message:

 - linked checkouts are supposed to keep its location in $R/gitdir up
   to date. The use case is auto fixup after a manual checkout move.

Note the name, "$R/gitdir", not "$R/gitfile". Correct the path to be
updated accordingly.

While at there, make sure I/O errors are not silently dropped.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorev-list: make it obvious that we do not support notes
Jeff King [Sun, 23 Aug 2015 17:56:40 +0000 (13:56 -0400)]
rev-list: make it obvious that we do not support notes

The rev-list command does not have the internal
infrastructure to display notes. Running:

  git rev-list --notes HEAD

will silently ignore the "--notes" option. Running:

  git rev-list --notes --grep=. HEAD

will crash on an assert. Running:

  git rev-list --format=%N HEAD

will place a literal "%N" in the output (it does not even
expand to an empty string).

Let's have rev-list tell the user that it cannot fill the
user's request, rather than silently producing wrong data.
Likewise, let's remove mention of the notes options from the
rev-list documentation.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoconfig: silence warnings for command names with invalid keys
Jeff King [Mon, 24 Aug 2015 06:11:33 +0000 (02:11 -0400)]
config: silence warnings for command names with invalid keys

When we are running the git command "foo", we may have to
look up the config keys "pager.foo" and "alias.foo". These
config schemes are mis-designed, as the command names can be
anything, but the config syntax has some restrictions. For
example:

  $ git foo_bar
  error: invalid key: pager.foo_bar
  error: invalid key: alias.foo_bar
  git: 'foo_bar' is not a git command. See 'git --help'.

You cannot name an alias with an underscore. And if you have
an external command with one, you cannot configure its
pager.

In the long run, we may develop a different config scheme
for these features. But in the near term (and because we'll
need to support the existing scheme indefinitely), we should
at least squelch the error messages shown above.

These errors come from git_config_parse_key. Ideally we
would pass a "quiet" flag to the config machinery, but there
are many layers between the pager code and the key parsing.
Passing a flag through all of those would be an invasive
change.

Instead, let's provide a config function to report on
whether a key is syntactically valid, and have the pager and
alias code skip lookup for bogus keys. We can build this
easily around the existing git_config_parse_key, with two
minor modifications:

  1. We now handle a NULL store_key, to validate but not
     write out the normalized key.

  2. We accept a "quiet" flag to avoid writing to stderr.
     This doesn't need to be a full-blown public "flags"
     field, because we can make the existing implementation
     a static helper function, keeping the mess contained
     inside config.c.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoStart preparing for 2.5.1
Junio C Hamano [Wed, 19 Aug 2015 21:26:31 +0000 (14:26 -0700)]
Start preparing for 2.5.1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'ta/docfix-index-format-tech' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:34 +0000 (14:41 -0700)]
Merge branch 'ta/docfix-index-format-tech' into maint

* ta/docfix-index-format-tech:
  typofix for index-format.txt

8 years agoMerge branch 'sb/parse-options-codeformat' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:33 +0000 (14:41 -0700)]
Merge branch 'sb/parse-options-codeformat' into maint

* sb/parse-options-codeformat:
  parse-options: align curly braces for all options

8 years agoMerge branch 'sb/remove-unused-var-from-builtin-add' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:33 +0000 (14:41 -0700)]
Merge branch 'sb/remove-unused-var-from-builtin-add' into maint

* sb/remove-unused-var-from-builtin-add:
  add: remove dead code

8 years agoMerge branch 'kn/tag-doc-fix' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:32 +0000 (14:41 -0700)]
Merge branch 'kn/tag-doc-fix' into maint

* kn/tag-doc-fix:
  Documentation/tag: remove double occurance of "<pattern>"

8 years agoMerge branch 'es/doc-clean-outdated-tools' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:31 +0000 (14:41 -0700)]
Merge branch 'es/doc-clean-outdated-tools' into maint

* es/doc-clean-outdated-tools:
  Documentation/git-tools: retire manually-maintained list
  Documentation/git-tools: drop references to defunct tools
  Documentation/git-tools: fix item text formatting
  Documentation/git-tools: improve discoverability of Git wiki
  Documentation/git: drop outdated Cogito reference

8 years agoMerge branch 'nd/export-worktree' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:30 +0000 (14:41 -0700)]
Merge branch 'nd/export-worktree' into maint

Running an aliased command from a subdirectory when the .git thing
in the working tree is a gitfile pointing elsewhere did not work.

* nd/export-worktree:
  setup: set env $GIT_WORK_TREE when work tree is set, like $GIT_DIR

8 years agoMerge branch 'mh/fast-import-optimize-current-from' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:29 +0000 (14:41 -0700)]
Merge branch 'mh/fast-import-optimize-current-from' into maint

Often a fast-import stream builds a new commit on top of the
previous commit it built, and it often unconditionally emits a
"from" command to specify the first parent, which can be omitted in
such a case.  This caused fast-import to forget the tree of the
previous commit and then re-read it from scratch, which was
inefficient.  Optimize for this common case.

* mh/fast-import-optimize-current-from:
  fast-import: do less work when given "from" matches current branch head

8 years agoMerge branch 'ib/scripted-parse-opt-better-hint-string' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:29 +0000 (14:41 -0700)]
Merge branch 'ib/scripted-parse-opt-better-hint-string' into maint

The "rev-parse --parseopt" mode parsed the option specification
and the argument hint in a strange way to allow '=' and other
special characters in the option name while forbidding them from
the argument hint.  This made it impossible to define an option
like "--pair <key>=<value>" with "pair=key=value" specification,
which instead would have defined a "--pair=key <value>" option.

* ib/scripted-parse-opt-better-hint-string:
  rev-parse --parseopt: allow [*=?!] in argument hints

8 years agoMerge branch 'se/doc-checkout-ours-theirs' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:28 +0000 (14:41 -0700)]
Merge branch 'se/doc-checkout-ours-theirs' into maint

A "rebase" replays changes of the local branch on top of something
else, as such they are placed in stage #3 and referred to as
"theirs", while the changes in the new base, typically a foreign
work, are placed in stage #2 and referred to as "ours".  Clarify
the "checkout --ours/--theirs".

* se/doc-checkout-ours-theirs:
  checkout: document subtlety around --ours/--theirs

8 years agoMerge branch 'cb/uname-in-untracked' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:27 +0000 (14:41 -0700)]
Merge branch 'cb/uname-in-untracked' into maint

An experimental "untracked cache" feature used uname(2) in a
slightly unportable way.

* cb/uname-in-untracked:
  untracked: fix detection of uname(2) failure

8 years agoMerge branch 'as/sparse-checkout-removal' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:27 +0000 (14:41 -0700)]
Merge branch 'as/sparse-checkout-removal' into maint

"sparse checkout" misbehaved for a path that is excluded from the
checkout when switching between branches that differ at the path.

* as/sparse-checkout-removal:
  unpack-trees: don't update files with CE_WT_REMOVE set

8 years agoMerge branch 'db/send-pack-user-signingkey' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:26 +0000 (14:41 -0700)]
Merge branch 'db/send-pack-user-signingkey' into maint

The low-level "git send-pack" did not honor 'user.signingkey'
configuration variable when sending a signed-push.

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

8 years agoMerge branch 'jx/do-not-crash-receive-pack-wo-head' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:26 +0000 (14:41 -0700)]
Merge branch 'jx/do-not-crash-receive-pack-wo-head' into maint

An attempt to delete a ref by pushing into a repositorywhose HEAD
symbolic reference points at an unborn branch that cannot be
created due to ref D/F conflict (e.g. refs/heads/a/b exists, HEAD
points at refs/heads/a) failed.

* jx/do-not-crash-receive-pack-wo-head:
  receive-pack: crash when checking with non-exist HEAD

8 years agoMerge branch 'da/subtree-date-confusion' into maint
Junio C Hamano [Wed, 19 Aug 2015 21:41:24 +0000 (14:41 -0700)]
Merge branch 'da/subtree-date-confusion' into maint

"git subtree" (in contrib/) depended on "git log" output to be
stable, which was a no-no.  Apply a workaround to force a
particular date format.

* da/subtree-date-confusion:
  contrib/subtree: ignore log.date configuration

8 years agogit_open_noatime: return with errno=0 on success
Clemens Buchacher [Tue, 4 Aug 2015 08:24:29 +0000 (10:24 +0200)]
git_open_noatime: return with errno=0 on success

In read_sha1_file_extended we die if read_object fails with a fatal
error. We detect a fatal error if errno is non-zero and is not
ENOENT. If the object could not be read because it does not exist,
this is not considered a fatal error and we want to return NULL.

Somewhere down the line, read_object calls git_open_noatime to open
a pack index file, for example. We first try open with O_NOATIME.
If O_NOATIME fails with EPERM, we retry without O_NOATIME. When the
second open succeeds, errno is however still set to EPERM from the
first attempt. When we finally determine that the object does not
exist, read_object returns NULL and read_sha1_file_extended dies
with a fatal error:

    fatal: failed to read object <sha1>: Operation not permitted

Fix this by resetting errno to zero before we call open again.

Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Clemens Buchacher <clemens.buchacher@intel.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot2019: skip test requiring '*' in a file name non Windows
Johannes Sixt [Tue, 11 Aug 2015 20:38:46 +0000 (22:38 +0200)]
t2019: skip test requiring '*' in a file name non Windows

A test case introduced by ae454f61 (Add tests for wildcard "path vs ref"
disambiguation) allocates a file named '*.c'. This does not work on
Windows, because the OS forbids file names containing wildcard
characters. The test case fails where the shell attempts to allocate the
file. Skip the test on Windows.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agovreportf: avoid intermediate buffer
Jeff King [Tue, 11 Aug 2015 18:13:59 +0000 (14:13 -0400)]
vreportf: avoid intermediate buffer

When we call "die(fmt, args...)", we end up in vreportf with
two pieces of information:

  1. The prefix "fatal: "

  2. The original fmt and va_list of args.

We format item (2) into a temporary buffer, and then fprintf
the prefix and the temporary buffer, along with a newline.
This has the unfortunate side effect of truncating any error
messages that are longer than 4096 bytes.

Instead, let's use separate calls for the prefix and
newline, letting us hand the item (2) directly to vfprintf.
This is essentially undoing d048a96 (print
warning/error/fatal messages in one shot, 2007-11-09), which
tried to have the whole output end up in a single `write`
call.

But we can address this instead by explicitly requesting
line-buffering for the output handle, and by making sure
that the buffer is empty before we start (so that outputting
the prefix does not cause a flush due to hitting the buffer
limit).

We may still break the output into two writes if the content
is larger than our buffer, but there's not much we can do
there; depending on the stdio implementation, that might
have happened even with a single fprintf call.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agovreportf: report to arbitrary filehandles
Jeff King [Tue, 11 Aug 2015 18:06:15 +0000 (14:06 -0400)]
vreportf: report to arbitrary filehandles

The vreportf function always goes to stderr, but run-command
wants child errors to go to the parent's original stderr. To
solve this, commit a5487dd duplicates the stderr fd and
installs die and error handlers to direct the output
appropriately (which later turned into the vwritef
function). This has two downsides, though:

  - we make multiple calls to write(), which contradicts the
    "write at once" logic from d048a96 (print
    warning/error/fatal messages in one shot, 2007-11-09).

  - the custom handlers basically duplicate the normal
    handlers.  They're only a few lines of code, but we
    should not have to repeat the magic "exit(128)", for
    example.

We can solve the first by using fdopen() on the duplicated
descriptor. We can't pass this to vreportf, but we could
introduce a new vreportf_to to handle it.

However, to fix the second problem, we instead introduce a
new "set_error_handle" function, which lets the normal
vreportf calls output to a handle besides stderr. Thus we
can get rid of our custom handlers entirely, and just ask
the regular handlers to output to our new descriptor.

And as vwritef has no more callers, it can just go away.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agostrbuf_read(): skip unnecessary strbuf_grow() at eof
Jim Hill [Sun, 31 May 2015 18:16:45 +0000 (11:16 -0700)]
strbuf_read(): skip unnecessary strbuf_grow() at eof

The loop in strbuf_read() uses xread() repeatedly while extending
the strbuf until the call returns zero.  If the buffer is
sufficiently large to begin with, this results in xread()
returning the remainder of the file to the end (returning
non-zero), the loop extending the strbuf, and then making another
call to xread() to have it return zero.

By using read_in_full(), we can tell when the read reached the end
of file: when it returns less than was requested, it's eof.  This
way we can avoid an extra iteration that allocates an extra 8kB
that is never used.

Signed-off-by: Jim Hill <gjthill@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoclone: use computed length in guess_dir_name
Jeff King [Mon, 10 Aug 2015 15:48:22 +0000 (17:48 +0200)]
clone: use computed length in guess_dir_name

Commit 7e837c6 (clone: simplify string handling in
guess_dir_name(), 2015-07-09) changed clone to use
strip_suffix instead of hand-rolled pointer manipulation.
However, strip_suffix will strip from the end of a
NUL-terminated string, and we may have already stripped some
characters (like directory separators, or "/.git"). This
leads to commands like:

  git clone host:foo.git/

failing to strip the ".git".

We must instead convert our pointer arithmetic into a
computed length and feed that to strip_suffix_mem, which will
then reduce the length further for us.

It would be nicer if we could drop the pointer manipulation
entirely, and just continually strip using strip_suffix. But
that doesn't quite work for two reasons:

  1. The early suffixes we're stripping are not constant; we
     need to look for is_dir_sep, which could be one of
     several characters.

  2. Mid-way through the stripping we compute the pointer
     "start", which shows us the beginning of the pathname.
     Which really give us two lengths to work with: the
     offset from the start of the string, and from the start
     of the path. By using pointers for the early part, we
     can just compute the length from "start" when we need
     it.

Signed-off-by: Jeff King <peff@peff.net>
Acked-by: Sebastian Schuberth <sschuberth@gmail.com>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoclone: add tests for output directory
Jeff King [Mon, 10 Aug 2015 15:48:21 +0000 (17:48 +0200)]
clone: add tests for output directory

When we run "git clone $url", clone guesses from the $url
what to name the local output directory. We don't have any
test coverage of this, so let's add some basic tests.

This reveals a few problems:

  - cloning "foo.git/" does not properly remove the ".git";
    this is a recent regression from 7e837c6 (clone:
    simplify string handling in guess_dir_name(), 2015-07-09)

  - likewise, cloning foo/.git does not seem to handle the
    bare case (we should end up in foo.git, but we try to
    use foo/.git on the local end), which also comes from
    7e837c6.

  - cloning the root is not very smart about URL parsing,
    and usernames and port numbers may end up in the
    directory name

All of these tests are marked as failures.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotest-lib: disable trace when test is not verbose
Jeff King [Thu, 6 Aug 2015 05:33:57 +0000 (01:33 -0400)]
test-lib: disable trace when test is not verbose

The "-x" test-script option turns on the shell's "-x"
tracing, which can help show why a particular test is
failing. Unfortunately, this can create false negatives in
some tests if they invoke a shell function with its stderr
redirected. t5512.10 is such a test, as it does:

    test_must_fail git ls-remote refs*master >actual 2>&1 &&
    test_cmp exp actual

The "actual" file gets the "-x" trace for the test_must_fail
function, which prevents it from matching the expected
output.

There's no way to avoid this without managing the
trace flag inside each sub-function, which isn't really a
workable solution. But unless you specifically care about
t5512.10, we can work around it by enabling tracing only for
the specific tests we want.

You can already do:

    ./t5512-ls-remote.sh -x --verbose-only=16

to see the trace only for a specific test. But that doesn't
_disable_ the tracing in the other tests; it just sends it
to /dev/null. However, there's no point in generating a
trace that the user won't see, so we can simply disable
tracing whenever it doesn't have a matching verbose flag.

The normal case of just "./t5512-ls-remote.sh -x" stays the
same, as "-x" already implies "--verbose" (and
"--verbose-only" overrides "--verbose", which is why this
works at all). And for our test, we need only check
$verbose, as maybe_setup_verbose will have already
set that flag based on the $verbose_only list).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotest-lib: turn off "-x" tracing during chain-lint check
Jeff King [Thu, 6 Aug 2015 05:31:47 +0000 (01:31 -0400)]
test-lib: turn off "-x" tracing during chain-lint check

Now that GIT_TEST_CHAIN_LINT is on by default, running:

    ./t0000-basic.sh -x --verbose-only=1

starts with:

    expecting success:
            find .git/objects -type f -print >should-be-empty &&
            test_line_count = 0 should-be-empty

    + exit 117
    error: last command exited with $?=117
    + find .git/objects -type f -print
    + test_line_count = 0 should-be-empty
    + test 3 != 3
    + wc -l
    + test 0 = 0
    ok 1 - .git/objects should be empty after git init in an empty repo

This is confusing, as the "exit 117" line and the error line
(which is printed in red, no less!) are not part of the test
at all, but are rather in the separate chain-lint test_eval.
Let's unset the "trace" variable when eval-ing the chain
lint check, which avoids this.

Note that we cannot just do a one-shot variable like:

    trace= test_eval ...

as the behavior of one-shot variables for function calls
is not portable.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotests: fix cleanup after tests in t1509-root-worktree
Patrick Steinhardt [Wed, 5 Aug 2015 09:43:51 +0000 (11:43 +0200)]
tests: fix cleanup after tests in t1509-root-worktree

During cleanup we do a simple 'rm /*' to remove leftover files
from previous tests. As 'rm' errors out when there is anything it
cannot delete and there are directories present at '/' it will
throw an error, causing the '&&' chain to fail.

Fix this by explicitly removing the files.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotests: fix broken && chains in t1509-root-worktree
Patrick Steinhardt [Wed, 5 Aug 2015 09:43:50 +0000 (11:43 +0200)]
tests: fix broken && chains in t1509-root-worktree

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agotransport-helper: die on errors reading refs.
Stefan Beller [Fri, 31 Jul 2015 23:57:57 +0000 (16:57 -0700)]
transport-helper: die on errors reading refs.

We check the return value of read_ref in 19 out of 21 cases.
This adds checks to the missing cases.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoSync with 2.4.8
Junio C Hamano [Mon, 3 Aug 2015 17:45:34 +0000 (10:45 -0700)]
Sync with 2.4.8

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoGit 2.4.8 v2.4.8
Junio C Hamano [Mon, 3 Aug 2015 17:40:37 +0000 (10:40 -0700)]
Git 2.4.8

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'js/rebase-i-clean-up-upon-continue-to-skip' into maint
Junio C Hamano [Mon, 3 Aug 2015 17:41:34 +0000 (10:41 -0700)]
Merge branch 'js/rebase-i-clean-up-upon-continue-to-skip' into maint

Abandoning an already applied change in "git rebase -i" with
"--continue" left CHERRY_PICK_HEAD and confused later steps.

* js/rebase-i-clean-up-upon-continue-to-skip:
  rebase -i: do not leave a CHERRY_PICK_HEAD file behind
  t3404: demonstrate CHERRY_PICK_HEAD bug

8 years agoMerge branch 'ss/clone-guess-dir-name-simplify' into maint
Junio C Hamano [Mon, 3 Aug 2015 17:41:33 +0000 (10:41 -0700)]
Merge branch 'ss/clone-guess-dir-name-simplify' into maint

Code simplification.

* ss/clone-guess-dir-name-simplify:
  clone: simplify string handling in guess_dir_name()

8 years agoMerge branch 'sg/completion-commit-cleanup' into maint
Junio C Hamano [Mon, 3 Aug 2015 17:41:33 +0000 (10:41 -0700)]
Merge branch 'sg/completion-commit-cleanup' into maint

* sg/completion-commit-cleanup:
  completion: teach 'scissors' mode to 'git commit --cleanup='

8 years agoMerge branch 'pt/am-abort-fix' into maint
Junio 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

8 years agoMerge branch 'mh/reporting-broken-refs-from-for-each-ref' into maint
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

8 years agoMerge branch 'sg/commit-cleanup-scissors' into maint
Junio 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

8 years agoadd: remove dead code
Stefan 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>
8 years agopull.sh: quote $upload_pack when passing it to git-fetch
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>
8 years agoparse-options: align curly braces for all options
Stefan 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>
8 years agoget_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>
8 years agoget_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>
8 years agoget_remote_group(): rename local variable "space" to "wordlen"
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>
8 years agoget_remote_group(): handle remotes with single-character names
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>
8 years agoDocumentation/git-tools: retire manually-maintained list
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>
8 years agoDocumentation/git-tools: drop references to defunct tools
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>
8 years agoDocumentation/git-tools: fix item text formatting
Eric 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>
8 years agoDocumentation/git-tools: improve discoverability of Git wiki
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>
8 years agotypofix for index-format.txt
Thomas 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>
8 years agoGit 2.5 v2.5.0
Junio 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>
8 years agoSync with 2.4.7
Junio C Hamano [Mon, 27 Jul 2015 19:26:36 +0000 (12:26 -0700)]
Sync with 2.4.7

8 years agoGit 2.4.7 v2.4.7
Junio 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>
8 years agoMerge branch 'jk/pretty-encoding-doc' into maint
Junio 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

8 years agoMerge branch 'tb/checkout-doc' into maint
Junio 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

8 years agoMerge branch 'ls/hint-rev-list-count' into maint
Junio 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

8 years agoMerge branch 'mm/branch-doc-updates' into maint
Junio 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

8 years agoMerge branch 'jc/fsck-retire-require-eoh' into maint
Junio 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

8 years agoMerge branch 'et/http-proxyauth' into maint
Junio 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

8 years agoMerge branch 'jc/unexport-git-pager-in-use-in-pager' into maint
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

8 years agoMerge branch 'mh/strbuf-read-file-returns-ssize-t' into maint
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

8 years agoMerge branch 'kb/config-unmap-before-renaming' into maint
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

8 years agoMerge branch 'jk/rev-list-no-bitmap-while-pruning' into maint
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

8 years agoMerge branch 'rh/test-color-avoid-terminfo-in-original-home' into maint
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"

8 years agoMerge branch 'jk/fix-refresh-utime' into maint
Junio 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

8 years agoMerge branch 'cb/rebase-am-exit-code' into maint
Junio 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

8 years agoMerge branch 'jk/index-pack-reduce-recheck' into maint
Junio 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

8 years agoDocumentation/git: drop outdated Cogito reference
Eric 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>
8 years agoRelNotes: 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>
8 years agoRevert "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>
9 years agocontrib/subtree: ignore log.date configuration
David 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>
9 years agoreceive-pack: crash when checking with non-exist HEAD
Jiang 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>
9 years agobuiltin/send-pack.c: respect user.signingkey
Junio 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>
9 years agoGit 2.5.0-rc3 v2.5.0-rc3
Junio 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>
9 years agounpack-trees: don't update files with CE_WT_REMOVE set
David 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>
9 years agoMerge 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

9 years agoMerge tag 'l10n-2.5.0-rnd2' of git://github.com/git-l10n/git-po
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)

9 years agol10n: ca.po: update translation
Alex 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>
9 years agountracked: fix detection of uname(2) failure
Charles Bailey [Fri, 17 Jul 2015 17:09:41 +0000 (18:09 +0100)]
untracked: fix detection of uname(2) failure

According to POSIX specification uname(2) must return -1 on failure
and a non-negative value on success.  Although many implementations
do return 0 on success it is valid to return any positive value for
success.  In particular, Solaris returns 1.

Signed-off-by: Charles Bailey <cbailey32@bloomberg.net>
Reviewed-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
9 years agoMerge branch 'jk/still-interesting'
Junio C Hamano [Fri, 17 Jul 2015 17:44:56 +0000 (10:44 -0700)]
Merge branch 'jk/still-interesting'

Code clean-up.

* jk/still-interesting:
  revision.c: remove unneeded check for NULL

9 years agoMerge branch 'es/worktree-add'
Junio C Hamano [Fri, 17 Jul 2015 17:44:54 +0000 (10:44 -0700)]
Merge branch 'es/worktree-add'

Update to the "linked checkout" in 2.5.0-rc1.

Instead of "checkout --to" that does not do what "checkout"
normally does, move the functionality to "git worktree add".

As this makes the end-user experience of the "worktree add" more or
less complete, I am tempted to say we should cook the other topic
that removes the internal "new-worktree-mode" hack from "checkout"
a bit longer in 'next', and release 2.5 final without that one.

* es/worktree-add:
  Documentation/git: fix stale "MULTIPLE CHECKOUT MODE" reference
  worktree: caution that this is still experimental
  Documentation/git-worktree: fix stale "git checkout --to" references

9 years agoDocumentation/git: fix stale "MULTIPLE CHECKOUT MODE" reference
Eric Sunshine [Fri, 17 Jul 2015 00:17:02 +0000 (20:17 -0400)]
Documentation/git: fix stale "MULTIPLE CHECKOUT MODE" reference

This should have been changed by 93a3649 (Documentation: move linked
worktree description from checkout to worktree, 2015-07-06).

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