git
10 years agoMerge branch 'ta/parse-commit-with-skip-prefix'
Junio C Hamano [Fri, 14 Mar 2014 21:27:23 +0000 (14:27 -0700)] 
Merge branch 'ta/parse-commit-with-skip-prefix'

* ta/parse-commit-with-skip-prefix:
  commit.c: use skip_prefix() instead of starts_with()

10 years agoMerge branch 'sr/add--interactive-term-readkey'
Junio C Hamano [Fri, 14 Mar 2014 21:27:21 +0000 (14:27 -0700)] 
Merge branch 'sr/add--interactive-term-readkey'

* sr/add--interactive-term-readkey:
  git-add--interactive: warn if module for interactive.singlekey is missing
  git-config: document interactive.singlekey requires Term::ReadKey

10 years agoMerge branch 'sh/write-pack-file-warning-message-fix'
Junio C Hamano [Fri, 14 Mar 2014 21:27:16 +0000 (14:27 -0700)] 
Merge branch 'sh/write-pack-file-warning-message-fix'

A warning from "git pack-objects" were generated by referring to an
incorrect variable when forming the filename that we had trouble
with.

* sh/write-pack-file-warning-message-fix:
  write_pack_file: use correct variable in diagnostic

10 years agoMerge branch 'nd/strbuf-inline-styles'
Junio C Hamano [Fri, 14 Mar 2014 21:27:13 +0000 (14:27 -0700)] 
Merge branch 'nd/strbuf-inline-styles'

* nd/strbuf-inline-styles:
  strbuf: style fix -- top opening bracket on a separate line

10 years agoMerge branch 'jn/bisect-coding-style'
Junio C Hamano [Fri, 14 Mar 2014 21:27:11 +0000 (14:27 -0700)] 
Merge branch 'jn/bisect-coding-style'

* jn/bisect-coding-style:
  git-bisect.sh: fix a few style issues

10 years agoMerge branch 'mh/replace-refs-variable-rename'
Junio C Hamano [Fri, 14 Mar 2014 21:27:06 +0000 (14:27 -0700)] 
Merge branch 'mh/replace-refs-variable-rename'

* mh/replace-refs-variable-rename:
  Document some functions defined in object.c
  Add docstrings for lookup_replace_object() and do_lookup_replace_object()
  rename read_replace_refs to check_replace_refs

10 years agoMerge branch 'sg/archive-restrict-remote'
Junio C Hamano [Fri, 14 Mar 2014 21:27:02 +0000 (14:27 -0700)] 
Merge branch 'sg/archive-restrict-remote'

Allow loosening remote "git archive" invocation security check that
refuses to serve tree-ish not at the tip of any ref.

* sg/archive-restrict-remote:
  add uploadarchive.allowUnreachable option
  docs: clarify remote restrictions for git-upload-archive

10 years agoMerge branch 'rt/help-pretty-prints-cmd-names'
Junio C Hamano [Fri, 14 Mar 2014 21:27:00 +0000 (14:27 -0700)] 
Merge branch 'rt/help-pretty-prints-cmd-names'

* rt/help-pretty-prints-cmd-names:
  help.c: rename function "pretty_print_string_list"

10 years agoMerge branch 'jl/doc-submodule-update-checkout'
Junio C Hamano [Fri, 14 Mar 2014 21:26:58 +0000 (14:26 -0700)] 
Merge branch 'jl/doc-submodule-update-checkout'

Add missing documentation for "submodule update --checkout".

* jl/doc-submodule-update-checkout:
  submodule update: consistently document the '--checkout' option

10 years agoMerge branch 'jk/doc-coding-guideline'
Junio C Hamano [Fri, 14 Mar 2014 21:26:55 +0000 (14:26 -0700)] 
Merge branch 'jk/doc-coding-guideline'

Elaborate on a style niggle that has been part of "mimic existing
code".

* jk/doc-coding-guideline:
  CodingGuidelines: mention C whitespace rules

10 years agoMerge branch 'da/difftool-git-files'
Junio C Hamano [Fri, 14 Mar 2014 21:26:52 +0000 (14:26 -0700)] 
Merge branch 'da/difftool-git-files'

"git difftool" misbehaved when the repository is bound to the
working tree with the ".git file" mechanism, where a textual
file ".git" tells us where it is.

* da/difftool-git-files:
  t7800: add a difftool test for .git-files
  difftool: support repositories with .git-files

10 years agoMerge branch 'tg/index-v4-format'
Junio C Hamano [Fri, 14 Mar 2014 21:26:50 +0000 (14:26 -0700)] 
Merge branch 'tg/index-v4-format'

* tg/index-v4-format:
  read-cache: add index.version config variable
  test-lib: allow setting the index format version
  introduce GIT_INDEX_VERSION environment variable

10 years agoMerge branch 'nd/i18n-progress'
Junio C Hamano [Fri, 14 Mar 2014 21:26:31 +0000 (14:26 -0700)] 
Merge branch 'nd/i18n-progress'

Mark the progress indicators from various time-consuming commands
for i18n/l10n.

* nd/i18n-progress:
  i18n: mark all progress lines for translation

10 years agoMerge branch 'mh/object-code-cleanup'
Junio C Hamano [Fri, 14 Mar 2014 21:26:29 +0000 (14:26 -0700)] 
Merge branch 'mh/object-code-cleanup'

* mh/object-code-cleanup:
  sha1_file.c: document a bunch of functions defined in the file
  sha1_file_name(): declare to return a const string
  find_pack_entry(): document last_found_pack
  replace_object: use struct members instead of an array

10 years agoMerge branch 'jn/am-doc-hooks'
Junio C Hamano [Fri, 14 Mar 2014 21:26:27 +0000 (14:26 -0700)] 
Merge branch 'jn/am-doc-hooks'

* jn/am-doc-hooks:
  am doc: add a pointer to relevant hooks

10 years agoMerge branch 'jm/stash-doc-k-for-keep'
Junio C Hamano [Fri, 14 Mar 2014 21:26:22 +0000 (14:26 -0700)] 
Merge branch 'jm/stash-doc-k-for-keep'

* jm/stash-doc-k-for-keep:
  stash doc: mention short form -k in save description

10 years agoMerge branch 'jk/remote-pushremote-config-reading'
Junio C Hamano [Fri, 14 Mar 2014 21:26:04 +0000 (14:26 -0700)] 
Merge branch 'jk/remote-pushremote-config-reading'

"git push" did not pay attention to branch.*.pushremote if it is
defined earlier than remote.pushdefault; the order of these two
variables in the configuration file should not matter, but it did by
mistake.

