git
8 years agorefs.c: avoid git_path assignment in lock_ref_sha1_basic
Jeff King [Mon, 10 Aug 2015 09:37:12 +0000 (05:37 -0400)] 
refs.c: avoid git_path assignment in lock_ref_sha1_basic

Assigning the result of git_path is a bad pattern, because
it's not immediately obvious how long you expect the content
to stay valid (and it may be overwritten by subsequent
calls). Let's use a function-local strbuf here instead,
which we know is safe (we just have to remember to free it
in all code paths).

As a bonus, we get rid of a confusing variable-reuse
("ref_file" is used for two distinct purposes).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorefs.c: avoid repeated git_path calls in rename_tmp_log
Jeff King [Mon, 10 Aug 2015 09:36:53 +0000 (05:36 -0400)] 
refs.c: avoid repeated git_path calls in rename_tmp_log

Because it's not safe to store the static-buffer results of
git_path for a long time, we end up formatting the same
filename over and over. We can fix this by using a
function-local strbuf to store the formatted pathname and
avoid repeating ourselves.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorefs.c: simplify strbufs in reflog setup and writing
Jeff King [Mon, 10 Aug 2015 12:26:38 +0000 (08:26 -0400)] 
refs.c: simplify strbufs in reflog setup and writing

Commit 1a83c24 (git_snpath(): retire and replace with
strbuf_git_path(), 2014-11-30) taught log_ref_setup and
log_ref_write_1 to take a strbuf parameter, rather than a
bare string. It then makes an alias to the strbuf's "buf"
field under the original name.

This made the original diff much shorter, but the resulting
code is more complicated that it needs to be. Since we've
aliased the pointer, we drop our reference to the strbuf to
ensure we don't accidentally change it. But if we simply
drop our alias and use "logfile.buf" directly, we do not
have to worry about this aliasing. It's a larger diff, but
the resulting code is simpler.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agopath.c: drop git_path_submodule
Jeff King [Mon, 10 Aug 2015 09:36:27 +0000 (05:36 -0400)] 
path.c: drop git_path_submodule

There are no callers of the slightly-dangerous static-buffer
git_path_submodule left. Let's drop it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agorefs.c: remove extra git_path calls from read_loose_refs
Jeff King [Mon, 10 Aug 2015 09:36:19 +0000 (05:36 -0400)] 
refs.c: remove extra git_path calls from read_loose_refs

In iterating over the loose refs in "refs/foo/", we keep a
running strbuf with "refs/foo/one", "refs/foo/two", etc. But
we also need to access these files in the filesystem, as
".git/refs/foo/one", etc. For this latter purpose, we make a
series of independent calls to git_path(). These are safe
(we only use the result to call stat()), but assigning the
result of git_path is a suspicious pattern that we'd rather
avoid.

This patch keeps a running buffer with ".git/refs/foo/", and
we can just append/reset each directory element as we loop.
This matches how we handle the refnames. It should also be
more efficient, as we do not keep formatting the same
".git/refs/foo" prefix (which can be arbitrarily deep).

Technically we are dropping a call to strbuf_cleanup() on
each generated filename, but that's OK; it wasn't doing
anything, as we are putting in single-level names we read
from the filesystem (so it could not possibly be cleaning up
cruft like "./" in this instance).

A clever reader may also note that the running refname
buffer ("refs/foo/") is actually a subset of the filesystem
path buffer (".git/refs/foo/"). We could get by with one
buffer, indexing the length of $GIT_DIR when we want the
refname. However, having tried this, the resulting code
actually ends up a little more confusing, and the efficiency
improvement is tiny (and almost certainly dwarfed by the
system calls we are making).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoremote.c: drop extraneous local variable from migrate_file
Jeff King [Mon, 10 Aug 2015 09:35:49 +0000 (05:35 -0400)] 
remote.c: drop extraneous local variable from migrate_file

It's an anti-pattern to assign the result of git_path to a
variable, since other calls may reuse our buffer. In this
case, we feed the result to unlink_or_warn immediately
afterwards, so it's OK. However, it's nice to avoid
assignment entirely, which makes it more obvious that
there's no bug.

