Commit graph

45887 commits

Author SHA1 Message Date
Kyle Meyer de922669ab update-ref: pass reflog message to delete_ref()
Now that delete_ref() accepts a reflog message, pass the user-provided
message to delete_ref() rather than silently dropping it.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-20 22:04:47 -08:00
Kyle Meyer 755b49ae96 delete_ref: accept a reflog message argument
When the current branch is renamed with 'git branch -m/-M' or deleted
with 'git update-ref -m<msg> -d', the event is recorded in HEAD's log
with an empty message.  In preparation for adding a more meaningful
message to HEAD's log in these cases, update delete_ref() to take a
message argument and pass it along to ref_transaction_delete().
Modify all callers to pass NULL for the new message argument; no
change in behavior is intended.

Note that this is relevant for HEAD's log but not for the deleted
ref's log, which is currently deleted along with the ref.  Even if it
were not, an entry for the deletion wouldn't be present in the deleted
ref's log.  files_transaction_commit() writes to the log if
REF_NEEDS_COMMIT or REF_LOG_ONLY are set, but lock_ref_for_update()
doesn't set REF_NEEDS_COMMIT for the deleted ref because REF_DELETING
is set.  In contrast, the update for HEAD has REF_LOG_ONLY set by
split_head_update(), resulting in the deletion being logged.

Signed-off-by: Kyle Meyer <kyle@kyleam.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-20 22:04:47 -08:00
Junio C Hamano 20769079d2 Git 2.12-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-17 14:00:19 -08:00
Junio C Hamano 076c05393a Hopefully the final batch of mini-topics before the final
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 14:46:35 -08:00
Junio C Hamano c5b22b819d Merge branch 'jk/tempfile-ferror-fclose-confusion'
Code clean-up.

* jk/tempfile-ferror-fclose-confusion:
  tempfile: avoid "ferror | fclose" trick
2017-02-16 14:45:15 -08:00
Junio C Hamano 62fef5c564 Merge branch 'dp/submodule-doc-markup-fix'
Doc fix.

* dp/submodule-doc-markup-fix:
  config.txt: fix formatting of submodule.alternateErrorStrategy section
2017-02-16 14:45:15 -08:00
Junio C Hamano 1f73ff0802 Merge branch 'jk/reset-to-break-a-commit-doc-updated'
Doc update.

* jk/reset-to-break-a-commit-doc-updated:
  reset: add an example of how to split a commit into two
2017-02-16 14:45:14 -08:00
Junio C Hamano bf5f119189 Merge branch 'jk/reset-to-break-a-commit-doc'
Doc update.

* jk/reset-to-break-a-commit-doc:
  Revert "reset: add an example of how to split a commit into two"
2017-02-16 14:45:14 -08:00
Junio C Hamano e048a257bf Merge branch 'js/mingw-isatty'
A hotfix for a topic already in 'master'.

* js/mingw-isatty:
  mingw: make stderr unbuffered again
2017-02-16 14:45:13 -08:00
Junio C Hamano 1e00c41fd6 Merge branch 'rs/strbuf-cleanup-in-rmdir-recursively'
Code clean-up.

* rs/strbuf-cleanup-in-rmdir-recursively:
  rm: reuse strbuf for all remove_dir_recursively() calls, again
2017-02-16 14:45:13 -08:00
Junio C Hamano a3b3c9c916 Merge branch 'rs/ls-files-partial-optim'
"ls-files" run with pathspec has been micro-optimized to avoid
having to memmove(3) unnecessary bytes.

* rs/ls-files-partial-optim:
  ls-files: move only kept cache entries in prune_cache()
  ls-files: pass prefix length explicitly to prune_cache()
2017-02-16 14:45:13 -08:00
Junio C Hamano 0078a75985 Merge branch 'rs/cocci-check-free-only-null'
A new coccinelle rule that catches a check of !pointer before the
pointer is free(3)d, which most likely is a bug.

* rs/cocci-check-free-only-null:
  cocci: detect useless free(3) calls
2017-02-16 14:45:13 -08:00
Junio C Hamano 5a98255dec Merge branch 'ls/p4-path-encoding'
When "git p4" imports changelist that removes paths, it failed to
convert pathnames when the p4 used encoding different from the one
used on the Git side.  This has been corrected.

* ls/p4-path-encoding:
  git-p4: fix git-p4.pathEncoding for removed files