* jk/remote-pushremote-config-reading:
  remote: handle pushremote config in any order

10 years agoMerge branch 'jk/commit-dates-parsing-fix'
Junio C Hamano [Fri, 14 Mar 2014 21:25:44 +0000 (14:25 -0700)] 
Merge branch 'jk/commit-dates-parsing-fix'

Tighten codepaths that parse timestamps in commit objects.

* jk/commit-dates-parsing-fix:
  show_ident_date: fix tz range check
  log: do not segfault on gmtime errors
  log: handle integer overflow in timestamps
  date: check date overflow against time_t
  fsck: report integer overflow in author timestamps
  t4212: test bogus timestamps with git-log

10 years agoMerge branch 'jh/note-trees-record-blobs'
Junio C Hamano [Fri, 14 Mar 2014 21:25:39 +0000 (14:25 -0700)] 
Merge branch 'jh/note-trees-record-blobs'

"git notes -C <blob>" should not take an object that is not a blob.

* jh/note-trees-record-blobs:
  notes: disallow reusing non-blob as a note object

10 years agoMerge branch 'rt/links-for-asciidoctor'
Junio C Hamano [Fri, 14 Mar 2014 21:25:36 +0000 (14:25 -0700)] 
Merge branch 'rt/links-for-asciidoctor'

* rt/links-for-asciidoctor:
  Documentation: fix documentation AsciiDoc links for external urls

10 years agoMerge branch 'nd/no-more-fnmatch'
Junio C Hamano [Fri, 14 Mar 2014 21:25:31 +0000 (14:25 -0700)] 
Merge branch 'nd/no-more-fnmatch'

We started using wildmatch() in place of fnmatch(3); complete the
process and stop using fnmatch(3).

* nd/no-more-fnmatch:
  actually remove compat fnmatch source code
  stop using fnmatch (either native or compat)
  Revert "test-wildmatch: add "perf" command to compare wildmatch and fnmatch"
  use wildmatch() directly without fnmatch() wrapper

10 years agoMerge branch 'ak/gitweb-fit-image'
Junio C Hamano [Fri, 14 Mar 2014 21:25:28 +0000 (14:25 -0700)] 
Merge branch 'ak/gitweb-fit-image'

Instead of allowing an <img> to be shown in whatever size, force
scaling it to fit on the page with max-height/max-width css style
attributes.

* ak/gitweb-fit-image:
  gitweb: Avoid overflowing page body frame with large images

10 years agoMerge branch 'tr/diff-submodule-no-reuse-worktree'
Junio C Hamano [Fri, 14 Mar 2014 21:25:20 +0000 (14:25 -0700)] 
Merge branch 'tr/diff-submodule-no-reuse-worktree'

"git diff --external-diff" incorrectly fed the submodule directory
in the working tree to the external diff driver when it knew it is
the same as one of the versions being compared.

* tr/diff-submodule-no-reuse-worktree:
  diff: do not reuse_worktree_file for submodules

10 years agoMerge branch 'nd/reset-setup-worktree'
Junio C Hamano [Fri, 14 Mar 2014 21:25:02 +0000 (14:25 -0700)] 
Merge branch 'nd/reset-setup-worktree'

"git reset" needs to refresh the index when working in a working
tree (it can also be used to match the index to the HEAD in an
otherwise bare repository), but it failed to set up the working
tree properly, causing GIT_WORK_TREE to be ignored.

* nd/reset-setup-worktree:
  reset: optionally setup worktree and refresh index on --mixed

10 years agoMerge branch 'lb/contrib-contacts-looser-diff-parsing'
Junio C Hamano [Fri, 14 Mar 2014 21:24:59 +0000 (14:24 -0700)] 
Merge branch 'lb/contrib-contacts-looser-diff-parsing'

* lb/contrib-contacts-looser-diff-parsing:
  git-contacts: do not fail parsing of good diffs

10 years agoMerge branch 'ks/config-file-stdin'
Junio C Hamano [Fri, 14 Mar 2014 21:24:40 +0000 (14:24 -0700)] 
Merge branch 'ks/config-file-stdin'

"git config" learned to read from the standard input when "-" is
given as the value to its "--file" parameter (attempting an
operation to update the configuration in the standard input of
course is rejected).

* ks/config-file-stdin:
  config: teach "git config --file -" to read from the standard input
  config: change git_config_with_options() interface
  builtin/config.c: rename check_blob_write() -> check_write()
  config: disallow relative include paths from blobs

10 years agoMerge branch 'jk/janitorial-fixes'
Junio C Hamano [Fri, 14 Mar 2014 21:24:37 +0000 (14:24 -0700)] 
Merge branch 'jk/janitorial-fixes'

* jk/janitorial-fixes:
  open_istream(): do not dereference NULL in the error case
  builtin/mv: don't use memory after free
  utf8: use correct type for values in interval table
  utf8: fix iconv error detection
  notes-utils: handle boolean notes.rewritemode correctly

10 years agoMerge branch 'jk/http-no-curl-easy'
Junio C Hamano [Fri, 14 Mar 2014 21:24:18 +0000 (14:24 -0700)] 
Merge branch 'jk/http-no-curl-easy'

Uses of curl's "multi" interface and "easy" interface do not mix
well when we attempt to reuse outgoing connections.  Teach the RPC
over http code, used in the smart HTTP transport, not to use the
"easy" interface.

* jk/http-no-curl-easy:
  http: never use curl_easy_perform

10 years agoMerge branch 'ss/completion-rec-sub-fetch-push'
Junio C Hamano [Fri, 14 Mar 2014 21:24:15 +0000 (14:24 -0700)] 
Merge branch 'ss/completion-rec-sub-fetch-push'

* ss/completion-rec-sub-fetch-push:
  completion: teach --recurse-submodules to fetch, pull and push

10 years agoMerge branch 'nd/gitignore-trailing-whitespace'
Junio C Hamano [Fri, 14 Mar 2014 21:23:37 +0000 (14:23 -0700)] 
Merge branch 'nd/gitignore-trailing-whitespace'

Trailing whitespaces in .gitignore files, unless they are quoted for
fnmatch(3), e.g. "path\ ", are warned and ignored.

Strictly speaking, this is a backward incompatible change, but very
unlikely to bite any sane user and adjusting should be obvious and
easy.

* nd/gitignore-trailing-whitespace:
  t0008: skip trailing space test on Windows
  dir: ignore trailing spaces in exclude patterns
  dir: warn about trailing spaces in exclude patterns

10 years agoMerge branch 'jc/check-attr-honor-working-tree'
Junio C Hamano [Fri, 14 Mar 2014 21:05:59 +0000 (14:05 -0700)] 
Merge branch 'jc/check-attr-honor-working-tree'