We can just pass the result directly to unlink_or_warn,
which is a known-simple function. As a bonus, the code flow
is a little more obvious, as we eliminate an extra
conditional (a reader does not have to wonder any more
"under which circumstances is 'path' set?").

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoprefer mkpathdup to mkpath in assignments
Jeff King [Mon, 10 Aug 2015 09:35:38 +0000 (05:35 -0400)] 
prefer mkpathdup to mkpath in assignments

As with the previous commit to git_path, assigning the
result of mkpath is suspicious, since it is not clear
whether we will still depend on the value after it may have
been overwritten by subsequent calls. This patch converts
low-hanging fruit to use mkpathdup instead of mkpath (with
the downside that we must remember to free the result).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoprefer git_pathdup to git_path in some possibly-dangerous cases
Jeff King [Mon, 10 Aug 2015 09:35:31 +0000 (05:35 -0400)] 
prefer git_pathdup to git_path in some possibly-dangerous cases

Because git_path uses a static buffer that is shared with
calls to git_path, mkpath, etc, it can be dangerous to
assign the result to a variable or pass it to a non-trivial
function. The value may change unexpectedly due to other
calls.

None of the cases changed here has a known bug, but they're
worth converting away from git_path because:

  1. It's easy to use git_pathdup in these cases.

  2. They use constructs (like assignment) that make it
     hard to tell whether they're safe or not.

The extra malloc overhead should be trivial, as an
allocation should be an order of magnitude cheaper than a
system call (which we are clearly about to make, since we
are constructing a filename). The real cost is that we must
remember to free the result.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoadd_to_alternates_file: don't add duplicate entries
Jeff King [Mon, 10 Aug 2015 09:34:46 +0000 (05:34 -0400)] 
add_to_alternates_file: don't add duplicate entries

The add_to_alternates_file function blindly uses
hold_lock_file_for_append to copy the existing contents, and
then adds the new line to it. This has two minor problems:

  1. We might add duplicate entries, which are ugly and
     inefficient.

  2. We do not check that the file ends with a newline, in
     which case we would bogusly append to the final line.
     This is quite unlikely in practice, though, as we call
     this function only from git-clone, so presumably we are
     the only writers of the file (and we always add a
     newline).

Instead of using hold_lock_file_for_append, let's copy the
file line by line, which ensures all records are properly
terminated. If we see an extra line, we can simply abort the
update (there is no point in even copying the rest, as we
know that it would be identical to the original).

As a bonus, we also get rid of some calls to the
static-buffer mkpath and git_path functions.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agot5700: modernize style
Jeff King [Mon, 10 Aug 2015 09:32:30 +0000 (05:32 -0400)] 
t5700: modernize style

The early part of this test is rather old, and does not
follow our usual style guidelines. In particular:

  - the tests liberally chdir, and expect out-of-test "cd"
    commands to return them to a sane state

  - test commands aren't indented at all

  - there are a lot of minor formatting nits, like the
    opening quote of the test block on the wrong line,
    spaces after ">", etc

This patch fixes the style issues, and uses a few helper
functions, along with subshells and "git -C", to avoid
changing the cwd of the main script.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocache.h: complete set of git_path_submodule helpers
Jeff King [Mon, 10 Aug 2015 09:32:22 +0000 (05:32 -0400)] 
cache.h: complete set of git_path_submodule helpers