2017-02-16 14:45:12 -08:00
Jeff King 0838cbc22f tempfile: avoid "ferror | fclose" trick
The current code wants to record an error condition from
either ferror() or fclose(), but makes sure that we always
call both functions. So it can't use logical-OR "||", which
would short-circuit when ferror() is true. Instead, it uses
bitwise-OR "|" to evaluate both functions and set one or
more bits in the "err" flag if they reported a failure.

Unlike logical-OR, though, bitwise-OR does not introduce a
sequence point, and the order of evaluation for its operands
is unspecified. So a compiler would be free to generate code
which calls fclose() first, and then ferror() on the
now-freed filehandle.

There's no indication that this has happened in practice,
but let's write it out in a way that follows the standard.

Noticed-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 14:15:55 -08:00
David Pursehouse 8ab9740d9f config.txt: fix formatting of submodule.alternateErrorStrategy section
Add missing `::` after the title.

Signed-off-by: David Pursehouse <dpursehouse@collab.net>
Acked-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 13:46:20 -08:00
Jacob Keller f94baa4d93 reset: add an example of how to split a commit into two
It is often useful to break a commit into multiple parts that are more
logical separations. This can be tricky to learn how to do without the
brute-force method if re-writing code or commit messages from scratch.

Add a section to the git-reset documentation which shows an example
process for how to use git add -p and git commit -c HEAD@{1} to
interactively break a commit apart and re-use the original commit
message as a starting point when making the new commit message.

Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-16 13:38:02 -08:00
Junio C Hamano ae86372fcd Revert "reset: add an example of how to split a commit into two"
This reverts commit 7326451bedaa67d29afe02184b166e28d9393c91; a
better rewrite will be queued separately.
2017-02-16 13:35:50 -08:00
Junio C Hamano d09b692797 A bit more for -rc2 2017-02-15 14:58:25 -08:00
Junio C Hamano 57f7345b50 Merge branch 'tg/stash-doc-cleanup'
The documentation explained what "git stash" does to the working
tree (after stashing away the local changes) in terms of "reset
--hard", which was exposing an unnecessary implementation detail.

* tg/stash-doc-cleanup:
  Documentation/stash: remove mention of git reset --hard
2017-02-15 14:56:41 -08:00
Junio C Hamano 3e23116d1f Merge branch 'jk/doc-submodule-markup-fix'
Doc markup fix.

* jk/doc-submodule-markup-fix:
  docs/git-submodule: fix unbalanced quote
2017-02-15 14:56:40 -08:00
Junio C Hamano 8c00b7e583 Merge branch 'jk/doc-remote-helpers-markup-fix'
Doc markup fix.

* jk/doc-remote-helpers-markup-fix:
  docs/gitremote-helpers: fix unbalanced quotes
2017-02-15 14:56:40 -08:00
Junio C Hamano 153a33f98c Merge branch 'sb/doc-unify-bottom'
Doc clean-up.

* sb/doc-unify-bottom:
  Documentation: unify bottom "part of git suite" lines
2017-02-15 12:54:20 -08:00
Junio C Hamano ca3c2b85d1 Merge branch 'sb/push-options-via-transport'
The push-options given via the "--push-options" option were not
passed through to external remote helpers such as "smart HTTP" that
are invoked via the transport helper.

* sb/push-options-via-transport:
  push options: pass push options to the transport helper
2017-02-15 12:54:19 -08:00
Junio C Hamano 3f4ccb5a57 Merge branch 'cw/completion'
More command line completion (in contrib/) for recent additions.

* cw/completion:
  completion: recognize more long-options
  completion: teach remote subcommands to complete options
  completion: teach replace to complete options
  completion: teach ls-remote to complete options
  completion: improve bash completion for git-add
  completion: add subcommand completion for rerere
  completion: teach submodule subcommands to complete options
2017-02-15 12:54:19 -08:00
Junio C Hamano cbf1860d73 Merge branch 'rs/swap'
Code clean-up.

* rs/swap:
  graph: use SWAP macro
  diff: use SWAP macro
  use SWAP macro
  apply: use SWAP macro
  add SWAP macro
2017-02-15 12:54:19 -08:00
Junio C Hamano 2f4e87d777 Merge branch 'sb/submodule-doc'
Doc updates.

* sb/submodule-doc:
  submodule update documentation: don't repeat ourselves
  submodule documentation: add options to the subcommand
2017-02-15 12:54:18 -08:00
Johannes Schindelin a4d92d579f mingw: make stderr unbuffered again
When removing the hack for isatty(), we actually removed more than just
an isatty() hack: we removed the hack where internal data structures of
the MSVC runtime are modified in order to redirect stdout/stderr.