"git check-attr" when (trying to) work on a repository with a
working tree did not work well when the working tree was specified
via --work-tree (and obviously with --git-dir).

The command also works in a bare repository but it reads from the
(possibly stale, irrelevant and/or nonexistent) index, which may
need to be fixed to read from HEAD, but that is a completely
separate issue.  As a related tangent to this separate issue, we
may want to also fix "check-ignore", which refuses to work in a
bare repository, to also operate in a bare one.

* jc/check-attr-honor-working-tree:
  check-attr: move to the top of working tree when in non-bare repository
  t0003: do not chdir the whole test process

10 years agot0008: skip trailing space test on Windows
Johannes Sixt [Tue, 11 Mar 2014 07:46:40 +0000 (08:46 +0100)] 
t0008: skip trailing space test on Windows

The Windows API does not preserve file names with trailing spaces (and
dots), but rather strips them. Our tools (MSYS bash, git) base the POSIX
emulation on the Windows API. As a consequence, it is impossible for bash
on Windows to allocate a file whose name has trailing spaces, and for git
to stat such a file. Both operate on a file whose name has the spaces
stripped. Skip the test that needs such a file name.

Note that we do not use (another incarnation of) prerequisite FUNNYNAMES.
The reason is that FUNNYNAMES is intended to represent a property of the
file system. But the inability to have trailing spaces in a file name is
a property of the Windows API. The file system (NTFS) does not have this
limitation.

Signed-off-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoStart preparing for Git 2.0
Junio C Hamano [Fri, 7 Mar 2014 23:12:19 +0000 (15:12 -0800)] 
Start preparing for Git 2.0

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'cc/starts-n-ends-with-endgame'
Junio C Hamano [Fri, 7 Mar 2014 23:18:17 +0000 (15:18 -0800)] 
Merge branch 'cc/starts-n-ends-with-endgame'

prefixcmp/suffixcmp are gone.

10 years agoMerge branch 'jc/hold-diff-remove-q-synonym-for-no-deletion'
Junio C Hamano [Fri, 7 Mar 2014 23:17:40 +0000 (15:17 -0800)] 
Merge branch 'jc/hold-diff-remove-q-synonym-for-no-deletion'

Remove a confusing and deprecated "-q" option from "git diff-files";
"git diff-files --diff-filter=d" can be used instead.

10 years agoMerge branch 'gj/push-more-verbose-advice'
Junio C Hamano [Fri, 7 Mar 2014 23:17:20 +0000 (15:17 -0800)] 
Merge branch 'gj/push-more-verbose-advice'

10 years agoMerge branch 'jc/core-checkstat-2.0'
Junio C Hamano [Fri, 7 Mar 2014 23:16:22 +0000 (15:16 -0800)] 
Merge branch 'jc/core-checkstat-2.0'

"core.statinfo" configuration variable, which was a never-advertised
synonym to "core.checkstat", has been removed.

10 years agoMerge branch 'jc/add-2.0-ignore-removal'
Junio C Hamano [Fri, 7 Mar 2014 23:14:47 +0000 (15:14 -0800)] 
Merge branch 'jc/add-2.0-ignore-removal'

"git add <pathspec>" is the same as "git add -A <pathspec>" now,
i.e. it does not ignore removals from the directory specified.

10 years agoMerge branch 'jn/add-2.0-u-A-sans-pathspec'
Junio C Hamano [Fri, 7 Mar 2014 23:14:01 +0000 (15:14 -0800)] 
Merge branch 'jn/add-2.0-u-A-sans-pathspec'

"git add -u" and "git add -A" without any pathspec is a tree-wide
operation now, even when they are run in a subdirectory of the
working tree.

10 years agoMerge branch 'jc/push-2.0-default-to-simple'
Junio C Hamano [Fri, 7 Mar 2014 23:13:15 +0000 (15:13 -0800)] 
Merge branch 'jc/push-2.0-default-to-simple'

Finally update the "git push" default behaviour to "simple".

10 years agoshow_ident_date: fix tz range check
Jeff King [Fri, 7 Mar 2014 17:15:01 +0000 (12:15 -0500)] 
show_ident_date: fix tz range check

Commit 1dca155fe3fa (log: handle integer overflow in
timestamps, 2014-02-24) tried to catch integer overflow
coming from strtol() on the timezone field by comparing against
LONG_MIN/LONG_MAX. However, the intermediate "tz" variable
is an "int", which means it can never be LONG_MAX on LP64
systems; we would truncate the output from strtol before the
comparison.

Clang's -Wtautological-constant-out-of-range-compare notices
this and rightly complains.

Let's instead store the result of strtol in a long, and then
compare it against INT_MIN/INT_MAX. This will catch overflow
from strtol, and also overflow when we pass the result as an
int to show_date.

Reported-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'maint'
Junio C Hamano [Wed, 5 Mar 2014 23:06:59 +0000 (15:06 -0800)] 
Merge branch 'maint'

* maint:
  i18n: proposed command missing leading dash

10 years agoMerge branch 'jk/run-network-tests-by-default'
Junio C Hamano [Wed, 5 Mar 2014 23:06:42 +0000 (15:06 -0800)] 
Merge branch 'jk/run-network-tests-by-default'

Teach "make test" to run networking tests when possible by default.

* jk/run-network-tests-by-default:
  tests: turn on network daemon tests by default

10 years agoMerge branch 'nd/daemonize-gc'
Junio C Hamano [Wed, 5 Mar 2014 23:06:38 +0000 (15:06 -0800)] 
Merge branch 'nd/daemonize-gc'

Allow running "gc --auto" in the background.

* nd/daemonize-gc:
  gc: config option for running --auto in background
  daemon: move daemonize() to libgit.a

10 years agoMerge branch 'ks/combine-diff'
Junio C Hamano [Wed, 5 Mar 2014 23:06:26 +0000 (15:06 -0800)] 
Merge branch 'ks/combine-diff'

Teach combine-diff to honour the path-output-order imposed by
diffcore-order, and optimize how matching paths are found in
the N-way diffs made with parents.

* ks/combine-diff:
  tests: add checking that combine-diff emits only correct paths
  combine-diff: simplify intersect_paths() further
  combine-diff: combine_diff_path.len is not needed anymore
  combine-diff: optimize combine_diff_path sets intersection
  diff test: add tests for combine-diff with orderfile
  diffcore-order: export generic ordering interface

10 years agot7800: add a difftool test for .git-files
Junio C Hamano [Wed, 5 Mar 2014 09:23:35 +0000 (01:23 -0800)] 
t7800: add a difftool test for .git-files