The git_path function has "git_pathdup" and
"strbuf_git_path" variants, but git_submodule_path only
comes in the dangerous, static-buffer variant. That makes
refactoring callers to use the safer functions hard (since
they don't exist).

Since we're already using a strbuf behind the scenes, it's
easy to expose all three of these interfaces with thin
wrappers.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agocache.h: clarify documentation for git_path, et al
Jeff King [Mon, 10 Aug 2015 09:32:07 +0000 (05:32 -0400)] 
cache.h: clarify documentation for git_path, et al

The comment above these functions actually describes
sha1_file_name, and comes from the very first revision of
git. Commit 723c31f (Add "git_path()" and "head_ref()"
helper functions., 2005-07-05) added git_path, pushing the
comment away from the function it describes; later commits
added more functions in this block.

Let's fix the comment to describe these related functions in
more detail. Let's also make sure to point out their safer
alternatives (and move those alternatives below, which makes
more sense when reading the file).

Note that we do not need to move the existing comment to
sha1_file_name.  Commit d40d535 (sha1_file.c: document a
bunch of functions defined in the file, 2014-02-21) already
added a much more descriptive comment to it.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoSync with maint
Junio C Hamano [Mon, 3 Aug 2015 18:20:07 +0000 (11:20 -0700)] 
Sync with maint

* maint:
  Git 2.4.8

8 years agoFirst batch for 2.6
Junio C Hamano [Mon, 3 Aug 2015 18:19:36 +0000 (11:19 -0700)] 
First batch for 2.6

Signed-off-by: Junio C Hamano <gitster@pobox.com>
8 years agoMerge branch 'es/doc-clean-outdated-tools'
Junio C Hamano [Mon, 3 Aug 2015 18:01:32 +0000 (11:01 -0700)] 
Merge branch 'es/doc-clean-outdated-tools'

* 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 'jk/refspec-parse-wildcard'
Junio C Hamano [Mon, 3 Aug 2015 18:01:31 +0000 (11:01 -0700)] 
Merge branch 'jk/refspec-parse-wildcard'

Allow an asterisk as a substring (as opposed to the entirety) of
a path component for both side of a refspec, e.g.
"refs/heads/o*:refs/remotes/heads/i*".

* jk/refspec-parse-wildcard:
  refs: loosen restriction on wildcard "*" refspecs
  refs: cleanup comments regarding check_refname_component()

8 years agoMerge branch 'da/subtree-date-confusion'
Junio C Hamano [Mon, 3 Aug 2015 18:01:31 +0000 (11:01 -0700)] 
Merge branch 'da/subtree-date-confusion'

"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 agoMerge branch 'jx/do-not-crash-receive-pack-wo-head'
Junio C Hamano [Mon, 3 Aug 2015 18:01:31 +0000 (11:01 -0700)] 
Merge branch 'jx/do-not-crash-receive-pack-wo-head'

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 'db/send-pack-user-signingkey'
Junio C Hamano [Mon, 3 Aug 2015 18:01:30 +0000 (11:01 -0700)] 
Merge branch 'db/send-pack-user-signingkey'

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 'zb/userdiff-fountain'
Junio C Hamano [Mon, 3 Aug 2015 18:01:29 +0000 (11:01 -0700)] 
Merge branch 'zb/userdiff-fountain'

New userdiff pattern definition for fountain screenwriting markup
format.

* zb/userdiff-fountain:
  userdiff: add support for Fountain documents

8 years agoMerge branch 'dt/refs-backend-preamble'
Junio C Hamano [Mon, 3 Aug 2015 18:01:29 +0000 (11:01 -0700)] 
Merge branch 'dt/refs-backend-preamble'

In preparation for allowing different "backends" to store the refs
in a way different from the traditional "one ref per file in $GIT_DIR
or in a $GIT_DIR/packed-refs file" filesystem storage, reduce
direct filesystem access to ref-like things like CHERRY_PICK_HEAD
from scripts and programs.

* dt/refs-backend-preamble:
  git-stash: use update-ref --create-reflog instead of creating files
  update-ref and tag: add --create-reflog arg
  refs: add REF_FORCE_CREATE_REFLOG flag
  git-reflog: add exists command
  refs: new public ref function: safe_create_reflog
  refs: break out check for reflog autocreation
  refs.c: add err arguments to reflog functions

8 years agoMerge branch 'as/sparse-checkout-removal'
Junio C Hamano [Mon, 3 Aug 2015 18:01:28 +0000 (11:01 -0700)] 
Merge branch 'as/sparse-checkout-removal'

"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 'jk/date-mode-format'
Junio C Hamano [Mon, 3 Aug 2015 18:01:27 +0000 (11:01 -0700)] 
Merge branch 'jk/date-mode-format'

Teach "git log" and friends a new "--date=format:..." option to
format timestamps using system's strftime(3).

* jk/date-mode-format:
  strbuf: make strbuf_addftime more robust
  introduce "format" date-mode
  convert "enum date_mode" into a struct
  show-branch: use DATE_RELATIVE instead of magic number

8 years agoMerge branch 'pt/am-tests'
Junio C Hamano [Mon, 3 Aug 2015 18:01:26 +0000 (11:01 -0700)] 
Merge branch 'pt/am-tests'

* pt/am-tests:
  t3901: test git-am encoding conversion
  t3418: non-interactive rebase --continue with rerere enabled
  t4150: tests for am --[no-]scissors
  t4150: am with post-applypatch hook
  t4150: am with pre-applypatch hook
  t4150: am with applypatch-msg hook
  t4150: am --resolved fails if index has unmerged entries
  t4150: am --resolved fails if index has no changes
  t4150: am refuses patches when paused
  t4151: am --abort will keep dirty index intact
  t4150: am fails if index is dirty
  t4150: am.messageid really adds the message id

8 years agoMerge branch 'sg/bash-prompt-untracked-optim'
Junio C Hamano [Mon, 3 Aug 2015 18:01:26 +0000 (11:01 -0700)] 
Merge branch 'sg/bash-prompt-untracked-optim'

Optimize computation of untracked status indicator by bash prompt
script (in contrib/).

* sg/bash-prompt-untracked-optim:
  bash prompt: faster untracked status indicator with untracked directories
  bash prompt: test untracked files status indicator with untracked dirs

8 years agoMerge branch 'cb/uname-in-untracked'
Junio C Hamano [Mon, 3 Aug 2015 18:01:26 +0000 (11:01 -0700)] 
Merge branch 'cb/uname-in-untracked'

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 'se/doc-checkout-ours-theirs'
Junio C Hamano [Mon, 3 Aug 2015 18:01:25 +0000 (11:01 -0700)] 
Merge branch 'se/doc-checkout-ours-theirs'

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 'ib/scripted-parse-opt-better-hint-string'
Junio C Hamano [Mon, 3 Aug 2015 18:01:24 +0000 (11:01 -0700)] 
Merge branch 'ib/scripted-parse-opt-better-hint-string'

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 'mh/fast-import-optimize-current-from'
Junio C Hamano [Mon, 3 Aug 2015 18:01:24 +0000 (11:01 -0700)] 
Merge branch 'mh/fast-import-optimize-current-from'

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 'kn/tag-doc-fix'
Junio C Hamano [Mon, 3 Aug 2015 18:01:23 +0000 (11:01 -0700)] 
Merge branch 'kn/tag-doc-fix'

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

8 years agoMerge branch 'mh/fast-import-get-mark'
Junio C Hamano [Mon, 3 Aug 2015 18:01:23 +0000 (11:01 -0700)] 
Merge branch 'mh/fast-import-get-mark'

"git fast-import" learned to respond to the get-mark command via
its cat-blob-fd interface.

* mh/fast-import-get-mark:
  fast-import: add a get-mark command

8 years agoMerge branch 'gr/rebase-i-drop-warn'
Junio C Hamano [Mon, 3 Aug 2015 18:01:22 +0000 (11:01 -0700)] 
Merge branch 'gr/rebase-i-drop-warn'

Add "drop commit-object-name subject" command as another way to
skip replaying of a commit in "rebase -i", and then punish those
who do not use it (and instead just remove the lines) by throwing
a warning.

* gr/rebase-i-drop-warn:
  git rebase -i: add static check for commands and SHA-1
  git rebase -i: warn about removed commits
  git-rebase -i: add command "drop" to remove a commit

8 years agoMerge branch 'jc/commit-slab'
Junio C Hamano [Mon, 3 Aug 2015 18:01:21 +0000 (11:01 -0700)] 
Merge branch 'jc/commit-slab'

Memory use reduction when commit-slab facility is used to annotate
sparsely (which is not recommended in the first place).

* jc/commit-slab:
  commit-slab: introduce slabname##_peek() function

8 years agoMerge branch 'dt/log-follow-config'
Junio C Hamano [Mon, 3 Aug 2015 18:01:20 +0000 (11:01 -0700)] 
Merge branch 'dt/log-follow-config'

Add a new configuration variable to enable "--follow" automatically
when "git log" is run with one pathspec argument.

* dt/log-follow-config:
  log: add "log.follow" configuration variable

8 years agoMerge branch 'gp/status-rebase-i-info'
Junio C Hamano [Mon, 3 Aug 2015 18:01:19 +0000 (11:01 -0700)] 
Merge branch 'gp/status-rebase-i-info'

Teach "git status" to show a more detailed information regarding
the "rebase -i" session in progress.

* gp/status-rebase-i-info:
  status: add new tests for status during rebase -i
  status: give more information during rebase -i
  status: differentiate interactive from non-interactive rebases
  status: factor two rebase-related messages together

8 years agoMerge branch 'jk/cat-file-batch-all'
Junio C Hamano [Mon, 3 Aug 2015 18:01:19 +0000 (11:01 -0700)] 
Merge branch 'jk/cat-file-batch-all'

"cat-file" learned "--batch-all-objects" option to enumerate all
available objects in the repository more quickly than "rev-list
--all --objects" (the output includes unreachable objects, though).

* jk/cat-file-batch-all:
  cat-file: sort and de-dup output of --batch-all-objects
  cat-file: add --batch-all-objects option
  cat-file: split batch_one_object into two stages
  cat-file: stop returning value from batch_one_object
  cat-file: add --buffer option
  cat-file: move batch_options definition to top of file
  cat-file: minor style fix in options list

8 years agoMerge branch 'js/fsck-opt'
Junio C Hamano [Mon, 3 Aug 2015 18:01:18 +0000 (11:01 -0700)] 
Merge branch 'js/fsck-opt'

Allow ignoring fsck errors on specific set of known-to-be-bad
objects, and also tweaking warning level of various kinds of non
critical breakages reported.

* js/fsck-opt:
  fsck: support ignoring objects in `git fsck` via fsck.skiplist
  fsck: git receive-pack: support excluding objects from fsck'ing
  fsck: introduce `git fsck --connectivity-only`
  fsck: support demoting errors to warnings
  fsck: document the new receive.fsck.<msg-id> options
  fsck: allow upgrading fsck warnings to errors
  fsck: optionally ignore specific fsck issues completely
  fsck: disallow demoting grave fsck errors to warnings
  fsck: add a simple test for receive.fsck.<msg-id>
  fsck: make fsck_tag() warn-friendly
  fsck: handle multiple authors in commits specially
  fsck: make fsck_commit() warn-friendly
  fsck: make fsck_ident() warn-friendly
  fsck: report the ID of the error/warning
  fsck (receive-pack): allow demoting errors to warnings
  fsck: offer a function to demote fsck errors to warnings
  fsck: provide a function to parse fsck message IDs
  fsck: introduce identifiers for fsck messages
  fsck: introduce fsck options

8 years agoMerge branch 'mh/init-delete-refs-api'
Junio C Hamano [Mon, 3 Aug 2015 18:01:17 +0000 (11:01 -0700)] 
Merge branch 'mh/init-delete-refs-api'

Clean up refs API and make "git clone" less intimate with the
implementation detail.

* mh/init-delete-refs-api:
  delete_ref(): use the usual convention for old_sha1
  cmd_update_ref(): make logic more straightforward
  update_ref(): don't read old reference value before delete
  check_branch_commit(): make first parameter const
  refs.h: add some parameter names to function declarations
  refs: move the remaining ref module declarations to refs.h
  initial_ref_transaction_commit(): check for ref D/F conflicts
  initial_ref_transaction_commit(): check for duplicate refs
  refs: remove some functions from the module's public interface
  initial_ref_transaction_commit(): function for initial ref creation
  repack_without_refs(): make function private
  prune_refs(): use delete_refs()
  prune_remote(): use delete_refs()
  delete_refs(): bail early if the packed-refs file cannot be rewritten
  delete_refs(): make error message more generic
  delete_refs(): new function for the refs API
  delete_ref(): handle special case more explicitly
  remove_branches(): remove temporary
  delete_ref(): move declaration to refs.h

8 years agoMerge branch 'pt/pull-builtin'
Junio C Hamano [Mon, 3 Aug 2015 18:01:17 +0000 (11:01 -0700)] 
Merge branch 'pt/pull-builtin'

Reimplement 'git pull' in C.

* pt/pull-builtin:
  pull: remove redirection to git-pull.sh
  pull --rebase: error on no merge candidate cases
  pull --rebase: exit early when the working directory is dirty
  pull: configure --rebase via branch.<name>.rebase or pull.rebase
  pull: teach git pull about --rebase
  pull: set reflog message
  pull: implement pulling into an unborn branch
  pull: fast-forward working tree if head is updated
  pull: check if in unresolved merge state
  pull: support pull.ff config
  pull: error on no merge candidates
  pull: pass git-fetch's options to git-fetch
  pull: pass git-merge's options to git-merge
  pull: pass verbosity, --progress flags to fetch and merge
  pull: implement fetch + merge
  pull: implement skeletal builtin pull
  argv-array: implement argv_array_pushv()
  parse-options-cb: implement parse_opt_passthru_argv()
  parse-options-cb: implement parse_opt_passthru()

8 years agoMerge branch 'jk/pkt-log-pack'
Junio C Hamano [Mon, 3 Aug 2015 18:01:16 +0000 (11:01 -0700)] 
Merge branch 'jk/pkt-log-pack'

Enhance packet tracing machinery to allow capturing an incoming
pack data to a file for debugging.

* jk/pkt-log-pack:
  pkt-line: support tracing verbatim pack contents
  pkt-line: tighten sideband PACK check when tracing
  pkt-line: simplify starts_with checks in packet tracing

8 years agoMerge branch 'mr/rebase-i-customize-insn-sheet'
Junio C Hamano [Mon, 3 Aug 2015 18:01:16 +0000 (11:01 -0700)] 
Merge branch 'mr/rebase-i-customize-insn-sheet'

"git rebase -i"'s list of todo is made configurable.

* mr/rebase-i-customize-insn-sheet:
  git-rebase--interactive.sh: add config option for custom instruction format

8 years agoMerge branch 'rl/send-email-aliases'
Junio C Hamano [Mon, 3 Aug 2015 18:01:15 +0000 (11:01 -0700)] 
Merge branch 'rl/send-email-aliases'

"git send-email" now performs alias-expansion on names that are
given via --cccmd, etc.

This round comes with a lot more enhanced e-mail address parser,
which makes it a bit scary, but as long as it works as designed, it
makes it wonderful ;-).