Instead of using that hack (that does not work with newer versions of
the runtime, anyway), we replaced it by reopening the respective file
descriptors.

What we forgot was to mark stderr as unbuffered again.

Reported by Hannes Sixt. Fixed with Jeff Hostetler's assistance.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Tested-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-14 10:54:21 -08:00
René Scharfe 590fc05293 rm: reuse strbuf for all remove_dir_recursively() calls, again
Don't throw the memory allocated for remove_dir_recursively() away after
a single call, use it for the other entries as well instead.

This change was done before in deb8e15a (rm: reuse strbuf for all
remove_dir_recursively() calls), but was reverted as a side-effect of
55856a35 (rm: absorb a submodules git dir before deletion). Reinstate
the optimization.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 14:33:32 -08:00
Thomas Gummerer 20a7e06172 Documentation/stash: remove mention of git reset --hard
Don't mention git reset --hard in the documentation for git stash save.
It's an implementation detail that doesn't matter to the end user and
thus shouldn't be exposed to them.  In addition it's not quite true for
git stash -p, and will not be true when a filename argument to limit the
stash to a few files is introduced.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 14:20:38 -08:00
Jeff King e91461b332 docs/git-submodule: fix unbalanced quote
The documentation gives an example of the submodule foreach
command that uses both backticks and single-quotes. We stick
the whole thing inside "+" markers to make it monospace, but
the inside punctuation still needs escaping. We handle the
backticks with "{backtick}", and use backslash-escaping for
the single-quotes.

But we missed the escaping on the second quote. Fortunately,
asciidoc renders this unbalanced quote as we want (showing
the quote), but asciidoctor does not. We could fix it by
adding the missing backslash.