Signed-off-by: David Aguilar <davvid@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoi18n: proposed command missing leading dash
Sandy Carter [Mon, 3 Mar 2014 14:55:53 +0000 (09:55 -0500)] 
i18n: proposed command missing leading dash

Add missing leading dash to proposed commands in french output when
using the command:
    git branch --set-upstream remotename/branchname
and when upstream is gone

Signed-off-by: Sandy Carter <sandy.carter@savoirfairelinux.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit.c: use skip_prefix() instead of starts_with()
Tanay Abhra [Tue, 4 Mar 2014 21:06:30 +0000 (13:06 -0800)] 
commit.c: use skip_prefix() instead of starts_with()

In record_author_date() & parse_gpg_output(), the callers of
starts_with() not just want to know if the string starts with the
prefix, but also can benefit from knowing the string that follows
the prefix.

By using skip_prefix(), we can do both at the same time.

Helped-by: Max Horn <max@quendi.de>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Tanay Abhra <tanayabh@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-bisect.sh: fix a few style issues
Jacopo Notarstefano [Tue, 4 Mar 2014 00:21:43 +0000 (01:21 +0100)] 
git-bisect.sh: fix a few style issues

Redirection operators should have a space before them, but not after them.

Signed-off-by: Jacopo Notarstefano <jacopo.notarstefano@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-add--interactive: warn if module for interactive.singlekey is missing
Simon Ruderich [Mon, 3 Mar 2014 21:16:12 +0000 (22:16 +0100)] 
git-add--interactive: warn if module for interactive.singlekey is missing

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Simon Ruderich <simon@ruderich.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agogit-config: document interactive.singlekey requires Term::ReadKey
Simon Ruderich [Mon, 3 Mar 2014 21:15:50 +0000 (22:15 +0100)] 
git-config: document interactive.singlekey requires Term::ReadKey

Most distributions don't require Term::ReadKey as dependency, leaving
the user to wonder why the setting doesn't work.

Signed-off-by: Simon Ruderich <simon@ruderich.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agostrbuf: style fix -- top opening bracket on a separate line
Nguyễn Thái Ngọc Duy [Sat, 1 Mar 2014 02:50:55 +0000 (09:50 +0700)] 
strbuf: style fix -- top opening bracket on a separate line

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agowrite_pack_file: use correct variable in diagnostic
Sun He [Sun, 2 Mar 2014 07:30:11 +0000 (15:30 +0800)] 
write_pack_file: use correct variable in diagnostic

'pack_tmp_name' is the subject of the utime() check, so report it in the
warning, not the uninitialized 'tmpname'

Signed-off-by: Sun He <sunheehnus@gmail.com>
Reviewed-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosubmodule update: consistently document the '--checkout' option
Jens Lehmann [Fri, 28 Feb 2014 22:41:11 +0000 (22:41 +0000)] 
submodule update: consistently document the '--checkout' option

Commit 322bb6e12f (add update 'none' flag to disable update of submodule
by default) added the '--checkout' option to "git submodule update" but
forgot to explicitly document it in synopsis, usage string and man page
(It is only mentioned implicitly in the man page). In 23d25e48 (submodule:
explicit local branch creation in module_clone) the synopsis of the man
page was updated, but the "OPTIONS" section of the man page and the usage
string of the git-submodule script still do not mention the '--checkout'
option.

Fix that by documenting this option in usage string and the "OPTIONS"
section of man page too. While at it group the update-mode options into
a single set in the usage string.

Reported-by: Matthijs Kooijman <matthijs@stdin.nl>
Signed-off-by: Jens Lehmann <Jens.Lehmann@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agohelp.c: rename function "pretty_print_string_list"
Ralf Thielow [Fri, 28 Feb 2014 19:27:29 +0000 (20:27 +0100)] 
help.c: rename function "pretty_print_string_list"

The part "string_list" of the name of function
"pretty_print_string_list" is just an implementation
detail. The function pretty-prints command names so
rename it to "pretty_print_cmdnames".

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoDocument some functions defined in object.c
Michael Haggerty [Fri, 28 Feb 2014 16:29:17 +0000 (17:29 +0100)] 
Document some functions defined in object.c

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoAdd docstrings for lookup_replace_object() and do_lookup_replace_object()
Michael Haggerty [Fri, 28 Feb 2014 16:29:16 +0000 (17:29 +0100)] 
Add docstrings for lookup_replace_object() and do_lookup_replace_object()

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoCodingGuidelines: mention C whitespace rules
Jeff King [Fri, 28 Feb 2014 06:17:25 +0000 (01:17 -0500)] 
CodingGuidelines: mention C whitespace rules

We are fairly consistent about these, so most are covered by
"follow existing style", but it doesn't hurt to be explicit.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoadd uploadarchive.allowUnreachable option
Scott J. Goldman [Fri, 28 Feb 2014 10:04:19 +0000 (05:04 -0500)] 
add uploadarchive.allowUnreachable option

In commit ee27ca4, we started restricting remote git-archive
invocations to only accessing reachable commits. This
matches what upload-pack allows, but does restrict some
useful cases (e.g., HEAD:foo). We loosened this in 0f544ee,
which allows `foo:bar` as long as `foo` is a ref tip.
However, that still doesn't allow many useful things, like:

  1. Commits accessible from a ref, like `foo^:bar`, which
     are reachable

  2. Arbitrary sha1s, even if they are reachable.

We can do a full object-reachability check for these cases,
but it can be quite expensive if the client has sent us the
sha1 of a tree; we have to visit every sub-tree of every
commit in the worst case.

Let's instead give site admins an escape hatch, in case they
prefer the more liberal behavior.  For many sites, the full
object database is public anyway (e.g., if you allow dumb
walker access), or the site admin may simply decide the
security/convenience tradeoff is not worth it.

This patch adds a new config option to disable the
restrictions added in ee27ca4. It defaults to off, meaning
there is no change in behavior by default.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodocs: clarify remote restrictions for git-upload-archive
Jeff King [Fri, 28 Feb 2014 10:01:29 +0000 (05:01 -0500)] 
docs: clarify remote restrictions for git-upload-archive

Commits ee27ca4 and 0f544ee introduced rules by which
git-upload-archive would restrict clients from accessing
unreachable objects. However, we never documented those
rules anywhere, nor their reason for being. Let's do so now.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoMerge branch 'nd/http-fetch-shallow-fix'
Junio C Hamano [Thu, 27 Feb 2014 22:01:50 +0000 (14:01 -0800)] 
Merge branch 'nd/http-fetch-shallow-fix'