* rl/send-email-aliases:
  send-email: suppress meaningless whitespaces in from field
  send-email: allow multiple emails using --cc, --to and --bcc
  send-email: consider quote as delimiter instead of character
  send-email: reduce dependencies impact on parse_address_line
  send-email: minor code refactoring
  send-email: allow use of aliases in the From field of --compose mode
  send-email: refactor address list process
  t9001-send-email: refactor header variable fields replacement
  send-email: allow aliases in patch header and command script outputs
  t9001-send-email: move script creation in a setup test

8 years agoMerge branch 'kb/i18n-doc'
Junio C Hamano [Mon, 3 Aug 2015 18:01:15 +0000 (11:01 -0700)] 
Merge branch 'kb/i18n-doc'

* kb/i18n-doc:
  Documentation/i18n.txt: clarify character encoding support

8 years agoMerge branch 'nd/export-worktree'
Junio C Hamano [Mon, 3 Aug 2015 18:01:14 +0000 (11:01 -0700)] 
Merge branch 'nd/export-worktree'

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 'ee/clean-remove-dirs'
Junio C Hamano [Mon, 3 Aug 2015 18:01:13 +0000 (11:01 -0700)] 
Merge branch 'ee/clean-remove-dirs'

Replace "is this subdirectory a separate repository that should not
be touched?" check "git clean" does by checking if it has .git/HEAD
using the submodule-related code with a more optimized check.

