]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
6 years agoMerge branch 'sb/object-store'
Junio C Hamano [Wed, 11 Apr 2018 04:09:55 +0000 (13:09 +0900)] 
Merge branch 'sb/object-store'

Refactoring the internal global data structure to make it possible
to open multiple repositories, work with and then close them.

Rerolled by Duy on top of a separate preliminary clean-up topic.
The resulting structure of the topics looked very sensible.

* sb/object-store: (27 commits)
  sha1_file: allow sha1_loose_object_info to handle arbitrary repositories
  sha1_file: allow map_sha1_file to handle arbitrary repositories
  sha1_file: allow map_sha1_file_1 to handle arbitrary repositories
  sha1_file: allow open_sha1_file to handle arbitrary repositories
  sha1_file: allow stat_sha1_file to handle arbitrary repositories
  sha1_file: allow sha1_file_name to handle arbitrary repositories
  sha1_file: add repository argument to sha1_loose_object_info
  sha1_file: add repository argument to map_sha1_file
  sha1_file: add repository argument to map_sha1_file_1
  sha1_file: add repository argument to open_sha1_file
  sha1_file: add repository argument to stat_sha1_file
  sha1_file: add repository argument to sha1_file_name
  sha1_file: allow prepare_alt_odb to handle arbitrary repositories
  sha1_file: allow link_alt_odb_entries to handle arbitrary repositories
  sha1_file: add repository argument to prepare_alt_odb
  sha1_file: add repository argument to link_alt_odb_entries
  sha1_file: add repository argument to read_info_alternates
  sha1_file: add repository argument to link_alt_odb_entry
  sha1_file: add raw_object_store argument to alt_odb_usable
  pack: move approximate object count to object store
  ...

6 years agoMerge branch 'jc/test-must-be-empty'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'jc/test-must-be-empty'

Test helper update.

* jc/test-must-be-empty:
  test_must_be_empty: simplify file existence check

6 years agoMerge branch 'cc/perf-aggregate-sort'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'cc/perf-aggregate-sort'

Perf-test update.

* cc/perf-aggregate-sort:
  perf/aggregate: add --sort-by=regression option
  perf/aggregate: add display_dir()

6 years agoMerge branch 'ab/doc-hash-brokenness'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'ab/doc-hash-brokenness'

Doc updates.

* ab/doc-hash-brokenness:
  doc hash-function-transition: clarify what SHAttered means
  doc hash-function-transition: clarify how older gits die on NewHash

6 years agoMerge branch 'bc/hash-independent-tests'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'bc/hash-independent-tests'

Tests that rely on the exact hardcoded values of object names have
been updated in preparation for hash function migration.

* bc/hash-independent-tests:
  t2107: abstract away SHA-1-specific constants
  t2101: abstract away SHA-1-specific constants
  t2101: modernize test style
  t2020: abstract away SHA-1 specific constants
  t1507: abstract away SHA-1-specific constants
  t1411: abstract away SHA-1-specific constants
  t1405: sort reflog entries in a hash-independent way
  t1300: abstract away SHA-1-specific constants
  t1304: abstract away SHA-1-specific constants
  t1011: abstract away SHA-1-specific constants

6 years agoMerge branch 'ab/drop-contrib-examples'
Junio C Hamano [Wed, 11 Apr 2018 04:09:54 +0000 (13:09 +0900)] 
Merge branch 'ab/drop-contrib-examples'