Attempting to deepen a shallow repository by fetching over smart
HTTP transport failed in the protocol exchange, when no-done
extension was used.  The fetching side waited for the list of
shallow boundary commits after the sending end stopped talking to
it.

* nd/http-fetch-shallow-fix:
  t5537: move http tests out to t5539
  fetch-pack: fix deepen shallow over smart http with no-done cap
  protocol-capabilities.txt: document no-done
  protocol-capabilities.txt: refer multi_ack_detailed back to pack-protocol.txt
  pack-protocol.txt: clarify 'obj-id' in the last ACK after 'done'
  test: rename http fetch and push test files

10 years agoMerge branch 'jk/pack-bitmap'
Junio C Hamano [Thu, 27 Feb 2014 22:01:48 +0000 (14:01 -0800)] 
Merge branch 'jk/pack-bitmap'

Borrow the bitmap index into packfiles from JGit to speed up
enumeration of objects involved in a commit range without having to
fully traverse the history.

* jk/pack-bitmap: (26 commits)
  ewah: unconditionally ntohll ewah data
  ewah: support platforms that require aligned reads
  read-cache: use get_be32 instead of hand-rolled ntoh_l
  block-sha1: factor out get_be and put_be wrappers
  do not discard revindex when re-preparing packfiles
  pack-bitmap: implement optional name_hash cache
  t/perf: add tests for pack bitmaps
  t: add basic bitmap functionality tests
  count-objects: recognize .bitmap in garbage-checking
  repack: consider bitmaps when performing repacks
  repack: handle optional files created by pack-objects
  repack: turn exts array into array-of-struct
  repack: stop using magic number for ARRAY_SIZE(exts)
  pack-objects: implement bitmap writing
  rev-list: add bitmap mode to speed up object lists
  pack-objects: use bitmaps when packing objects
  pack-objects: split add_object_entry
  pack-bitmap: add support for bitmap indexes
  documentation: add documentation for the bitmap format
  ewah: compressed bitmap implementation
  ...

10 years agoMerge branch 'dk/blame-janitorial'
Junio C Hamano [Thu, 27 Feb 2014 22:01:46 +0000 (14:01 -0800)] 
Merge branch 'dk/blame-janitorial'

Code clean-up.

* dk/blame-janitorial:
  builtin/blame.c::find_copy_in_blob: no need to scan for region end
  blame.c: prepare_lines should not call xrealloc for every line
  builtin/blame.c::prepare_lines: fix allocation size of sb->lineno
  builtin/blame.c: eliminate same_suspect()
  builtin/blame.c: struct blame_entry does not need a prev link

10 years agoMerge branch 'bc/gpg-sign-everywhere'
Junio C Hamano [Thu, 27 Feb 2014 22:01:44 +0000 (14:01 -0800)] 
Merge branch 'bc/gpg-sign-everywhere'

Teach "--gpg-sign" option to many commands that create commits.

* bc/gpg-sign-everywhere:
  pull: add the --gpg-sign option.
  rebase: add the --gpg-sign option
  rebase: parse options in stuck-long mode
  rebase: don't try to match -M option
  rebase: remove useless arguments check
  am: add the --gpg-sign option
  am: parse options in stuck-long mode
  git-sh-setup.sh: add variable to use the stuck-long mode
  cherry-pick, revert: add the --gpg-sign option

10 years agoMerge branch 'al/docs'
Junio C Hamano [Thu, 27 Feb 2014 22:01:43 +0000 (14:01 -0800)] 
Merge branch 'al/docs'

A handful of documentation updates, all trivially harmless.

* al/docs:
  docs/git-blame: explain more clearly the example pickaxe use
  docs/git-clone: clarify use of --no-hardlinks option
  docs/git-remote: capitalize first word of initial blurb
  docs/merge-strategies: remove hyphen from mis-merges

10 years agoMerge branch 'jk/test-ports'
Junio C Hamano [Thu, 27 Feb 2014 22:01:42 +0000 (14:01 -0800)] 
Merge branch 'jk/test-ports'

Avoid having to assign port number to be used in tests manually.

* jk/test-ports:
  tests: auto-set git-daemon port
  tests: auto-set LIB_HTTPD_PORT from test name

10 years agoMerge branch 'nd/reset-intent-to-add'
Junio C Hamano [Thu, 27 Feb 2014 22:01:40 +0000 (14:01 -0800)] 
Merge branch 'nd/reset-intent-to-add'

* nd/reset-intent-to-add:
  reset: support "--mixed --intent-to-add" mode

10 years agoMerge branch 'ks/tree-diff-walk'
Junio C Hamano [Thu, 27 Feb 2014 22:01:38 +0000 (14:01 -0800)] 
Merge branch 'ks/tree-diff-walk'

* ks/tree-diff-walk:
  tree-walk: finally switch over tree descriptors to contain a pre-parsed entry
  revision: convert to using diff_tree_sha1()
  line-log: convert to using diff_tree_sha1()
  tree-diff: convert diff_root_tree_sha1() to just call diff_tree_sha1 with old=NULL
  tree-diff: allow diff_tree_sha1 to accept NULL sha1

10 years agoMerge branch 'mw/symlinks'
Junio C Hamano [Thu, 27 Feb 2014 22:01:37 +0000 (14:01 -0800)] 
Merge branch 'mw/symlinks'

All subcommands that take pathspecs mishandled an in-tree symbolic
link when given it as a full path from the root (which arguably is
a sick way to use pathspecs).  "git ls-files -s $(pwd)/RelNotes" in
our tree is an easy reproduction recipe.

* mw/symlinks:
  setup: don't dereference in-tree symlinks for absolute paths
  setup: add abspath_part_inside_repo() function
  t0060: add tests for prefix_path when path begins with work tree
  t0060: add test for prefix_path when path == work tree
  t0060: add test for prefix_path on symlinks via absolute paths
  t3004: add test for ls-files on symlinks via absolute paths

10 years agoMerge branch 'nd/test-rename-reset'
Junio C Hamano [Thu, 27 Feb 2014 22:01:35 +0000 (14:01 -0800)] 
Merge branch 'nd/test-rename-reset'

* nd/test-rename-reset:
  t7101, t7014: rename test files to indicate what that file is for

10 years agoMerge branch 'wk/submodule-on-branch'
Junio C Hamano [Thu, 27 Feb 2014 22:01:31 +0000 (14:01 -0800)] 
Merge branch 'wk/submodule-on-branch'

Make sure 'submodule update' modes that do not detach HEADs can
be used more pleasantly by checking out a concrete branch when
cloning them to prime the well.