* ee/clean-remove-dirs:
  read_gitfile_gently: fix use-after-free
  clean: improve performance when removing lots of directories
  p7300: add performance tests for clean
  t7300: add tests to document behavior of clean and nested git
  setup: sanity check file size in read_gitfile_gently
  setup: add gentle version of read_gitfile

8 years agoMerge branch 'cb/parse-magnitude'
Junio C Hamano [Mon, 3 Aug 2015 18:01:13 +0000 (11:01 -0700)] 
Merge branch 'cb/parse-magnitude'

Move machinery to parse human-readable scaled numbers like 1k, 4M,
and 2G as an option parameter's value from pack-objects to
parse-options API, to make it available to other codepaths.

* cb/parse-magnitude:
  parse-options: move unsigned long option parsing out of pack-objects.c
  test-parse-options: update to handle negative ints

8 years agoMerge branch 'bc/gpg-verify-raw'
Junio C Hamano [Mon, 3 Aug 2015 18:01:12 +0000 (11:01 -0700)] 
Merge branch 'bc/gpg-verify-raw'

"git verify-tag" and "git verify-commit" have been taught to share
more code, and then learned to optionally show the verification
message from the underlying GPG implementation.

* bc/gpg-verify-raw:
  verify-tag: add option to print raw gpg status information
  verify-commit: add option to print raw gpg status information
  gpg: centralize printing signature buffers
  gpg: centralize signature check
  verify-commit: add test for exit status on untrusted signature
  verify-tag: share code with verify-commit
  verify-tag: add tests