* ab/drop-contrib-examples:
  Remove contrib/examples/*

6 years agoThe second batch for 2.18
Junio C Hamano [Tue, 10 Apr 2018 07:32:45 +0000 (16:32 +0900)] 
The second batch for 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ys/bisect-object-id-missing-conversion-fix'
Junio C Hamano [Tue, 10 Apr 2018 07:28:24 +0000 (16:28 +0900)] 
Merge branch 'ys/bisect-object-id-missing-conversion-fix'

Code clean-up.

* ys/bisect-object-id-missing-conversion-fix:
  bisect: use oid_to_hex() for converting object_id hashes to hex strings

6 years agoMerge branch 'yk/filter-branch-non-committish-refs'
Junio C Hamano [Tue, 10 Apr 2018 07:28:23 +0000 (16:28 +0900)] 
Merge branch 'yk/filter-branch-non-committish-refs'

when refs that do not point at committish are given, "git
filter-branch" gave a misleading error messages.  This has been
corrected.

* yk/filter-branch-non-committish-refs:
  filter-branch: fix errors caused by refs that point at non-committish

6 years agoMerge branch 'nd/trace-with-env'
Junio C Hamano [Tue, 10 Apr 2018 07:28:22 +0000 (16:28 +0900)] 
Merge branch 'nd/trace-with-env'

Code cleanup.

* nd/trace-with-env:
  run-command: use strbuf_addstr() for adding a string to a strbuf

6 years agoMerge branch 'nd/parseopt-completion-more'
Junio C Hamano [Tue, 10 Apr 2018 07:28:22 +0000 (16:28 +0900)] 
Merge branch 'nd/parseopt-completion-more'

The mechanism to use parse-options API to automate the command line
completion continues to get extended and polished.

* nd/parseopt-completion-more:
  completion: use __gitcomp_builtin in _git_cherry
  completion: use __gitcomp_builtin in _git_ls_tree
  completion: delete option-only completion commands
  completion: add --option completion for most builtin commands
  completion: factor out _git_xxx calling code
  completion: mention the oldest version we need to support
  git.c: add hidden option --list-parseopt-builtins
  git.c: move cmd_struct declaration up

6 years agoMerge branch 'ds/bsearch-hash'
Junio C Hamano [Tue, 10 Apr 2018 07:28:22 +0000 (16:28 +0900)] 
Merge branch 'ds/bsearch-hash'

Code to find the length to uniquely abbreviate object names based
on packfile content, which is a relatively recent addtion, has been
optimized to use the same fan-out table.

* ds/bsearch-hash:
  sha1_name: use bsearch_pack() in unique_in_pack()
  sha1_name: use bsearch_pack() for abbreviations
  packfile: define and use bsearch_pack()
  sha1_name: convert struct min_abbrev_data to object_id

6 years agoMerge branch 'ws/rebase-p'
Junio C Hamano [Tue, 10 Apr 2018 07:28:21 +0000 (16:28 +0900)] 
Merge branch 'ws/rebase-p'

Code clean-up.

* ws/rebase-p:
  rebase: remove merges_option and a blank line
  rebase: remove unused code paths from git_rebase__interactive__preserve_merges
  rebase: remove unused code paths from git_rebase__interactive
  rebase: add and use git_rebase__interactive__preserve_merges
  rebase: extract functions out of git_rebase__interactive
  rebase: reindent function git_rebase__interactive
  rebase: update invocation of rebase dot-sourced scripts
  rebase-interactive: simplify pick_on_preserving_merges

6 years agoMerge branch 'jk/diff-highlight-graph-fix'
Junio C Hamano [Tue, 10 Apr 2018 07:28:21 +0000 (16:28 +0900)] 
Merge branch 'jk/diff-highlight-graph-fix'

"diff-highlight" filter (in contrib/) learned to undertand "git log
--graph" output better.

* jk/diff-highlight-graph-fix:
  diff-highlight: detect --graph by indent
  diff-highlight: use flush() helper consistently
  diff-highlight: test graphs with --color
  diff-highlight: test interleaved parallel lines of history
  diff-highlight: prefer "echo" to "cat" in tests
  diff-highlight: use test_tick in graph test
  diff-highlight: correct test graph diagram

6 years agoMerge branch 'nd/remove-ignore-env-field'
Junio C Hamano [Tue, 10 Apr 2018 07:28:20 +0000 (16:28 +0900)] 
Merge branch 'nd/remove-ignore-env-field'

Code clean-up for the "repository" abstraction.

* nd/remove-ignore-env-field:
  repository.h: add comment and clarify repo_set_gitdir
  repository: delete ignore_env member
  sha1_file.c: move delayed getenv(altdb) back to setup_git_env()
  repository.c: delete dead functions
  repository.c: move env-related setup code back to environment.c
  repository: initialize the_repository in main()

6 years agoMerge branch 'ps/contains-id-error-message'
Junio C Hamano [Tue, 10 Apr 2018 07:28:20 +0000 (16:28 +0900)] 
Merge branch 'ps/contains-id-error-message'

"git tag --contains no-such-commit" gave a full list of options
after giving an error message.

* ps/contains-id-error-message:
  parse-options: do not show usage upon invalid option value

6 years agoThe first batch for 2.18 cycle
Junio C Hamano [Mon, 9 Apr 2018 23:31:10 +0000 (08:31 +0900)] 
The first batch for 2.18 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'tg/stash-untracked-with-pathspec-fix'
Junio C Hamano [Mon, 9 Apr 2018 23:25:45 +0000 (08:25 +0900)] 
Merge branch 'tg/stash-untracked-with-pathspec-fix'

"git stash push -u -- <pathspec>" gave an unnecessary and confusing
error message when there was no tracked files that match the
<pathspec>, which has been fixed.

* tg/stash-untracked-with-pathspec-fix:
  stash: drop superfluos pathspec parameter
  stash push -u: don't create empty stash
  stash push: avoid printing errors
  stash: fix nonsense pipeline

6 years agoMerge branch 'nd/worktree-prune'
Junio C Hamano [Mon, 9 Apr 2018 23:25:45 +0000 (08:25 +0900)] 
Merge branch 'nd/worktree-prune'

The way "git worktree prune" worked internally has been simplified,
by assuming how "git worktree move" moves an existing worktree to a
different place.

* nd/worktree-prune:
  worktree prune: improve prune logic when worktree is moved
  worktree: delete dead code
  gc.txt: more details about what gc does

6 years agoMerge branch 'bc/object-id'
Junio C Hamano [Mon, 9 Apr 2018 23:25:45 +0000 (08:25 +0900)] 
Merge branch 'bc/object-id'

Conversion from uchar[20] to struct object_id continues.

* bc/object-id: (36 commits)
  convert: convert to struct object_id
  sha1_file: introduce a constant for max header length
  Convert lookup_replace_object to struct object_id
  sha1_file: convert read_sha1_file to struct object_id
  sha1_file: convert read_object_with_reference to object_id
  tree-walk: convert tree entry functions to object_id
  streaming: convert istream internals to struct object_id
  tree-walk: convert get_tree_entry_follow_symlinks internals to object_id
  builtin/notes: convert static functions to object_id
  builtin/fmt-merge-msg: convert remaining code to object_id
  sha1_file: convert sha1_object_info* to object_id
  Convert remaining callers of sha1_object_info_extended to object_id
  packfile: convert unpack_entry to struct object_id
  sha1_file: convert retry_bad_packed_offset to struct object_id
  sha1_file: convert assert_sha1_type to object_id
  builtin/mktree: convert to struct object_id
  streaming: convert open_istream to use struct object_id
  sha1_file: convert check_sha1_signature to struct object_id
  sha1_file: convert read_loose_object to use struct object_id
  builtin/index-pack: convert struct ref_delta_entry to object_id
  ...

6 years agoMerge branch 'ma/shortlog-revparse'
Junio C Hamano [Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)] 
Merge branch 'ma/shortlog-revparse'

"git shortlog cruft" aborted with a BUG message when run outside a
Git repository.  The command has been taught to complain about
extra and unwanted arguments on its command line instead in such a
case.

* ma/shortlog-revparse:
  shortlog: disallow left-over arguments outside repo
  shortlog: add usage-string for stdin-reading
  git-shortlog.txt: reorder usages

6 years agoMerge branch 'ab/install-symlinks'
Junio C Hamano [Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)] 
Merge branch 'ab/install-symlinks'

The build procedure learned to optionally use symbolic links
(instead of hardlinks and copies) to install "git-foo" for built-in
commands, whose binaries are all identical.

* ab/install-symlinks:
  Makefile: optionally symlink libexec/git-core binaries to bin/git
  Makefile: add a gitexecdir_relative variable
  Makefile: fix broken bindir_relative variable

6 years agoMerge branch 'ml/filter-branch-no-op-error'
Junio C Hamano [Mon, 9 Apr 2018 23:25:44 +0000 (08:25 +0900)] 
Merge branch 'ml/filter-branch-no-op-error'

"git filter-branch" learned to use a different exit code to allow
the callers to tell the case where there was no new commits to
rewrite from other error cases.

* ml/filter-branch-no-op-error:
  filter-branch: return 2 when nothing to rewrite

6 years agoMerge branch 'ab/pcre-v2'
Junio C Hamano [Mon, 9 Apr 2018 23:25:43 +0000 (08:25 +0900)] 
Merge branch 'ab/pcre-v2'

Git can be built to use either v1 or v2 of the PCRE library, and so
far, the build-time configuration USE_LIBPCRE=YesPlease instructed
the build procedure to use v1, but now it means v2.  USE_LIBPCRE1
and USE_LIBPCRE2 can be used to explicitly choose which version to
use, as before.

* ab/pcre-v2:
  Makefile: make USE_LIBPCRE=YesPlease mean v2, not v1
  configure: detect redundant --with-libpcre & --with-libpcre1
  configure: fix a regression in PCRE v1 detection

6 years agoMerge branch 'ti/fetch-everything-local-optim'
Junio C Hamano [Mon, 9 Apr 2018 23:25:43 +0000 (08:25 +0900)] 
Merge branch 'ti/fetch-everything-local-optim'

A "git fetch" from a repository with insane number of refs into a
repository that is already up-to-date still wasted too many cycles
making many lstat(2) calls to see if these objects at the tips
exist as loose objects locally.  These lstat(2) calls are optimized
away by enumerating all loose objects beforehand.

It is unknown if the new strategy negatively affects existing use
cases, fetching into a repository with many loose objects from a
repository with small number of refs.

* ti/fetch-everything-local-optim:
  fetch-pack.c: use oidset to check existence of loose object

6 years agoMerge branch 'en/rename-directory-detection'
Junio C Hamano [Mon, 9 Apr 2018 23:25:43 +0000 (08:25 +0900)] 
Merge branch 'en/rename-directory-detection'

Rename detection logic in "diff" family that is used in "merge" has
learned to guess when all of x/a, x/b and x/c have moved to z/a,
z/b and z/c, it is likely that x/d added in the meantime would also
want to move to z/d by taking the hint that the entire directory
'x' moved to 'z'.  A bug causing dirty files involved in a rename
to be overwritten during merge has also been fixed as part of this
work.

* en/rename-directory-detection: (29 commits)
  merge-recursive: ensure we write updates for directory-renamed file
  merge-recursive: avoid spurious rename/rename conflict from dir renames
  directory rename detection: new testcases showcasing a pair of bugs
  merge-recursive: fix remaining directory rename + dirty overwrite cases
  merge-recursive: fix overwriting dirty files involved in renames
  merge-recursive: avoid clobbering untracked files with directory renames
  merge-recursive: apply necessary modifications for directory renames
  merge-recursive: when comparing files, don't include trees
  merge-recursive: check for file level conflicts then get new name
  merge-recursive: add computation of collisions due to dir rename & merging
  merge-recursive: check for directory level conflicts
  merge-recursive: add get_directory_renames()
  merge-recursive: make a helper function for cleanup for handle_renames
  merge-recursive: split out code for determining diff_filepairs
  merge-recursive: make !o->detect_rename codepath more obvious
  merge-recursive: fix leaks of allocated renames and diff_filepairs
  merge-recursive: introduce new functions to handle rename logic
  merge-recursive: move the get_renames() function
  directory rename detection: tests for handling overwriting dirty files
  directory rename detection: tests for handling overwriting untracked files
  ...

6 years agoGit 2.17 v2.17.0
Junio C Hamano [Mon, 2 Apr 2018 17:13:35 +0000 (10:13 -0700)] 
Git 2.17

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge tag 'l10n-2.17.0-rnd1' of git://github.com/git-l10n/git-po
Junio C Hamano [Mon, 2 Apr 2018 17:12:38 +0000 (10:12 -0700)] 
Merge tag 'l10n-2.17.0-rnd1' of git://github.com/git-l10n/git-po

l10n for Git 2.17.0 round 1

* tag 'l10n-2.17.0-rnd1' of git://github.com/git-l10n/git-po:
  l10n: de.po: translate 132 new messages
  l10n: zh_CN: review for git v2.17.0 l10n round 1
  l10n: zh_CN: for git v2.17.0 l10n round 1
  l10n: ko.po: Update Korean translation
  l10n: fr.po: v2.17.0 no fuzzy
  l10n: sv.po: Update Swedish translation (3376t0f0u)
  l10n: Update Catalan translation
  l10n: fr.po v2.17.0 round 1
  l10n: vi.po(3376t): Updated Vietnamese translation for v2.17
  l10n: bg.po: Updated Bulgarian translation (3376t)
  l10n: es.po: Update Spanish translation 2.17.0
  l10n: git.pot: v2.17.0 round 1 (132 new, 44 removed)
  l10n: es.po: fixes to Spanish translation

6 years agoMerge branch 'pw/add-p-single'
Junio C Hamano [Mon, 2 Apr 2018 17:10:54 +0000 (10:10 -0700)] 
Merge branch 'pw/add-p-single'

Hotfix.

* pw/add-p-single:
  add -p: fix 2.17.0-rc* regression due to moved code

6 years agoadd -p: fix 2.17.0-rc* regression due to moved code
Ævar Arnfjörð Bjarmason [Sat, 31 Mar 2018 12:50:58 +0000 (12:50 +0000)] 
add -p: fix 2.17.0-rc* regression due to moved code

Fix a regression in 88f6ffc1c2 ("add -p: only bind search key if
there's more than one hunk", 2018-02-13) which is present in
2.17.0-rc*, but not 2.16.0.

In Perl, regex variables like $1 always refer to the last regex
match. When the aforementioned change added a new regex match between
the old match and the corresponding code that was expecting $1, the $1
variable would always be undef, since the newly inserted regex match
doesn't have any captures.

As a result the "/" feature to search for a string in a hunk by regex
completely broke, on git.git:

    $ perl -pi -e 's/Git/Tig/g' README.md
    $ ./git --exec-path=$PWD add -p
    [..]
    Stage this hunk [y,n,q,a,d,j,J,g,/,s,e,?]? s
    Split into 4 hunks.
    [...]
    Stage this hunk [y,n,q,a,d,j,J,g,/,s,e,?]? /Many
    Use of uninitialized value $1 in string eq at /home/avar/g/git/git-add--interactive line 1568, <STDIN> line 1.
    search for regex? Many

I.e. the initial "/regex" command wouldn't work, and would always emit
a warning and ask again for a regex, now it works as intended again.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agol10n: de.po: translate 132 new messages
Ralf Thielow [Fri, 16 Mar 2018 17:41:16 +0000 (18:41 +0100)] 
l10n: de.po: translate 132 new messages

Translate 132 new messages came from git.pot update in abc8de64d (l10n:
git.pot: v2.17.0 round 1 (132 new, 44 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
6 years agoMerge branch 'jh/partial-clone'
Junio C Hamano [Thu, 29 Mar 2018 22:39:59 +0000 (15:39 -0700)] 
Merge branch 'jh/partial-clone'

Hotfix.

* jh/partial-clone:
  upload-pack: disable object filtering when disabled by config
  unpack-trees: release oid_array after use in check_updates()

6 years agoupload-pack: disable object filtering when disabled by config
Jonathan Nieder [Wed, 28 Mar 2018 20:33:03 +0000 (13:33 -0700)] 
upload-pack: disable object filtering when disabled by config

When upload-pack gained partial clone support (v2.17.0-rc0~132^2~12,
2017-12-08), it was guarded by the uploadpack.allowFilter config item
to allow server operators to control when they start supporting it.

That config item didn't go far enough, though: it controls whether the
'filter' capability is advertised, but if a (custom) client ignores
the capability advertisement and passes a filter specification anyway,
the server would handle that despite allowFilter being false.

This is particularly significant if a security bug is discovered in
this new experimental partial clone code.  Installations without
uploadpack.allowFilter ought not to be affected since they don't
intend to support partial clone, but they would be swept up into being
vulnerable.

Simplify and limit the attack surface by making uploadpack.allowFilter
disable the feature, not just the advertisement of it.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agol10n: zh_CN: review for git v2.17.0 l10n round 1
Ray Chen [Thu, 29 Mar 2018 07:09:20 +0000 (15:09 +0800)] 
l10n: zh_CN: review for git v2.17.0 l10n round 1

Signed-off-by: Ray Chen <oldsharp@gmail.com>
6 years agol10n: zh_CN: for git v2.17.0 l10n round 1
Jiang Xin [Thu, 22 Feb 2018 01:17:34 +0000 (09:17 +0800)] 
l10n: zh_CN: for git v2.17.0 l10n round 1

Translate 132 new messages (3376t0f0u) for git 2.17.0-rc0.

Reviewed-by: 依云 <lilydjwg@gmail.com>
Reviewed-by: Fangyi Zhou <fangyi.zhou@yuriko.moe>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
6 years agoGit 2.17-rc2 v2.17.0-rc2
Junio C Hamano [Wed, 28 Mar 2018 18:05:14 +0000 (11:05 -0700)] 
Git 2.17-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'tg/stash-doc-typofix'
Junio C Hamano [Wed, 28 Mar 2018 18:04:25 +0000 (11:04 -0700)] 
Merge branch 'tg/stash-doc-typofix'

Hotfix.

* tg/stash-doc-typofix:
  git-stash.txt: remove extra square bracket

6 years agoMerge branch 'pc/submodule-helper'
Junio C Hamano [Wed, 28 Mar 2018 18:04:25 +0000 (11:04 -0700)] 
Merge branch 'pc/submodule-helper'

Hotfix.

* pc/submodule-helper:
  submodule deinit: handle non existing pathspecs gracefully

6 years agoMerge branch 'nd/parseopt-completion'
Junio C Hamano [Wed, 28 Mar 2018 18:04:24 +0000 (11:04 -0700)] 
Merge branch 'nd/parseopt-completion'

Hotfix for recently graduated topic that give help to completion
scripts from the Git subcommands that are being completed

* nd/parseopt-completion:
  t9902: disable test on the list of merge-strategies under GETTEXT_POISON
  completion: clear cached --options when sourcing the completion script

6 years agol10n: ko.po: Update Korean translation
Changwoo Ryu [Mon, 19 Mar 2018 04:59:50 +0000 (13:59 +0900)] 
l10n: ko.po: Update Korean translation

Signed-off-by: Changwoo Ryu <cwryu@debian.org>
Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com>
Signed-off-by: Gwan-gyeong Mun <elongbug@gmail.com>
Reviewed-by: Changwoo Ryu <cwryu@debian.org>
6 years agosubmodule deinit: handle non existing pathspecs gracefully
Stefan Beller [Tue, 27 Mar 2018 23:28:24 +0000 (16:28 -0700)] 
submodule deinit: handle non existing pathspecs gracefully

This fixes a regression introduced in 2e612731b5 (submodule: port
submodule subcommand 'deinit' from shell to C, 2018-01-15), when
handling pathspecs that do not exist gracefully. This restores the
historic behavior of reporting the pathspec as unknown and returning
instead of reporting a bug.

Reported-by: Peter Oberndorfer <kumbayo84@arcor.de>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit-stash.txt: remove extra square bracket
Thomas Gummerer [Mon, 26 Mar 2018 21:11:47 +0000 (22:11 +0100)] 
git-stash.txt: remove extra square bracket

In 1ada5020b3 ("stash: use stash_push for no verb form", 2017-02-28),
when the pathspec argument was introduced in 'git stash', that was also
documented.  However I forgot to remove an extra square bracket after
the '--message' argument, even though the square bracket should have
been after the pathspec argument (where it was also added).

Remove the extra square bracket after the '--message' argument, to show
that the pathspec argument should be used with the 'push' verb.

While the pathspec argument can be used without the push verb, that's a
special case described later in the man page, and removing the first extra
square bracket instead of the second one makes the synopis easier to
understand.

Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc hash-function-transition: clarify what SHAttered means
Ævar Arnfjörð Bjarmason [Mon, 26 Mar 2018 18:27:08 +0000 (18:27 +0000)] 
doc hash-function-transition: clarify what SHAttered means

Attempt to clarify what the SHAttered attack means in practice for
Git. The previous version of the text made no mention whatsoever of
Git already having a mitigation for this specific attack, which the
SHAttered researchers claim will detect cryptanalytic collision
attacks.

I may have gotten some of the nuances wrong, but as far as I know this
new text accurately summarizes the current situation with SHA-1 in
git. I.e. git doesn't really use SHA-1 anymore, it uses
Hardened-SHA-1 (they just so happen to produce the same outputs
99.99999999999...% of the time).

Thus the previous text was incorrect in asserting that:

    [...]As a result [of SHAttered], SHA-1 cannot be considered
    cryptographically secure any more[...]

That's not the case. We have a mitigation against SHAttered, *however*
we consider it prudent to move to work towards a NewHash should future
vulnerabilities in either SHA-1 or Hardened-SHA-1 emerge.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc hash-function-transition: clarify how older gits die on NewHash
Ævar Arnfjörð Bjarmason [Mon, 26 Mar 2018 18:27:07 +0000 (18:27 +0000)] 
doc hash-function-transition: clarify how older gits die on NewHash

Change the "Repository format extension" to accurately describe what
happens with different versions of Git when they encounter NewHash
repositories, instead of only saying what happens with versions v2.7.0
and later.

See ab9cb76f66 ("Repository format version check.", 2005-11-25) and
00a09d57eb ("introduce "extensions" form of
core.repositoryformatversion", 2015-06-23) for the relevant changes to
the setup code where these variables are checked.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agotest_must_be_empty: simplify file existence check
SZEDER Gábor [Mon, 26 Mar 2018 13:11:24 +0000 (15:11 +0200)] 
test_must_be_empty: simplify file existence check

Commit 11395a3b4b (test_must_be_empty: make sure the file exists, not
just empty, 2018-02-27) basically duplicated the 'test_path_is_file'
helper function in 'test_must_be_empty'.

Just call 'test_path_is_file' to avoid this code duplication.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoperf/aggregate: add --sort-by=regression option
Christian Couder [Mon, 26 Mar 2018 07:24:31 +0000 (09:24 +0200)] 
perf/aggregate: add --sort-by=regression option

One of the most interesting thing one can be interested in when
looking at performance test results is possible performance
regressions.

This new option makes it easy to spot such possible regressions.

This new option is named '--sort-by=regression' to make it
possible and easy to add other ways to sort the results, like for
example '--sort-by=utime'.

If we would like to sort according to how much the stime regressed
we could also add a new option called '--sort-by=regression:stime'.
Then '--sort-by=regression' could become a synonym for
'--sort-by=regression:rtime'.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoperf/aggregate: add display_dir()
Christian Couder [Mon, 26 Mar 2018 07:24:30 +0000 (09:24 +0200)] 
perf/aggregate: add display_dir()

This new helper function will be reused in a subsequent
commit.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot2107: abstract away SHA-1-specific constants
brian m. carlson [Sun, 25 Mar 2018 19:20:55 +0000 (19:20 +0000)] 
t2107: abstract away SHA-1-specific constants

Use the $EMPTY_BLOB variable instead of hard-coding a hash.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot2101: abstract away SHA-1-specific constants
brian m. carlson [Sun, 25 Mar 2018 19:20:54 +0000 (19:20 +0000)] 
t2101: abstract away SHA-1-specific constants

Adjust the test so that it uses variables and command substitution for
blobs instead of hard-coded hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot2101: modernize test style
brian m. carlson [Sun, 25 Mar 2018 19:20:53 +0000 (19:20 +0000)] 
t2101: modernize test style

Most of our tests start with the opening quote of the test body on the
same line as the test_expect_success call.  Additionally, our tests are
usually indented with a single tab.  Update this test to be the same as
most others, which will make it easier to use inline heredocs in the
future.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot2020: abstract away SHA-1 specific constants
brian m. carlson [Sun, 25 Mar 2018 19:20:52 +0000 (19:20 +0000)] 
t2020: abstract away SHA-1 specific constants

Adjust the test so that it uses variables for the revisions we're
checking out instead of hard-coded hashes.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1507: abstract away SHA-1-specific constants
brian m. carlson [Sun, 25 Mar 2018 19:20:51 +0000 (19:20 +0000)] 
t1507: abstract away SHA-1-specific constants

Adjust the test so that it uses a variable consisting of the current
HEAD instead of a hard-coded hash.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1411: abstract away SHA-1-specific constants
brian m. carlson [Sun, 25 Mar 2018 19:20:50 +0000 (19:20 +0000)] 
t1411: abstract away SHA-1-specific constants

Adjust the test so that it uses a variable consisting of the current
HEAD instead of a hard-coded hash.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1405: sort reflog entries in a hash-independent way
brian m. carlson [Sun, 25 Mar 2018 19:20:49 +0000 (19:20 +0000)] 
t1405: sort reflog entries in a hash-independent way

The test enumerates reflog entries in an arbitrary order and then sorts
them.  For SHA-1, this produces results that happen to sort in
alphabetical order, but for other hash algorithms they sort differently.
Ensure we sort the reflog entries in a hash-independent way by sorting
on the ref name instead of the object ID.  Remove an assumption about
the length of a hash by using cut with the delimiter and field options
instead of the character range option.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1300: abstract away SHA-1-specific constants
brian m. carlson [Sun, 25 Mar 2018 19:20:48 +0000 (19:20 +0000)] 
t1300: abstract away SHA-1-specific constants

Adjust the test so that it uses the computed blob value instead of
hard-coding a hash.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1304: abstract away SHA-1-specific constants
brian m. carlson [Sun, 25 Mar 2018 19:20:47 +0000 (19:20 +0000)] 
t1304: abstract away SHA-1-specific constants

Adjust the test so that it uses the $EMPTY_BLOB value instead of
hard-coding the hash.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot1011: abstract away SHA-1-specific constants
brian m. carlson [Sun, 25 Mar 2018 19:20:46 +0000 (19:20 +0000)] 
t1011: abstract away SHA-1-specific constants

Adjust the test so that it computes the expected hash value dynamically
instead of relying on a hard-coded hash.  Hoist some code earlier in the
test to make this possible.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoRemove contrib/examples/*
Ævar Arnfjörð Bjarmason [Sun, 25 Mar 2018 20:46:53 +0000 (20:46 +0000)] 
Remove contrib/examples/*

There were some side discussions at Git Merge this year about how we
should just update the README to tell users they can dig these up from
the history if the need them, do that.

Looking at the "git log" for this directory we get quite a bit more
patch churn than we should here, mainly from things fixing various
tree-wide issues.

There's also confusion on the list occasionally about how these should
be treated, "Re: [PATCH 1/4] stash: convert apply to
builtin" (<CA+CzEk9QpmHK_TSBwQfEedNqrcVSBp3xY7bdv1YA_KxePiFeXw@mail.gmail.com>)
being the latest example of that.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: allow sha1_loose_object_info to handle arbitrary repositories
Jonathan Nieder [Fri, 23 Mar 2018 17:21:21 +0000 (18:21 +0100)] 
sha1_file: allow sha1_loose_object_info to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: allow map_sha1_file to handle arbitrary repositories
Stefan Beller [Fri, 23 Mar 2018 17:21:20 +0000 (18:21 +0100)] 
sha1_file: allow map_sha1_file to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: allow map_sha1_file_1 to handle arbitrary repositories
Jonathan Nieder [Fri, 23 Mar 2018 17:21:19 +0000 (18:21 +0100)] 
sha1_file: allow map_sha1_file_1 to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: allow open_sha1_file to handle arbitrary repositories
Stefan Beller [Fri, 23 Mar 2018 17:21:18 +0000 (18:21 +0100)] 
sha1_file: allow open_sha1_file to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: allow stat_sha1_file to handle arbitrary repositories
Stefan Beller [Fri, 23 Mar 2018 17:21:17 +0000 (18:21 +0100)] 
sha1_file: allow stat_sha1_file to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: allow sha1_file_name to handle arbitrary repositories
Stefan Beller [Fri, 23 Mar 2018 17:21:16 +0000 (18:21 +0100)] 
sha1_file: allow sha1_file_name to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to sha1_loose_object_info
Stefan Beller [Fri, 23 Mar 2018 17:21:15 +0000 (18:21 +0100)] 
sha1_file: add repository argument to sha1_loose_object_info

Add a repository argument to allow the sha1_loose_object_info caller
to be more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to map_sha1_file
Stefan Beller [Fri, 23 Mar 2018 17:21:14 +0000 (18:21 +0100)] 
sha1_file: add repository argument to map_sha1_file

Add a repository argument to allow map_sha1_file callers to be more
specific about which repository to handle. This is a small mechanical
change; it doesn't change the implementation to handle repositories
other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

While at it, move the declaration to object-store.h, where it should
be easier to find.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to map_sha1_file_1
Stefan Beller [Fri, 23 Mar 2018 17:21:13 +0000 (18:21 +0100)] 
sha1_file: add repository argument to map_sha1_file_1

Add a repository argument to allow the map_sha1_file_1 caller to be
more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to open_sha1_file
Stefan Beller [Fri, 23 Mar 2018 17:21:12 +0000 (18:21 +0100)] 
sha1_file: add repository argument to open_sha1_file

Add a repository argument to allow the open_sha1_file caller to be
more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to stat_sha1_file
Stefan Beller [Fri, 23 Mar 2018 17:21:11 +0000 (18:21 +0100)] 
sha1_file: add repository argument to stat_sha1_file

Add a repository argument to allow the stat_sha1_file caller to be
more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to sha1_file_name
Stefan Beller [Fri, 23 Mar 2018 17:21:10 +0000 (18:21 +0100)] 
sha1_file: add repository argument to sha1_file_name

Add a repository argument to allow sha1_file_name callers to be more
specific about which repository to handle. This is a small mechanical
change; it doesn't change the implementation to handle repositories
other than the_repository yet.

As with the previous commits, use a macro to catch callers passing a
repository other than the_repository at compile time.

While at it, move the declaration to object-store.h, where it should
be easier to find.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: allow prepare_alt_odb to handle arbitrary repositories
Stefan Beller [Fri, 23 Mar 2018 17:21:09 +0000 (18:21 +0100)] 
sha1_file: allow prepare_alt_odb to handle arbitrary repositories

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: allow link_alt_odb_entries to handle arbitrary repositories
Stefan Beller [Fri, 23 Mar 2018 17:21:08 +0000 (18:21 +0100)] 
sha1_file: allow link_alt_odb_entries to handle arbitrary repositories

Actually this also allows read_info_alternates and link_alt_odb_entry to
handle arbitrary repositories, but link_alt_odb_entries is the most
interesting function in this set of functions, hence the commit subject.

These functions span a strongly connected component in the function
graph, i.e. the recursive call chain might look like

  -> link_alt_odb_entries
    -> link_alt_odb_entry
      -> read_info_alternates
        -> link_alt_odb_entries

That is why we need to convert all these functions at the same time.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to prepare_alt_odb
Stefan Beller [Fri, 23 Mar 2018 17:21:07 +0000 (18:21 +0100)] 
sha1_file: add repository argument to prepare_alt_odb

See previous patch for explanation.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to link_alt_odb_entries
Stefan Beller [Fri, 23 Mar 2018 17:21:06 +0000 (18:21 +0100)] 
sha1_file: add repository argument to link_alt_odb_entries

See previous patch for explanation.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to read_info_alternates
Stefan Beller [Fri, 23 Mar 2018 17:21:05 +0000 (18:21 +0100)] 
sha1_file: add repository argument to read_info_alternates

See previous patch for explanation.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add repository argument to link_alt_odb_entry
Stefan Beller [Fri, 23 Mar 2018 17:21:04 +0000 (18:21 +0100)] 
sha1_file: add repository argument to link_alt_odb_entry

Add a repository argument to allow the link_alt_odb_entry caller to be
more specific about which repository to act on. This is a small
mechanical change; it doesn't change the implementation to handle
repositories other than the_repository yet.

Since the implementation does not yet work with other repositories,
use a wrapper macro to enforce that the caller passes in
the_repository as the first argument. It would be more appealing to
use BUILD_ASSERT_OR_ZERO to enforce this, but that doesn't work
because it requires a compile-time constant and common compilers like
gcc 4.8.4 do not consider "r == the_repository" a compile-time
constant.

This and the following three patches add repository arguments to
link_alt_odb_entry, read_info_alternates, link_alt_odb_entries
and prepare_alt_odb. Three out of the four functions are found
in a recursive call chain, calling each other, and one of them
accesses the repositories `objectdir` (which was migrated; it
was an obvious choice) and `ignore_env` (which we need to keep in
the repository struct for clarify); hence we will pass through the
repository unlike just the object store object + the ignore_env flag.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_file: add raw_object_store argument to alt_odb_usable
Stefan Beller [Fri, 23 Mar 2018 17:21:03 +0000 (18:21 +0100)] 
sha1_file: add raw_object_store argument to alt_odb_usable

Add a raw_object_store to alt_odb_usable to be more specific about which
repository to act on. The choice of the repository is delegated to its
only caller link_alt_odb_entry.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopack: move approximate object count to object store
Stefan Beller [Fri, 23 Mar 2018 17:21:02 +0000 (18:21 +0100)] 
pack: move approximate object count to object store

The approximate_object_count() function maintains a rough count of
objects in a repository to estimate how long object name abbreviates
should be.  Object names are scoped to a repository and the
appropriate length may differ by repository, so the object count
should not be global.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopack: move prepare_packed_git_run_once to object store
Stefan Beller [Fri, 23 Mar 2018 17:21:01 +0000 (18:21 +0100)] 
pack: move prepare_packed_git_run_once to object store

Each repository's object store can be initialized independently, so
they must not share a run_once variable.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoobject-store: close all packs upon clearing the object store
Stefan Beller [Fri, 23 Mar 2018 17:21:00 +0000 (18:21 +0100)] 
object-store: close all packs upon clearing the object store

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoobject-store: move packed_git and packed_git_mru to object store
Stefan Beller [Fri, 23 Mar 2018 17:20:59 +0000 (18:20 +0100)] 
object-store: move packed_git and packed_git_mru to object store

In a process with multiple repositories open, packfile accessors
should be associated to a single repository and not shared globally.
Move packed_git and packed_git_mru into the_repository and adjust
callers to reflect this.

[nd: while at there, wrap access to these two fields in get_packed_git()
and get_packed_git_mru(). This allows us to lazily initialize these
fields without caller doing that explicitly]

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agounpack-trees: release oid_array after use in check_updates()
René Scharfe [Sun, 25 Mar 2018 16:31:48 +0000 (18:31 +0200)] 
unpack-trees: release oid_array after use in check_updates()

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agofilter-branch: fix errors caused by refs that point at non-committish
Yuki Kokubun [Sun, 25 Mar 2018 16:54:58 +0000 (16:54 +0000)] 
filter-branch: fix errors caused by refs that point at non-committish

"git filter-branch -- --all" prints error messages when processing refs that
point at objects that are not committish. Such refs can be created by
"git replace" with trees or blobs. And also "git tag" with trees or blobs can
create such refs.

Filter these problematic refs out early, before they are seen by the logic to
see which refs have been modified and which have been left intact (which is
where the unwanted error messages come from), and warn that these refs are left
unwritten while doing so.

Signed-off-by: Yuki Kokubun <orga.chem.job@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorun-command: use strbuf_addstr() for adding a string to a strbuf
René Scharfe [Sun, 25 Mar 2018 10:57:50 +0000 (12:57 +0200)] 
run-command: use strbuf_addstr() for adding a string to a strbuf

Patch generated with Coccinelle and contrib/coccinelle/strbuf.cocci.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agobisect: use oid_to_hex() for converting object_id hashes to hex strings
René Scharfe [Sun, 25 Mar 2018 10:57:36 +0000 (12:57 +0200)] 
bisect: use oid_to_hex() for converting object_id hashes to hex strings

Patch generated with Coccinelle and contrib/coccinelle/object_id.cocci.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Reviewed-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocompletion: use __gitcomp_builtin in _git_cherry
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:25 +0000 (21:35 +0100)] 
completion: use __gitcomp_builtin in _git_cherry

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocompletion: use __gitcomp_builtin in _git_ls_tree
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:24 +0000 (21:35 +0100)] 
completion: use __gitcomp_builtin in _git_ls_tree

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocompletion: delete option-only completion commands
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:23 +0000 (21:35 +0100)] 
completion: delete option-only completion commands

The new function __git_complete_common can take over this job with
less code to maintain.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocompletion: add --option completion for most builtin commands
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:22 +0000 (21:35 +0100)] 
completion: add --option completion for most builtin commands

Many builtin commands use parseopt which can expose the option list
via --git-completion-helper but do not have explicit support in
git-completion.bash. This patch detects those commands and uses
__gitcomp_builtin for option completion.

This does not pollute the command name completion though. "git <tab>"
will show you the same set as before. This only kicks in when you type
the correct command name.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocompletion: factor out _git_xxx calling code
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:21 +0000 (21:35 +0100)] 
completion: factor out _git_xxx calling code

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocompletion: mention the oldest version we need to support
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:20 +0000 (21:35 +0100)] 
completion: mention the oldest version we need to support

This is more of a note for git-completion.bash contributors, not
users. The bash version is from MacOS [1]. Most Linux distros should
be 4.x at this point.

[1] https://public-inbox.org/git/%3CCAPig+cQXT1ov4MjzSzqiLBzr4wN1XcP7aSxMP+_dhtWtYwhDAA@mail.gmail.com%3E/

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit.c: add hidden option --list-parseopt-builtins
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:19 +0000 (21:35 +0100)] 
git.c: add hidden option --list-parseopt-builtins

This is another step to help automate git-completion.bash. This option
gives a list of all builtin commands that do use parse_options(),
which supports another hidden option --git-completion-helper. The
output is prepared for easy consumption by git-completion.bash and
separates items by spaces instead of \n

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agogit.c: move cmd_struct declaration up
Nguyễn Thái Ngọc Duy [Sat, 24 Mar 2018 20:35:18 +0000 (21:35 +0100)] 
git.c: move cmd_struct declaration up

In a later patch we need access to one of these command option
constants near the top of this file. Move this block up so we will be
able to access the command options.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agosha1_name: use bsearch_pack() in unique_in_pack()
René Scharfe [Sat, 24 Mar 2018 16:41:08 +0000 (17:41 +0100)] 
sha1_name: use bsearch_pack() in unique_in_pack()

Replace the custom binary search in unique_in_pack() with a call to
bsearch_pack().  This reduces code duplication and makes use of the
fan-out table of packs.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'fr_v2.17.0' of git://github.com/jnavila/git
Jiang Xin [Sun, 25 Mar 2018 13:24:02 +0000 (21:24 +0800)] 
Merge branch 'fr_v2.17.0' of git://github.com/jnavila/git

* 'fr_v2.17.0' of git://github.com/jnavila/git:
  l10n: fr.po: v2.17.0 no fuzzy

6 years agorebase: remove merges_option and a blank line
Wink Saville [Fri, 23 Mar 2018 21:25:29 +0000 (14:25 -0700)] 
rebase: remove merges_option and a blank line

merges_option is unused in git_rebase__interactive and always empty in
git_rebase__interactive__preserve_merges so it can be removed.

Signed-off-by: Wink Saville <wink@saville.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase: remove unused code paths from git_rebase__interactive__preserve_merges
Wink Saville [Fri, 23 Mar 2018 21:25:28 +0000 (14:25 -0700)] 
rebase: remove unused code paths from git_rebase__interactive__preserve_merges

Since git_rebase__interactive__preserve_merges is now always called with
$preserve_merges = t we can remove the unused code paths.

Signed-off-by: Wink Saville <wink@saville.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase: remove unused code paths from git_rebase__interactive
Wink Saville [Fri, 23 Mar 2018 21:25:27 +0000 (14:25 -0700)] 
rebase: remove unused code paths from git_rebase__interactive

Since git_rebase__interactive is now never called with
$preserve_merges = t we can remove those code paths.

Signed-off-by: Wink Saville <wink@saville.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase: add and use git_rebase__interactive__preserve_merges
Wink Saville [Fri, 23 Mar 2018 21:25:26 +0000 (14:25 -0700)] 
rebase: add and use git_rebase__interactive__preserve_merges

At the moment it's an exact copy of git_rebase__interactive except
the name has changed.

Signed-off-by: Wink Saville <wink@saville.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agorebase: extract functions out of git_rebase__interactive
Wink Saville [Fri, 23 Mar 2018 21:25:25 +0000 (14:25 -0700)] 
rebase: extract functions out of git_rebase__interactive

The extracted functions are:
  - initiate_action
  - setup_reflog_action
  - init_basic_state
  - init_revisions_and_shortrevisions
  - complete_action

Used by git_rebase__interactive

Signed-off-by: Wink Saville <wink@saville.com>
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>