* wk/submodule-on-branch:
  Documentation: describe 'submodule update --remote' use case
  submodule: explicit local branch creation in module_clone
  submodule: document module_clone arguments in comments
  submodule: make 'checkout' update_module mode more explicit

10 years agoMerge branch 'ep/varscope'
Junio C Hamano [Thu, 27 Feb 2014 22:01:30 +0000 (14:01 -0800)] 
Merge branch 'ep/varscope'

Shrink lifetime of variables by moving their definitions to an
inner scope where appropriate.

* ep/varscope:
  builtin/gc.c: reduce scope of variables
  builtin/fetch.c: reduce scope of variable
  builtin/commit.c: reduce scope of variables
  builtin/clean.c: reduce scope of variable
  builtin/blame.c: reduce scope of variables
  builtin/apply.c: reduce scope of variables
  bisect.c: reduce scope of variable

10 years agoMerge branch 'bs/stdio-undef-before-redef'
Junio C Hamano [Thu, 27 Feb 2014 22:01:28 +0000 (14:01 -0800)] 
Merge branch 'bs/stdio-undef-before-redef'

When we replace broken macros from stdio.h in git-compat-util.h,
preprocessor.

* bs/stdio-undef-before-redef:
  git-compat-util.h: #undef (v)snprintf before #define them

10 years agoMerge branch 'jk/config-path-include-fix'
Junio C Hamano [Thu, 27 Feb 2014 22:01:25 +0000 (14:01 -0800)] 
Merge branch 'jk/config-path-include-fix'

include.path variable (or any variable that expects a path that can
use ~username expansion) in the configuration file is not a
boolean, but the code failed to check it.

* jk/config-path-include-fix:
  handle_path_include: don't look at NULL value
  expand_user_path: do not look at NULL path

10 years agoMerge branch 'ds/rev-parse-required-args'
Junio C Hamano [Thu, 27 Feb 2014 22:01:23 +0000 (14:01 -0800)] 
Merge branch 'ds/rev-parse-required-args'

"git rev-parse --default" without the required option argument did
not diagnose it as an error.

* ds/rev-parse-required-args:
  rev-parse: check i before using argv[i] against argc

10 years agoMerge branch 'nd/diff-quiet-stat-dirty'
Junio C Hamano [Thu, 27 Feb 2014 22:01:21 +0000 (14:01 -0800)] 
Merge branch 'nd/diff-quiet-stat-dirty'

"git diff --quiet -- pathspec1 pathspec2" sometimes did not return
correct status value.

* nd/diff-quiet-stat-dirty:
  diff: do not quit early on stat-dirty files
  diff.c: move diffcore_skip_stat_unmatch core logic out for reuse later

10 years agoMerge branch 'nd/submodule-pathspec-ending-with-slash'
Junio C Hamano [Thu, 27 Feb 2014 22:01:15 +0000 (14:01 -0800)] 
Merge branch 'nd/submodule-pathspec-ending-with-slash'

Allow "git cmd path/", when the 'path' is where a submodule is
bound to the top-level working tree, to match 'path', despite the
extra and unnecessary trailing slash.

* nd/submodule-pathspec-ending-with-slash:
  clean: use cache_name_is_other()
  clean: replace match_pathspec() with dir_path_match()
  pathspec: pass directory indicator to match_pathspec_item()
  match_pathspec: match pathspec "foo/" against directory "foo"
  dir.c: prepare match_pathspec_item for taking more flags
  pathspec: rename match_pathspec_depth() to match_pathspec()
  pathspec: convert some match_pathspec_depth() to dir_path_match()
  pathspec: convert some match_pathspec_depth() to ce_path_match()

10 years agoMerge branch 'bk/refresh-missing-ok-in-merge-recursive'
Junio C Hamano [Thu, 27 Feb 2014 22:01:14 +0000 (14:01 -0800)] 
Merge branch 'bk/refresh-missing-ok-in-merge-recursive'

Allow "merge-recursive" to work in an empty (temporary) working
tree again when there are renames involved, correcting an old
regression in 1.7.7 era.

* bk/refresh-missing-ok-in-merge-recursive:
  merge-recursive.c: tolerate missing files while refreshing index
  read-cache.c: extend make_cache_entry refresh flag with options
  read-cache.c: refactor --ignore-missing implementation
  t3030-merge-recursive: test known breakage with empty work tree

10 years agoMerge branch 'da/pull-ff-configuration'
Junio C Hamano [Thu, 27 Feb 2014 22:01:11 +0000 (14:01 -0800)] 
Merge branch 'da/pull-ff-configuration'

"git pull" learned to pay attention to pull.ff configuration
variable.

* da/pull-ff-configuration:
  pull: add --ff-only to the help text
  pull: add pull.ff configuration

10 years agoMerge branch 'kb/fast-hashmap'
Junio C Hamano [Thu, 27 Feb 2014 22:01:09 +0000 (14:01 -0800)] 
Merge branch 'kb/fast-hashmap'

Improvements to our hash table to get it to meet the needs of the
msysgit fscache project, with some nice performance improvements.

* kb/fast-hashmap:
  name-hash: retire unused index_name_exists()
  hashmap.h: use 'unsigned int' for hash-codes everywhere
  test-hashmap.c: drop unnecessary #includes
  .gitignore: test-hashmap is a generated file
  read-cache.c: fix memory leaks caused by removed cache entries
  builtin/update-index.c: cleanup update_one
  fix 'git update-index --verbose --again' output
  remove old hash.[ch] implementation
  name-hash.c: remove cache entries instead of marking them CE_UNHASHED
  name-hash.c: use new hash map implementation for cache entries
  name-hash.c: remove unreferenced directory entries
  name-hash.c: use new hash map implementation for directories
  diffcore-rename.c: use new hash map implementation
  diffcore-rename.c: simplify finding exact renames
  diffcore-rename.c: move code around to prepare for the next patch
  buitin/describe.c: use new hash map implementation
  add a hashtable implementation that supports O(1) removal
  submodule: don't access the .gitmodules cache entry after removing it

10 years agoMerge branch 'nv/commit-gpgsign-config'
Junio C Hamano [Thu, 27 Feb 2014 22:01:03 +0000 (14:01 -0800)] 
Merge branch 'nv/commit-gpgsign-config'

Introduce commit.gpgsign configuration variable to force every
commit to be GPG signed.  The variable cannot be overriden from the
command line of some of the commands that create commits except for
"git commit" and "git commit-tree", but I am not convinced that it
is a good idea to sprinkle support for --no-gpg-sign everywhere,
which in turn means that this configuration variable may not be
such a good idea.