8 years agoMerge branch 'pt/am-foreign'
Junio C Hamano [Mon, 3 Aug 2015 18:01:12 +0000 (11:01 -0700)] 
Merge branch 'pt/am-foreign'

Various enhancements around "git am" reading patches generated by
foreign SCM.

* pt/am-foreign:
  am: teach mercurial patch parser how to read from stdin
  am: use gmtime() to parse mercurial patch date
  t4150: test applying StGit series
  am: teach StGit patch parser how to read from stdin
  t4150: test applying StGit patch

8 years agoMerge branch 'kn/for-each-ref'
Junio C Hamano [Mon, 3 Aug 2015 18:01:10 +0000 (11:01 -0700)] 
Merge branch 'kn/for-each-ref'

GSoC project to rebuild ref listing by branch and tag based on the
for-each-ref machinery.  This is its first part.

* kn/for-each-ref:
  ref-filter: make 'ref_array_item' use a FLEX_ARRAY for refname
  for-each-ref: introduce filter_refs()
  ref-filter: move code from 'for-each-ref'
  ref-filter: add 'ref-filter.h'
  for-each-ref: rename variables called sort to sorting
  for-each-ref: rename some functions and make them public
  for-each-ref: introduce 'ref_array_clear()'
  for-each-ref: introduce new structures for better organisation
  for-each-ref: rename 'refinfo' to 'ref_array_item'
  for-each-ref: clean up code
  for-each-ref: extract helper functions out of grab_single_ref()

8 years agoMerge branch 'mh/replace-refs'
Junio C Hamano [Mon, 3 Aug 2015 18:01:10 +0000 (11:01 -0700)] 
Merge branch 'mh/replace-refs'

Add an environment variable to tell Git to look into refs hierarchy
other than refs/replace/ for the object replacement data.

* mh/replace-refs:
  Allow to control where the replace refs are looked for

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 agoref-filter: make 'ref_array_item' use a FLEX_ARRAY for refname
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>
8 years agofor-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>
8 years agoref-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>
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 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 agorefs: loosen restriction on wildcard "*" refspecs
Jacob 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>
8 years agorefs: 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>
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>
8 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>
8 years agouserdiff: add support for Fountain documents
Zoë 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>
8 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>
8 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>
8 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>
8 years agogit-stash: use update-ref --create-reflog instead of creating files
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>
8 years agoupdate-ref and tag: add --create-reflog arg
David 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>
8 years agorefs: add REF_FORCE_CREATE_REFLOG flag
David 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>
8 years agogit-reflog: add exists command
David 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>
8 years agorefs: new public ref function: safe_create_reflog
David 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>
8 years agorefs: break out check for reflog autocreation
David 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>
8 years agorefs.c: add err arguments to reflog functions
David 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>
8 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>