However, let's take a step back. Even when rendered
correctly, it's hard to read a long command stuck into the
middle of a paragraph, and the important punctuation is hard
to notice. Let's instead bump it into its own single-line
code block. That makes both the source and the rendered
result more readable, and as a bonus we don't have to worry
about quoting at all.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 14:05:40 -08:00
Jeff King 2aaf37b62c docs/gitremote-helpers: fix unbalanced quotes
Each of these options is missing the closing single-quote on
the option name. This understandably confuses asciidoc,
which ends up rendering a stray quote, like:

  option cloning {'true|false}

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 12:55:36 -08:00
René Scharfe 96f6d3f61a ls-files: move only kept cache entries in prune_cache()
prune_cache() first identifies those entries at the start of the sorted
array that can be discarded.  Then it moves the rest of the entries up.
Last it identifies the unwanted trailing entries among the moved ones
and cuts them off.

Change the order: Identify both start *and* end of the range to keep
first and then move only those entries to the top.  The resulting code
is slightly shorter and a bit more efficient.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 12:06:10 -08:00
René Scharfe 7b4158a8d8 ls-files: pass prefix length explicitly to prune_cache()
The function prune_cache() relies on the fact that it is only called on
max_prefix and sneakily uses the matching global variable max_prefix_len
directly.  Tighten its interface by passing both the string and its
length as parameters.  While at it move the NULL check into the function
to collect all cache-pruning related logic in one place.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: Brandon Williams <bmwill@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-13 12:06:08 -08:00
René Scharfe ec6cd14c7a cocci: detect useless free(3) calls
Add a semantic patch for removing checks that cause free(3) to only be
called with a NULL pointer, as that must be a programming mistake.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-11 11:29:12 -08:00
Lars Schneider a8b05162e8 git-p4: fix git-p4.pathEncoding for removed files
In a9e38359e3 we taught git-p4 a way to re-encode path names from what
was used in Perforce to UTF-8. This path re-encoding worked properly for
"added" paths. "Removed" paths were not re-encoded and therefore
different from the "added" paths. Consequently, these files were not
removed in a git-p4 cloned Git repository because the path names did not
match.

Fix this by moving the re-encoding to a place that affects "added" and
"removed" paths. Add a test to demonstrate the issue.

Signed-off-by: Lars Schneider <larsxschneider@gmail.com>
Reviewed-by: Luke Diamand <luke@diamand.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-10 14:33:13 -08:00
Junio C Hamano 5588dbffbd Git 2.12-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-10 12:54:23 -08:00
Junio C Hamano 653078bbdd Merge branch 'nd/rev-list-all-includes-HEAD-doc'
Doc update.

* nd/rev-list-all-includes-HEAD-doc:
  rev-list-options.txt: update --all about HEAD
2017-02-10 12:52:27 -08:00
Junio C Hamano c1462b8405 Merge branch 'rs/fill-directory-optim'
Code clean-up.

* rs/fill-directory-optim:
  dir: avoid allocation in fill_directory()
2017-02-10 12:52:27 -08:00
Junio C Hamano e53c7f8731 Merge branch 'jk/log-graph-name-only'
"git log --graph" did not work well with "--name-only", even though
other forms of "diff" output were handled correctly.

* jk/log-graph-name-only:
  diff: print line prefix for --name-only output
2017-02-10 12:52:27 -08:00
Junio C Hamano dd19bca827 Merge branch 'da/t7800-cleanup'
Test updates.

* da/t7800-cleanup:
  t7800: replace "wc -l" with test_line_count
2017-02-10 12:52:26 -08:00
Junio C Hamano 0ffe1c9c5f Merge branch 'dl/difftool-doc-no-gui-option'
Doc update.

* dl/difftool-doc-no-gui-option:
  Document the --no-gui option in difftool
2017-02-10 12:52:26 -08:00
Junio C Hamano 163d24dc4d Merge branch 'js/difftool-builtin'
A few hot-fixes to C-rewrite of "git difftool".

* js/difftool-builtin:
  t7800: simplify basic usage test
  difftool: fix bug when printing usage
2017-02-10 12:52:25 -08:00
Junio C Hamano cf36a4dc35 Merge branch 'rs/p5302-create-repositories-before-tests'
Adjust a perf test to new world order where commands that do
require a repository are really strict about having a repository.

* rs/p5302-create-repositories-before-tests:
  p5302: create repositories for index-pack results explicitly
2017-02-10 12:52:25 -08:00
Junio C Hamano 65fecf0c08 Merge branch 'ps/worktree-prune-help-fix'
Incorrect usage help message for "git worktree prune" has been fixed.

* ps/worktree-prune-help-fix:
  worktree: fix option descriptions for `prune`
2017-02-10 12:52:25 -08:00
Junio C Hamano f7490fdf85 Merge branch 'ew/complete-svn-authorship-options'
Correct command line completion (in contrib/) on "git svn"

* ew/complete-svn-authorship-options:
  completion: fix git svn authorship switches
2017-02-10 12:52:24 -08:00
Junio C Hamano 5c40e9ce81 Merge branch 'jk/reset-to-break-a-commit-doc'
A minor doc update.

* jk/reset-to-break-a-commit-doc:
  reset: add an example of how to split a commit into two
2017-02-10 12:52:24 -08:00
Junio C Hamano 8e7c1f3240 Merge branch 'bw/push-submodule-only'
Add missing documentation update to a recent topic.

* bw/push-submodule-only:
  completion: add completion for --recurse-submodules=only
  doc: add doc for git-push --recurse-submodules=only
2017-02-10 12:52:23 -08:00
Stefan Beller 941b9c5270 Documentation: unify bottom "part of git suite" lines
We currently have 168 man pages that mention they are part of Git, you
can check yourself easily via:
  $ git grep "Part of the linkgit:git\[1\] suite" |wc -l
  168
However some have a trailing period, i.e.
  $ git grep "Part of the linkgit:git\[1\] suite." |wc -l
  8

Unify the bottom line in all man pages to not end with a period.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-09 15:14:01 -08:00
Stefan Beller 438fc68462 push options: pass push options to the transport helper
When using non-builtin protocols relying on a transport helper
(such as http), push options are not propagated to the helper.

The user could ask for push options and a push would seemingly succeed,
but the push options would never be transported to the server,
misleading the users expectation.

Fix this by propagating the push options to the transport helper.

This is only addressing the first issue of
   (1) the helper protocol does not propagate push-option
   (2) the http helper is not prepared to handle push-option

Once we fix (2), the http transport helper can make use of push options
as well, but that happens as a follow up. (1) is a bug fix, whereas (2)
is a feature, which is why we only do (1) here.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-08 15:45:01 -08:00
Jeff King f5022b5fed diff: print line prefix for --name-only output
If you run "git log --graph --name-only", the pathnames are
not indented to go along with their matching commits (unlike
all of the other diff formats). We need to output the line
prefix for each item before writing it.

The tests cover both --name-status and --name-only. The
former actually gets this right already, because it builds
on the --raw format functions. It's only --name-only which
uses its own code (and this fix mirrors the code in
diff_flush_raw()).

Note that the tests don't follow our usual style of setting
up the "expect" output inside the test block. This matches
the surrounding style, but more importantly it is easier to
read: we don't have to worry about embedded single-quotes,
and the leading indentation is more obvious.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2017-02-08 13:39:57 -08:00