* nv/commit-gpgsign-config:
  test the commit.gpgsign config option
  commit-tree: add and document --no-gpg-sign
  commit-tree: add the commit.gpgsign option to sign all commits

10 years agobuiltin/blame.c::find_copy_in_blob: no need to scan for region end
David Kastrup [Sat, 22 Feb 2014 16:02:47 +0000 (17:02 +0100)] 
builtin/blame.c::find_copy_in_blob: no need to scan for region end

The region end can be looked up just like its beginning.

Signed-off-by: David Kastrup <dak@gnu.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agosha1_file.c: document a bunch of functions defined in the file
Michael Haggerty [Fri, 21 Feb 2014 16:32:06 +0000 (17:32 +0100)] 
sha1_file.c: document a bunch of functions defined in the file

Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Nicolas Pitre <nico@fluxnic.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoname-hash: retire unused index_name_exists()
Eric Sunshine [Thu, 2 Jan 2014 21:57:12 +0000 (16:57 -0500)] 
name-hash: retire unused index_name_exists()

db5360f3f496 (name-hash: refactor polymorphic index_name_exists();
2013-09-17) split index_name_exists() into index_file_exists() and
index_dir_exists() but retained index_name_exists() as a thin wrapper
to avoid disturbing possible in-flight topics. Since this change
landed in 'master' some time ago and there are no in-flight topics
referencing index_name_exists(), retire it.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agohashmap.h: use 'unsigned int' for hash-codes everywhere
Karsten Blees [Wed, 18 Dec 2013 13:41:27 +0000 (14:41 +0100)] 
hashmap.h: use 'unsigned int' for hash-codes everywhere

Signed-off-by: Karsten Blees <blees@dcon.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotest the commit.gpgsign config option
Nicolas Vigier [Mon, 16 Dec 2013 13:55:04 +0000 (14:55 +0100)] 
test the commit.gpgsign config option

The tests are checking that :

- when commit.gpgsign is true, "git commit" creates signed commits

- when commit.gpgsign is false, "git commit" creates unsigned commits

- when commit.gpgsign is true, "git commit --no-gpg-sign" creates
  unsigned commits

- when commit.gpgsign is true, "git rebase -f" creates signed commits

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit-tree: add and document --no-gpg-sign
Junio C Hamano [Fri, 13 Dec 2013 23:40:35 +0000 (15:40 -0800)] 
commit-tree: add and document --no-gpg-sign

Document how to override commit.gpgsign configuration that is set to
true per "git commit" invocation (parse-options machinery lets us
say "--no-gpg-sign" to do so).

"git commit-tree" does not use parse-options, so manually add the
corresponding option for now.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocommit-tree: add the commit.gpgsign option to sign all commits
Nicolas Vigier [Mon, 4 Nov 2013 23:14:41 +0000 (00:14 +0100)] 
commit-tree: add the commit.gpgsign option to sign all commits

If you want to GPG sign all your commits, you have to add the -S option
all the time. The commit.gpgsign config option allows to sign all
commits automatically.

Signed-off-by: Nicolas Vigier <boklm@mars-attacks.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodiff: do not quit early on stat-dirty files
Nguyễn Thái Ngọc Duy [Sat, 25 Jan 2014 06:46:50 +0000 (13:46 +0700)] 
diff: do not quit early on stat-dirty files

When QUICK is set (i.e. with --quiet) we try to do as little work as
possible, stopping after seeing the first change. stat-dirty is
considered a "change" but it may turn out not, if no actual content is
changed. The actual content test is performed too late in the process
and the shortcut may be taken prematurely, leading to incorrect return
code.

Assume we do "git diff --quiet". If we have a stat-dirty file "a" and
a really dirty file "b". We break the loop in run_diff_files() and
stop after "a" because we have got a "change". Later in
diffcore_skip_stat_unmatch() we find out "a" is actually not
changed. But there's nothing else in the diff queue, we incorrectly
declare "no change", ignoring the fact that "b" is changed.

This also happens to "git diff --quiet HEAD" when it hits
diff_can_quit_early() in oneway_diff().

This patch does the content test earlier in order to keep going if "a"
is unchanged. The test result is cached so that when
diffcore_skip_stat_unmatch() is done in the end, we spend no cycles on
re-testing "a".

Reported-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodiff.c: move diffcore_skip_stat_unmatch core logic out for reuse later
Nguyễn Thái Ngọc Duy [Sat, 25 Jan 2014 06:46:49 +0000 (13:46 +0700)] 
diff.c: move diffcore_skip_stat_unmatch core logic out for reuse later

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotests: add checking that combine-diff emits only correct paths
Kirill Smelkov [Mon, 3 Feb 2014 09:08:49 +0000 (13:08 +0400)] 
tests: add checking that combine-diff emits only correct paths

where "correct paths" stands for paths that are different to all
parents.

Up until now, we were testing combined diff only on one file, or on
several files which were all different (t4038-diff-combined.sh).

As recent thinko in "simplify intersect_paths() further" showed, and
also, since we are going to rework code for finding paths different to
all parents, lets write at least basic tests.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocombine-diff: simplify intersect_paths() further
Junio C Hamano [Tue, 28 Jan 2014 21:55:59 +0000 (13:55 -0800)] 
combine-diff: simplify intersect_paths() further

Linus once said:

    I actually wish more people understood the really core low-level
    kind of coding. Not big, complex stuff like the lockless name
    lookup, but simply good use of pointers-to-pointers etc. For
    example, I've seen too many people who delete a singly-linked
    list entry by keeping track of the "prev" entry, and then to
    delete the entry, doing something like

if (prev)
    prev->next = entry->next;
else
    list_head = entry->next;

    and whenever I see code like that, I just go "This person
    doesn't understand pointers". And it's sadly quite common.

    People who understand pointers just use a "pointer to the entry
    pointer", and initialize that with the address of the
    list_head. And then as they traverse the list, they can remove
    the entry without using any conditionals, by just doing a "*pp =
    entry->next".

Applying that simplification lets us lose 7 lines from this function
even while adding 2 lines of comment.

I was tempted to squash this into the original commit, but because
the benchmarking described in the commit log is without this
simplification, I decided to keep it a separate follow-up patch.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocombine-diff: combine_diff_path.len is not needed anymore
Kirill Smelkov [Mon, 20 Jan 2014 16:20:41 +0000 (20:20 +0400)] 
combine-diff: combine_diff_path.len is not needed anymore

The field was used in order to speed-up name comparison and also to
mark removed paths by setting it to 0.

Because the updated code does significantly less strcmp and also
just removes paths from the list and free right after we know a path
will not be needed, it is not needed anymore.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agocombine-diff: optimize combine_diff_path sets intersection
Kirill Smelkov [Mon, 20 Jan 2014 16:20:40 +0000 (20:20 +0400)] 
combine-diff: optimize combine_diff_path sets intersection

When generating combined diff, for each commit, we intersect diff
paths from diff(parent_0,commit) to diff(parent_i,commit) comparing
all paths pairs, i.e. doing it the quadratic way. That is correct,
but could be optimized.

Paths come from trees in sorted (= tree) order, and so does diff_tree()
emits resulting paths in that order too. Now if we look at diffcore
transformations, all of them, except diffcore_order, preserve resulting
path ordering:

    - skip_stat_unmatch, grep, pickaxe, filter
                            -- just skip elements -> order stays preserved

    - break                 -- just breaks diff for a path, adding path
                               dup after the path -> order stays preserved

    - detect rename/copy    -- resulting paths are emitted sorted
                               (verified empirically)

So only diffcore_order changes diff paths ordering.

But diffcore_order meaning affects only presentation - i.e. only how to
show the diff, so we could do all the internal computations without
paths reordering, and order only resultant paths set. This is faster,
since, if we know two paths sets are all ordered, their intersection
could be done in linear time.

This patch does just that.

Timings for `git log --raw --no-abbrev --no-renames` without `-c` ("git log")
and with `-c` ("git log -c") before and after the patch are as follows:

                linux.git v3.10..v3.11

            log     log -c

    before  1.9s    20.4s
    after   1.9s    16.6s

                navy.git    (private repo)

            log     log -c

    before  0.83s   15.6s
    after   0.83s    2.1s

P.S.

I think linux.git case is sped up not so much as the second one, since
in navy.git, there are more exotic (subtree, etc) merges.

P.P.S.

My tracing showed that the rest of the time (16.6s vs 1.9s) is usually
spent in computing huge diffs from commit to second parent. Will try to
deal with it, if I'll have time.

P.P.P.S.

For combine_diff_path, ->len is not needed anymore - will remove it in
the next noisy cleanup path, to maintain good signal/noise ratio here.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodiff test: add tests for combine-diff with orderfile
Kirill Smelkov [Mon, 20 Jan 2014 16:20:39 +0000 (20:20 +0400)] 
diff test: add tests for combine-diff with orderfile

In the next patch combine-diff will have special code-path for taking
orderfile into account. Prepare for making changes by introducing
coverage tests for that case.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agodiffcore-order: export generic ordering interface
Kirill Smelkov [Mon, 20 Jan 2014 16:20:38 +0000 (20:20 +0400)] 
diffcore-order: export generic ordering interface

diffcore_order() interface only accepts a queue of `struct
diff_filepair`.

In the next patches, we'll want to order `struct combine_diff_path`
by path, so let's first rework diffcore-order to also provide
generic low-level interface for ordering arbitrary objects, provided
they have path accessors.

The new interface is:

    - `struct obj_order`    for describing objects to ordering routine, and
    - order_objects()       for actually doing the ordering work.

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agotree-walk: finally switch over tree descriptors to contain a pre-parsed entry
Kirill Smelkov [Thu, 6 Feb 2014 11:36:31 +0000 (15:36 +0400)] 
tree-walk: finally switch over tree descriptors to contain a pre-parsed entry

This continues 4651ece8 (Switch over tree descriptors to contain a
pre-parsed entry) and moves the only rest computational part

    mode = canon_mode(mode)

from tree_entry_extract() to tree entry decode phase - to
decode_tree_entry().

The reason to do it, is that canon_mode() is at least 2 conditional
jumps for regular files, and that could be noticeable should canon_mode()
be invoked several times.

That does not matter for current Git codebase, where typical tree
traversal is

    while (t->size) {
        sha1 = tree_entry_extract(t, &path, &mode);
        ...
        update_tree_entry(t);
    }

i.e. we do t -> sha1,path.mode "extraction" only once per entry. In such
cases, it does not matter performance-wise, where that mode
canonicalization is done - either once in tree_entry_extract(), or once
in decode_tree_entry() called by update_tree_entry() - it is
approximately the same.

But for future code, which could need to work with several tree_desc's
in parallel, it could be handy to operate on tree_desc descriptors, and
do "extracts" only when needed, or at all, access only relevant part of
it through structure fields directly.

And for such situations, having canon_mode() be done once in decode
phase is better - we won't need to pay the performance price of 2 extra
conditional jumps on every t->mode access.

So let's move mode canonicalization to decode_tree_entry(). That was the
final bit. Now after tree entry is decoded, it is fully ready and could
be accessed either directly via field, or through tree_entry_extract()
which this time got really "totally trivial".

Signed-off-by: Kirill Smelkov <kirr@mns.spb.ru>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoclean: use cache_name_is_other()
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:35 +0000 (20:40 +0700)] 
clean: use cache_name_is_other()

cmd_clean() has the exact same code of index_name_is_other(). Reduce
code duplication.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agoclean: replace match_pathspec() with dir_path_match()
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:34 +0000 (20:40 +0700)] 
clean: replace match_pathspec() with dir_path_match()

This instance was left out when many match_pathspec() call sites that
take input from dir_entry were converted to dir_path_match() because
it passed a path with the trailing slash stripped out to match_pathspec()
while the others did not. Stripping for all call sites back then would
be a regression because match_pathspec() did not know how to match
pathspec foo/ against _directory_ foo (the stripped version of path
"foo/").

match_pathspec() knows how to do it now. And dir_path_match() strips
the trailing slash also. Use the new function, because the stripping
code is removed in the next patch.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
10 years agopathspec: pass directory indicator to match_pathspec_item()
Nguyễn Thái Ngọc Duy [Fri, 24 Jan 2014 13:40:33 +0000 (20:40 +0700)] 
pathspec: pass directory indicator to match_pathspec_item()

This patch activates the DO_MATCH_DIRECTORY code in m_p_i(), which
makes "git diff HEAD submodule/" and "git diff HEAD submodule" produce
the same output. Previously only the version without trailing slash
returns the difference (if any).

That's the effect of new ce_path_match(). dir_path_match() is not
executed by the new tests. And it should not introduce regressions.

Previously if path "dir/" is passed in with pathspec "dir/", they
obviously match. With new dir_path_match(), the path becomes
_directory_ "dir" vs pathspec "dir/", which is not executed by the old
code path in m_p_i(). The new code path is executed and produces the
same result.

The other case is pathspec "dir" and path "dir/" is now turned to
"dir" (with DO_MATCH_DIRECTORY). Still the same result before or after
the patch.

So why change? Because of the next patch about clean.c.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>