]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
5 years agocompletion: fix __gitcomp_builtin no longer consider extra options
Nguyễn Thái Ngọc Duy [Sun, 21 Oct 2018 08:37:31 +0000 (10:37 +0200)] 
completion: fix __gitcomp_builtin no longer consider extra options

__gitcomp_builtin() has the main completion list provided by

    git xxx --git-completion-helper

but the caller can also add extra options that is not provided by
--git-completion-helper. The only call site that does this is "git
difftool" completion.

This support is broken by b221b5ab9b (completion: collapse extra
--no-.. options - 2018-06-06), which adds a special value "--" to mark
that the rest of the options can be hidden by default. The commit
forgets the fact that extra options are appended after
"$(git xxx --git-completion-helper)", i.e. after this "--", and will
be incorrectly hidden as well.

Prepend the extra options before "$(git xxx --git-completion-helper)"
to avoid this.

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: collapse extra --no-.. options
Nguyễn Thái Ngọc Duy [Wed, 6 Jun 2018 09:41:39 +0000 (11:41 +0200)] 
completion: collapse extra --no-.. options

The commands that make use of --git-completion-helper feature could
now produce a lot of --no-xxx options that a command can take. This in
many case could nearly double the amount of completable options, using
more screen estate and also harder to search for the wanted option.

This patch attempts to mitigate that by collapsing extra --no-
options, the ones that are added by --git-completion-helper and not in
original struct option arrays. The "--no-..." option will be displayed
in this case to hint about more options, e.g.

    > ~/w/git $ git clone --
    --bare                 --origin=
    --branch=              --progress
    --checkout             --quiet
    --config=              --recurse-submodules
    --depth=               --reference=
    --dissociate           --reference-if-able=
    --filter=              --separate-git-dir=
    --hardlinks            --shallow-exclude=
    --ipv4                 --shallow-since=
    --ipv6                 --shallow-submodules
    --jobs=                --shared
    --local                --single-branch
    --mirror               --tags
    --no-...               --template=
    --no-checkout          --upload-pack=
    --no-hardlinks         --verbose
    --no-tags

and when you complete it with --no-<tab>, all negative options will be
presented:

    > ~/w/git $ git clone --no-
    --no-bare                 --no-quiet
    --no-branch               --no-recurse-submodules
    --no-checkout             --no-reference
    --no-config               --no-reference-if-able
    --no-depth                --no-separate-git-dir
    --no-dissociate           --no-shallow-exclude
    --no-filter               --no-shallow-since
    --no-hardlinks            --no-shallow-submodules
    --no-ipv4                 --no-shared
    --no-ipv6                 --no-single-branch
    --no-jobs                 --no-tags
    --no-local                --no-template
    --no-mirror               --no-upload-pack
    --no-origin               --no-verbose
    --no-progress

Corner case: to make sure that people will never accidentally complete
the fake option "--no-..." there must be one real --no- in the first
complete listing even if it's not from the original struct option.

PS. This could could be made simpler with ";&" to fall through from
"--no-*" block and share the code but ";&" is not available on bash-3
(i.e. Mac)

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: suppress some -no- options
Nguyễn Thái Ngọc Duy [Sun, 27 May 2018 08:38:27 +0000 (10:38 +0200)] 
completion: suppress some -no- options

Most --no- options do have some use, even if rarely to negate some
option that's specified in an alias.

These options --no-ours and --no-theirs however have no clear
semantics. If I specify "--ours --no-theirs", the second will reset
writeout stage and is equivalent of "--no-ours --no-theirs" which is
not that easy to see. Drop them. You can either switch from --ours to
--theirs and back but you can never negate them.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoparse-options: option to let --git-completion-helper show negative form
Nguyễn Thái Ngọc Duy [Sun, 27 May 2018 08:38:26 +0000 (10:38 +0200)] 
parse-options: option to let --git-completion-helper show negative form

When 7fb6aefd2a (Merge branch 'nd/parseopt-completion' - 2018-03-14)
is merged, the completion for negative form is left out because the
series is alread long and it could be done in a follow up series. This
is it.

--git-completion-helper now provides --no-xxx so that git-completion.bash
can drop the extra custom --no-xxx in the script. It adds a lot more
--no-xxx than what's current provided by the git-completion.bash
script. We'll trim that down later.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoThe sixth batch for 2.18
Junio C Hamano [Wed, 23 May 2018 05:45:34 +0000 (14:45 +0900)] 
The sixth batch for 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'fg/completion-external'
Junio C Hamano [Wed, 23 May 2018 05:38:25 +0000 (14:38 +0900)] 
Merge branch 'fg/completion-external'

The command line completion mechanism (in contrib/) learned to load
custom completion file for "git $command" where $command is a
custom "git-$command" that the end user has on the $PATH when using
newer version of bash.

* fg/completion-external:
  completion: load completion file for external subcommand

6 years agoMerge branch 'bc/asciidoctor-tab-width'
Junio C Hamano [Wed, 23 May 2018 05:38:25 +0000 (14:38 +0900)] 
Merge branch 'bc/asciidoctor-tab-width'

Asciidoctor gives a reasonable imitation for AsciiDoc, but does not
render illustration in a literal block correctly when indented with
HT by default. The problem is fixed by forcing 8-space tabs.

* bc/asciidoctor-tab-width:
  Documentation: render revisions correctly under Asciidoctor
  Documentation: use 8-space tabs with Asciidoctor

6 years agoMerge branch 'nd/pack-unreachable-objects-doc'
Junio C Hamano [Wed, 23 May 2018 05:38:24 +0000 (14:38 +0900)] 
Merge branch 'nd/pack-unreachable-objects-doc'

Doc update.

* nd/pack-unreachable-objects-doc:
  pack-objects: validation and documentation about unreachable options

6 years agoMerge branch 'nd/completion-aliasfiletype-typofix'
Junio C Hamano [Wed, 23 May 2018 05:38:24 +0000 (14:38 +0900)] 
Merge branch 'nd/completion-aliasfiletype-typofix'

Typofix.

* nd/completion-aliasfiletype-typofix:
  completion: fix misspelled config key aliasesfiletype

6 years agoMerge branch 'em/status-rename-config'
Junio C Hamano [Wed, 23 May 2018 05:38:23 +0000 (14:38 +0900)] 
Merge branch 'em/status-rename-config'

"git status" learned to pay attention to UI related diff
configuration variables such as diff.renames.

* em/status-rename-config:
  wt-status: use settings from git_diff_ui_config

6 years agoMerge branch 'cc/perf-bisect'
Junio C Hamano [Wed, 23 May 2018 05:38:23 +0000 (14:38 +0900)] 
Merge branch 'cc/perf-bisect'

Performance test updates.

* cc/perf-bisect:
  perf/bisect_run_script: disable codespeed

6 years agoMerge branch 'ah/misc-doc-updates'
Junio C Hamano [Wed, 23 May 2018 05:38:23 +0000 (14:38 +0900)] 
Merge branch 'ah/misc-doc-updates'

Misc doc fixes.

* ah/misc-doc-updates:
  doc: normalize [--options] to [options] in git-diff
  doc: add note about shell quoting to revision.txt
  git-svn: remove ''--add-author-from' for 'commit-diff'
  doc: add '-d' and '-o' for 'git push'
  doc: clarify ignore rules for git ls-files
  doc: align 'diff --no-index' in text and synopsis
  doc: improve formatting in githooks.txt

6 years agoMerge branch 'bp/test-drop-caches'
Junio C Hamano [Wed, 23 May 2018 05:38:22 +0000 (14:38 +0900)] 
Merge branch 'bp/test-drop-caches'

Code simplification.

* bp/test-drop-caches:
  test-drop-caches: simplify delay loading of NtSetSystemInformation

6 years agoMerge branch 'en/unpack-trees-split-index-fix'
Junio C Hamano [Wed, 23 May 2018 05:38:22 +0000 (14:38 +0900)] 
Merge branch 'en/unpack-trees-split-index-fix'

The split-index feature had a long-standing and dormant bug in
certain use of the in-core merge machinery, which has been fixed.

* en/unpack-trees-split-index-fix:
  unpack_trees: fix breakage when o->src_index != o->dst_index

6 years agoMerge branch 'nd/doc-header'
Junio C Hamano [Wed, 23 May 2018 05:38:21 +0000 (14:38 +0900)] 
Merge branch 'nd/doc-header'

Doc formatting fix.

* nd/doc-header:
  doc: keep first level section header in upper case

6 years agoMerge branch 'bc/format-patch-cover-no-attach'
Junio C Hamano [Wed, 23 May 2018 05:38:21 +0000 (14:38 +0900)] 
Merge branch 'bc/format-patch-cover-no-attach'

"git format-patch --cover --attach" created a broken MIME multipart
message for the cover letter, which has been fixed by keeping the
cover letter as plain text file.

* bc/format-patch-cover-no-attach:
  format-patch: make cover letters always text/plain

6 years agoMerge branch 'tb/test-apfs-utf8-normalization'
Junio C Hamano [Wed, 23 May 2018 05:38:21 +0000 (14:38 +0900)] 
Merge branch 'tb/test-apfs-utf8-normalization'

A test to see if the filesystem normalizes UTF-8 filename has been
updated to check what we need to know in a more direct way, i.e. a
path created in NFC form can be accessed with NFD form (or vice
versa) to cope with APFS as well as HFS.

* tb/test-apfs-utf8-normalization:
  test: correct detection of UTF8_NFD_TO_NFC for APFS

6 years agoMerge branch 'js/rebase-recreate-merge'
Junio C Hamano [Wed, 23 May 2018 05:38:20 +0000 (14:38 +0900)] 
Merge branch 'js/rebase-recreate-merge'

"git rebase" learned "--rebase-merges" to transplant the whole
topology of commit graph elsewhere.

* js/rebase-recreate-merge:
  rebase -i --rebase-merges: add a section to the man page
  rebase -i: introduce --rebase-merges=[no-]rebase-cousins
  pull: accept --rebase=merges to recreate the branch topology
  rebase --rebase-merges: avoid "empty merges"
  sequencer: handle post-rewrite for merge commands
  sequencer: make refs generated by the `label` command worktree-local
  rebase --rebase-merges: add test for --keep-empty
  rebase: introduce the --rebase-merges option
  rebase-helper --make-script: introduce a flag to rebase merges
  sequencer: fast-forward `merge` commands, if possible
  sequencer: introduce the `merge` command
  sequencer: introduce new commands to reset the revision
  git-rebase--interactive: clarify arguments
  sequencer: offer helpful advice when a command was rescheduled
  sequencer: refactor how original todo list lines are accessed
  sequencer: make rearrange_squash() a bit more obvious
  sequencer: avoid using errno clobbered by rollback_lock_file()

6 years agoMerge branch 'nd/pack-objects-pack-struct'
Junio C Hamano [Wed, 23 May 2018 05:38:19 +0000 (14:38 +0900)] 
Merge branch 'nd/pack-objects-pack-struct'

"git pack-objects" needs to allocate tons of "struct object_entry"
while doing its work, and shrinking its size helps the performance
quite a bit.

* nd/pack-objects-pack-struct:
  ci: exercise the whole test suite with uncommon code in pack-objects
  pack-objects: reorder members to shrink struct object_entry
  pack-objects: shrink delta_size field in struct object_entry
  pack-objects: shrink size field in struct object_entry
  pack-objects: clarify the use of object_entry::size
  pack-objects: don't check size when the object is bad
  pack-objects: shrink z_delta_size field in struct object_entry
  pack-objects: refer to delta objects by index instead of pointer
  pack-objects: move in_pack out of struct object_entry
  pack-objects: move in_pack_pos out of struct object_entry
  pack-objects: use bitfield for object_entry::depth
  pack-objects: use bitfield for object_entry::dfs_state
  pack-objects: turn type and in_pack_type to bitfields
  pack-objects: a bit of document about struct object_entry
  read-cache.c: make $GIT_TEST_SPLIT_INDEX boolean

6 years agoMerge branch 'en/rename-directory-detection-reboot'
Junio C Hamano [Wed, 23 May 2018 05:38:19 +0000 (14:38 +0900)] 
Merge branch 'en/rename-directory-detection-reboot'

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.  Incidentally, this also avoids updating a file in the
working tree after a (non-trivial) merge whose result matches what
our side originally had.

* en/rename-directory-detection-reboot: (36 commits)
  merge-recursive: fix check for skipability of working tree updates
  merge-recursive: make "Auto-merging" comment show for other merges
  merge-recursive: fix remainder of was_dirty() to use original index
  merge-recursive: fix was_tracked() to quit lying with some renamed paths
  t6046: testcases checking whether updates can be skipped in a merge
  merge-recursive: avoid triggering add_cacheinfo error with dirty mod
  merge-recursive: move more is_dirty handling to merge_content
  merge-recursive: improve add_cacheinfo error handling
  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
  ...

6 years agoMerge branch 'js/no-pager-shorthand'
Junio C Hamano [Wed, 23 May 2018 05:38:18 +0000 (14:38 +0900)] 
Merge branch 'js/no-pager-shorthand'

"git --no-pager cmd" did not have short-and-sweet single letter
option. Now it does.

* js/no-pager-shorthand:
  git: add -P as a short option for --no-pager

6 years agoMerge branch 'js/rebase-i-clean-msg-after-fixup-continue'
Junio C Hamano [Wed, 23 May 2018 05:38:18 +0000 (14:38 +0900)] 
Merge branch 'js/rebase-i-clean-msg-after-fixup-continue'

"git rebase -i" sometimes left intermediate "# This is a
combination of N commits" message meant for the human consumption
inside an editor in the final result in certain corner cases, which
has been fixed.

* js/rebase-i-clean-msg-after-fixup-continue:
  rebase --skip: clean up commit message after a failed fixup/squash
  sequencer: always commit without editing when asked for
  rebase -i: Handle "combination of <n> commits" with GETTEXT_POISON
  rebase -i: demonstrate bugs with fixup!/squash! commit messages

6 years agoMerge branch 'tg/worktree-add-existing-branch'
Junio C Hamano [Wed, 23 May 2018 05:38:18 +0000 (14:38 +0900)] 
Merge branch 'tg/worktree-add-existing-branch'

"git worktree add" learned to check out an existing branch.

* tg/worktree-add-existing-branch:
  worktree: teach "add" to check out existing branches
  worktree: factor out dwim_branch function
  worktree: improve message when creating a new worktree
  worktree: remove extra members from struct add_opts

6 years agoMerge branch 'js/deprecate-grafts'
Junio C Hamano [Wed, 23 May 2018 05:38:17 +0000 (14:38 +0900)] 
Merge branch 'js/deprecate-grafts'

The functionality of "$GIT_DIR/info/grafts" has been superseded by
the "refs/replace/" mechanism for some time now, but the internal
code had support for it in many places, which has been cleaned up
in order to drop support of the "grafts" mechanism.

* js/deprecate-grafts:
  Remove obsolete script to convert grafts to replace refs
  technical/shallow: describe why shallow cannot use replace refs
  technical/shallow: stop referring to grafts
  filter-branch: stop suggesting to use grafts
  Deprecate support for .git/info/grafts
  Add a test for `git replace --convert-graft-file`
  replace: introduce --convert-graft-file
  replace: prepare create_graft() for converting graft files wholesale
  replace: "libify" create_graft() and callees
  replace: avoid using die() to indicate a bug
  commit: Let the callback of for_each_mergetag return on error
  argv_array: offer to split a string by whitespace

6 years agoMerge branch 'js/test-unset-prereq'
Junio C Hamano [Wed, 23 May 2018 05:38:17 +0000 (14:38 +0900)] 
Merge branch 'js/test-unset-prereq'

Test debugging aid.

* js/test-unset-prereq:
  tests: introduce test_unset_prereq, for debugging

6 years agoMerge branch 'ab/perl-python-attrs'
Junio C Hamano [Wed, 23 May 2018 05:38:16 +0000 (14:38 +0900)] 
Merge branch 'ab/perl-python-attrs'

We learned that our source files with ".pl" and ".py" extensions
are Perl and Python files respectively and changes to them are
better viewed as such with appropriate diff drivers.

* ab/perl-python-attrs:
  .gitattributes: add a diff driver for Python
  .gitattributes: use the "perl" differ for Perl
  .gitattributes: add *.pl extension for Perl

6 years agoMerge branch 'sb/oid-object-info'
Junio C Hamano [Wed, 23 May 2018 05:38:16 +0000 (14:38 +0900)] 
Merge branch 'sb/oid-object-info'

The codepath around object-info API has been taught to take the
repository object (which in turn tells the API which object store
the objects are to be located).

* sb/oid-object-info:
  cache.h: allow oid_object_info to handle arbitrary repositories
  packfile: add repository argument to cache_or_unpack_entry
  packfile: add repository argument to unpack_entry
  packfile: add repository argument to read_object
  packfile: add repository argument to packed_object_info
  packfile: add repository argument to packed_to_object_type
  packfile: add repository argument to retry_bad_packed_offset
  cache.h: add repository argument to oid_object_info
  cache.h: add repository argument to oid_object_info_extended

6 years agoMerge branch 'cc/perf-aggregate-unknown-option'
Junio C Hamano [Wed, 23 May 2018 05:38:15 +0000 (14:38 +0900)] 
Merge branch 'cc/perf-aggregate-unknown-option'

Perf-test helper updates.

* cc/perf-aggregate-unknown-option:
  perf/aggregate: use Getopt::Long for option parsing

6 years agoMerge branch 'en/git-debugger'
Junio C Hamano [Wed, 23 May 2018 05:38:15 +0000 (14:38 +0900)] 
Merge branch 'en/git-debugger'

Dev support.

* en/git-debugger:
  Make running git under other debugger-like programs easy

6 years agoMerge branch 'bw/server-options'
Junio C Hamano [Wed, 23 May 2018 05:38:15 +0000 (14:38 +0900)] 
Merge branch 'bw/server-options'

The transport protocol v2 is getting updated further.

* bw/server-options:
  fetch: send server options when using protocol v2
  ls-remote: send server options when using protocol v2
  serve: introduce the server-option capability

6 years agoMerge branch 'nd/repack-keep-pack'
Junio C Hamano [Wed, 23 May 2018 05:38:14 +0000 (14:38 +0900)] 
Merge branch 'nd/repack-keep-pack'

"git gc" in a large repository takes a lot of time as it considers
to repack all objects into one pack by default.  The command has
been taught to pretend as if the largest existing packfile is
marked with ".keep" so that it is left untouched while objects in
other packs and loose ones are repacked.

* nd/repack-keep-pack:
  pack-objects: show some progress when counting kept objects
  gc --auto: exclude base pack if not enough mem to "repack -ad"
  gc: handle a corner case in gc.bigPackThreshold
  gc: add gc.bigPackThreshold config
  gc: add --keep-largest-pack option
  repack: add --keep-pack option
  t7700: have closing quote of a test at the beginning of line

6 years agoMerge branch 'ds/lazy-load-trees'
Junio C Hamano [Wed, 23 May 2018 05:38:13 +0000 (14:38 +0900)] 
Merge branch 'ds/lazy-load-trees'

The code has been taught to use the duplicated information stored
in the commit-graph file to learn the tree object name for a commit
to avoid opening and parsing the commit object when it makes sense
to do so.

* ds/lazy-load-trees:
  coccinelle: avoid wrong transformation suggestions from commit.cocci
  commit-graph: lazy-load trees for commits
  treewide: replace maybe_tree with accessor methods
  commit: create get_commit_tree() method
  treewide: rename tree to maybe_tree

6 years agoMerge branch 'nd/term-columns'
Junio C Hamano [Wed, 23 May 2018 05:38:13 +0000 (14:38 +0900)] 
Merge branch 'nd/term-columns'

The code did not propagate the terminal width to subprocesses via
COLUMNS environment variable, which it now does.  This caused
trouble to "git column" helper subprocess when "git tag --column=row"
tried to list the existing tags on a display with non-default width.

* nd/term-columns:
  column: fix off-by-one default width
  pager: set COLUMNS to term_columns()

6 years agoMerge branch 'sg/t7005-spaces-in-filenames-cleanup'
Junio C Hamano [Wed, 23 May 2018 05:38:12 +0000 (14:38 +0900)] 
Merge branch 'sg/t7005-spaces-in-filenames-cleanup'

Test update.

* sg/t7005-spaces-in-filenames-cleanup:
  t7005-editor: get rid of the SPACES_IN_FILENAMES prereq

6 years agoMerge branch 'sg/t5516-fixes'
Junio C Hamano [Wed, 23 May 2018 05:38:12 +0000 (14:38 +0900)] 
Merge branch 'sg/t5516-fixes'

Test fixes.

* sg/t5516-fixes:
  t5516-fetch-push: fix broken &&-chain
  t5516-fetch-push: fix 'push with dry-run' test

6 years agoMerge branch 'sg/t5310-jgit-bitmap-test'
Junio C Hamano [Wed, 23 May 2018 05:38:11 +0000 (14:38 +0900)] 
Merge branch 'sg/t5310-jgit-bitmap-test'

Test update.

* sg/t5310-jgit-bitmap-test:
  t5310-pack-bitmaps: make JGit tests work with GIT_TEST_SPLIT_INDEX

6 years agoMerge branch 'nd/pack-format-doc'
Junio C Hamano [Wed, 23 May 2018 05:38:11 +0000 (14:38 +0900)] 
Merge branch 'nd/pack-format-doc'

Doc update.

* nd/pack-format-doc:
  pack-format.txt: more details on pack file format

6 years agoMerge branch 'jk/apply-p-doc'
Junio C Hamano [Wed, 23 May 2018 05:38:11 +0000 (14:38 +0900)] 
Merge branch 'jk/apply-p-doc'

Doc update.

* jk/apply-p-doc:
  apply: clarify "-p" documentation

6 years agoMerge branch 'ao/config-api-doc'
Junio C Hamano [Wed, 23 May 2018 05:38:10 +0000 (14:38 +0900)] 
Merge branch 'ao/config-api-doc'

Doc update.

* ao/config-api-doc:
  doc: fix config API documentation about config_with_options

6 years agoMerge branch 'bc/mailmap-self'
Junio C Hamano [Wed, 23 May 2018 05:38:10 +0000 (14:38 +0900)] 
Merge branch 'bc/mailmap-self'

* bc/mailmap-self:
  mailmap: update brian m. carlson's email address

6 years agoMerge branch 'sb/object-store-replace'
Junio C Hamano [Wed, 23 May 2018 05:38:09 +0000 (14:38 +0900)] 
Merge branch 'sb/object-store-replace'

Hotfix.

* sb/object-store-replace:
  get_main_ref_store: BUG() when outside a repository
  object.c: clear replace map before freeing it
  replace-object.c: remove the_repository from prepare_replace_object
  object.c: free replace map in raw_object_store_clear

6 years agoMerge branch 'hn/sort-ls-remote'
Junio C Hamano [Wed, 23 May 2018 05:38:09 +0000 (14:38 +0900)] 
Merge branch 'hn/sort-ls-remote'

Hotfix.

* hn/sort-ls-remote:
  t5512: run git fetch inside test

6 years agoget_main_ref_store: BUG() when outside a repository
Jeff King [Fri, 18 May 2018 22:25:53 +0000 (15:25 -0700)] 
get_main_ref_store: BUG() when outside a repository

If we don't have a repository, then we can't initialize the
ref store.  Prior to 64a741619d (refs: store the main ref
store inside the repository struct, 2018-04-11), we'd try to
access get_git_dir(), and outside a repository that would
trigger a BUG(). After that commit, though, we directly use
the_repository->git_dir; if it's NULL we'll just segfault.

Let's catch this case and restore the BUG() behavior.
Obviously we don't ever want to hit this code, but a BUG()
is a lot more helpful than a segfault if we do.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoobject.c: clear replace map before freeing it
Stefan Beller [Thu, 17 May 2018 18:29:57 +0000 (11:29 -0700)] 
object.c: clear replace map before freeing it

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot7005-editor: get rid of the SPACES_IN_FILENAMES prereq
SZEDER Gábor [Mon, 14 May 2018 10:28:12 +0000 (12:28 +0200)] 
t7005-editor: get rid of the SPACES_IN_FILENAMES prereq

The last two tests 'editor with a space' and 'core.editor with a
space' in 't7005-editor.sh' need the SPACES_IN_FILENAMES prereq to
ensure that they are only run on filesystems that allow, well, spaces
in filenames.  However, we have been putting a space in the name of
the trash directory for just over a decade now, so we wouldn't be able
to run any of our tests on such a filesystem in the first place.

This prereq is therefore unnecessary, remove it.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5512: run git fetch inside test
René Scharfe [Sat, 12 May 2018 08:45:23 +0000 (10:45 +0200)] 
t5512: run git fetch inside test

Do the preparatory fetch inside the test of ls-remote --symref to avoid
cluttering the test output and to be able to catch unexpected fetch
failures.

Signed-off-by: Rene Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agocolumn: fix off-by-one default width
Nguyễn Thái Ngọc Duy [Fri, 11 May 2018 12:13:29 +0000 (14:13 +0200)] 
column: fix off-by-one default width

By default we want to fill the whole screen if possible, but we do not
want to use up _all_ terminal columns because the last character is
going hit the border, push the cursor over and wrap. Keep it at
default value zero, which will make print_columns() set the width at
term_columns() - 1.

This affects the test in t7004 because effective column width before
was 40 but now 39 so we need to compensate it by one or the output at
39 columns has a different layout.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopager: set COLUMNS to term_columns()
Jeff King [Fri, 11 May 2018 09:25:16 +0000 (05:25 -0400)] 
pager: set COLUMNS to term_columns()

After we invoke the pager, our stdout goes to a pipe, not the
terminal, meaning we can no longer use an ioctl to get the
terminal width. For that reason, ad6c3739a3 (pager: find out
the terminal width before spawning the pager, 2012-02-12)
started caching the terminal width.

But that cache is only an in-process variable. Any programs
we spawn will also not be able to run that ioctl, but won't
have access to our cache. They'll end up falling back to our
80-column default.

You can see the problem with:

  git tag --column=row

Since git-tag spawns a pager these days, its spawned
git-column helper will see neither the terminal on stdout
nor a useful COLUMNS value (assuming you do not export it
from your shell already). And you'll end up with 80-column
output in the pager, regardless of your terminal size.

We can fix this by setting COLUMNS right before spawning the
pager. That fixes this case, as well as any more complicated
ones (e.g., a paged program spawns another script which then
generates columnized output).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agopack-format.txt: more details on pack file format
Nguyễn Thái Ngọc Duy [Fri, 11 May 2018 06:55:23 +0000 (08:55 +0200)] 
pack-format.txt: more details on pack file format

The current document mentions OBJ_* constants without their actual
values. A git developer would know these are from cache.h but that's
not very friendly to a person who wants to read this file to implement
a pack file parser.

Similarly, the deltified representation is not documented at all (the
"document" is basically patch-delta.c). Translate that C code to
English with a bit more about what ofs-delta and ref-delta mean.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoapply: clarify "-p" documentation
Jeff King [Thu, 10 May 2018 14:29:24 +0000 (10:29 -0400)] 
apply: clarify "-p" documentation

We're not really removing slashes, but slash-separated path
components. Let's make that more clear.

Reported-by: kelly elton <its.the.doc@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5516-fetch-push: fix broken &&-chain
SZEDER Gábor [Thu, 10 May 2018 14:01:54 +0000 (16:01 +0200)] 
t5516-fetch-push: fix broken &&-chain

b2dc968e60 (t5516: refactor oddball tests, 2008-11-07) accidentaly
broke the &&-chain in the test 'push does not update local refs on
failure', but since it was in a subshell, chain-lint couldn't notice
it.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5516-fetch-push: fix 'push with dry-run' test
SZEDER Gábor [Thu, 10 May 2018 14:01:53 +0000 (16:01 +0200)] 
t5516-fetch-push: fix 'push with dry-run' test

In a while-at-it cleanup replacing a 'cd dir && <...> && cd ..' with a
subshell, commit 28391a80a9 (receive-pack: allow deletion of corrupt
refs, 2007-11-29) also moved the assignment of the $old_commit
variable to that subshell.  This variable, however, is used outside of
that subshell as a parameter of check_push_result(), to check that a
ref still points to the commit where it is supposed to.  With the
variable remaining unset outside the subshell check_push_result()
doesn't perform that check at all.

Use 'git -C <dir> cmd...', so we don't need to change directory, and
thus don't need the subshell either when setting $old_commit.

Furthermore, change check_push_result() to require at least three
parameters (the repo, the oid, and at least one ref), so it will catch
similar issues earlier should they ever arise.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot5310-pack-bitmaps: make JGit tests work with GIT_TEST_SPLIT_INDEX
SZEDER Gábor [Thu, 10 May 2018 13:58:52 +0000 (15:58 +0200)] 
t5310-pack-bitmaps: make JGit tests work with GIT_TEST_SPLIT_INDEX

The two JGit tests 'we can read jgit bitmaps' and 'jgit can read our
bitmaps' in 't5310-pack-bitmaps.sh' fail when run with
GIT_TEST_SPLIT_INDEX=YesPlease.  Both tests create a clone of the test
repository to check bitmap interoperability with JGit.  With split
indexes enabled the index in the clone repositories contains the
'link' extension, which JGit doesn't support and, consequently, an
exception aborts it:

  <...>
  org.eclipse.jgit.api.errors.JGitInternalException: DIRC extension 'link' not supported by this version.
          at org.eclipse.jgit.dircache.DirCache.readFrom(DirCache.java:562)
  <...>

Since testing bitmaps doesn't need a worktree in the first place,
let's just create bare clones for the two JGit tests, so the cloned
won't have an index, and these two tests can be executed even with
split index enabled.

Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Reviewed-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodoc: fix config API documentation about config_with_options
Antonio Ospite [Wed, 9 May 2018 13:16:28 +0000 (15:16 +0200)] 
doc: fix config API documentation about config_with_options

In commit dc8441fdb ("config: don't implicitly use gitdir or commondir",
2017-06-14) the function git_config_with_options was renamed to
config_with_options to better reflect the fact that it does not access
the git global config or the repo config by default.

However Documentation/technical/api-config.txt still refers to the
previous name, fix that.

While at it also update the documentation about the extra parameters,
because they too changed since the initial definition.

Signed-off-by: Antonio Ospite <ao2@ao2.it>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoreplace-object.c: remove the_repository from prepare_replace_object
Stefan Beller [Wed, 9 May 2018 23:40:59 +0000 (16:40 -0700)] 
replace-object.c: remove the_repository from prepare_replace_object

This was missed in 5982da9d2ce (replace-object: allow
prepare_replace_object to handle arbitrary repositories, 2018-04-11)

Technically the code works correctly as the replace_map is the same
size in different repositories, however it is hard to read. So convert
the code to the familiar pattern of dereferencing the pointer that we
assign in the sizeof itself.

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoobject.c: free replace map in raw_object_store_clear
Stefan Beller [Wed, 9 May 2018 23:40:58 +0000 (16:40 -0700)] 
object.c: free replace map in raw_object_store_clear

The replace map for objects was missed to free in the object store in
the conversion of 174774cd519 (Merge branch 'sb/object-store-replace',
2018-05-08)

Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: fix check for skipability of working tree updates
Elijah Newren [Thu, 19 Apr 2018 17:58:23 +0000 (10:58 -0700)] 
merge-recursive: fix check for skipability of working tree updates

The can-working-tree-updates-be-skipped check has had a long and blemished
history.  The update can be skipped iff:
  a) The merge is clean
  b) The merge matches what was in HEAD (content, mode, pathname)
  c) The target path is usable (i.e. not involved in D/F conflict)

Traditionally, we split b into parts:
  b1) The merged result matches the content and mode found in HEAD
  b2) The merged target path existed in HEAD

Steps a & b1 are easy to check; we have always gotten those right.  While
it is easy to overlook step c, this was fixed seven years ago with commit
4ab9a157d069 ("merge_content(): Check whether D/F conflicts are still
present", 2010-09-20).  merge-recursive didn't have a readily available
way to directly check step b2, so various approximations were used:

  * In commit b2c8c0a76274 ("merge-recursive: When we detect we can skip
    an update, actually skip it", 2011-02-28), it was noted that although
    the code claimed it was skipping the update, it did not actually skip
    the update.  The code was made to skip it, but used lstat(path, ...)
    as an approximation to path-was-tracked-in-index-before-merge.

  * In commit 5b448b853030 ("merge-recursive: When we detect we can skip
    an update, actually skip it", 2011-08-11), the problem with using
    lstat was noted.  It was changed to the approximation
       path2 && strcmp(path, path2)
    which is also wrong.  !path2 || strcmp(path, path2) would have been
    better, but would have fallen short with directory renames.

  * In c5b761fb2711 ("merge-recursive: ensure we write updates for
    directory-renamed file", 2018-02-14), the problem with the previous
    approximation was noted and changed to
       was_tracked(path)
    That looks close to what we were trying to answer, but was_tracked()
    as implemented at the time should have been named is_tracked(); it
    returned something different than what we were looking for.

  * To make matters more complex, fixing was_tracked() isn't sufficient
    because the splitting of b into b1 and b2 is wrong.  Consider the
    following merge with a rename/add conflict:
       side A: modify foo, add unrelated bar
       side B: rename foo->bar (but don't modify the mode or contents)
    In this case, the three-way merge of original foo, A's foo, and B's
    bar will result in a desired pathname of bar with the same
    mode/contents that A had for foo.  Thus, A had the right mode and
    contents for the file, and it had the right pathname present (namely,
    bar), but the bar that was present was unrelated to the contents, so
    the working tree update was not skippable.

Fix this by introducing a new function:
   was_tracked_and_matches(o, path, &mfi.oid, mfi.mode)
and use it to directly check for condition b.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: make "Auto-merging" comment show for other merges
Elijah Newren [Thu, 19 Apr 2018 17:58:22 +0000 (10:58 -0700)] 
merge-recursive: make "Auto-merging" comment show for other merges

Previously, merge_content() would print "Auto-merging" whenever the final
content and mode aren't already available from HEAD.  There are a few
problems with this:

  1) There are other code paths doing merges that should probably have the
     same message printed, in particular rename/rename(2to1) which cannot
     call into the normal rename logic.

  2) If both sides of the merge have modifications, then a content merge
     is needed.  It may turn out that the end result matches one of the
     sides (because the other only had a subset of the same changes), but
     the merge was still needed.  Currently, the message will not print in
     that case, though it seems like it should.

Move the printing of this message to merge_file_1() in order to address
both issues.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: fix remainder of was_dirty() to use original index
Elijah Newren [Thu, 19 Apr 2018 17:58:21 +0000 (10:58 -0700)] 
merge-recursive: fix remainder of was_dirty() to use original index

was_dirty() uses was_tracked(), which has been updated to use the original
index rather than the current one.  However, was_dirty() also had a
separate call to cache_file_exists(), causing it to still implicitly use
the current index.  Update that to instead use index_file_exists().

Also, was_dirty() had a hack where it would mark any file as non-dirty if
we simply didn't know its modification time.  This was due to using the
current index rather than the original index, because D/F conflicts and
such would cause unpack_trees() to not copy the modification times from
the original index to the current one.  Now that we are using the original
index, we can dispense with this hack.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: fix was_tracked() to quit lying with some renamed paths
Elijah Newren [Thu, 19 Apr 2018 17:58:20 +0000 (10:58 -0700)] 
merge-recursive: fix was_tracked() to quit lying with some renamed paths

In commit aacb82de3ff8 ("merge-recursive: Split was_tracked() out of
would_lose_untracked()", 2011-08-11), was_tracked() was split out of
would_lose_untracked() with the intent to provide a function that could
answer whether a path was tracked in the index before the merge.  Sadly,
it instead returned whether the path was in the working tree due to having
been tracked in the index before the merge OR having been written there by
unpack_trees().  The distinction is important when renames are involved,
e.g. for a merge where:

   HEAD:  modifies path b
   other: renames b->c

In this case, c was not tracked in the index before the merge, but would
have been added to the index at stage 0 and written to the working tree by
unpack_trees().  would_lose_untracked() is more interested in the
in-working-copy-for-either-reason behavior, while all other uses of
was_tracked() want just was-it-tracked-in-index-before-merge behavior.

Unsplit would_lose_untracked() and write a new was_tracked() function
which answers whether a path was tracked in the index before the merge
started.

This will also affect was_dirty(), helping it to return better results
since it can base answers off the original index rather than an index that
possibly only copied over some of the stat information.  However,
was_dirty() will need an additional change that will be made in a
subsequent patch.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agot6046: testcases checking whether updates can be skipped in a merge
Elijah Newren [Thu, 19 Apr 2018 17:58:19 +0000 (10:58 -0700)] 
t6046: testcases checking whether updates can be skipped in a merge

Add several tests checking whether updates can be skipped in a merge.
Also add several similar testcases for where updates cannot be skipped in
a merge to make sure that we skip if and only if we should.

In particular:

  * Testcase 1a (particularly 1a-check-L) would have pointed out the
    problem Linus has been dealing with for year with his merges[1].

  * Testcase 2a (particularly 2a-check-L) would have pointed out the
    problem with my directory-rename-series before it broke master[2].

  * Testcases 3[ab] (particularly 3a-check-L) provide a simpler testcase
    than 12b of t6043 making that one easier to understand.

  * There are several complementary testcases to make sure we're not just
    fixing those particular issues while regressing in the opposite
    direction.

  * There are also a pair of tests for the special case when a merge
    results in a skippable update AND the user has dirty modifications to
    the path.

[1] https://public-inbox.org/git/CA+55aFzLZ3UkG5svqZwSnhNk75=fXJRkvU1m_RHBG54NOoaZPA@mail.gmail.com/
[2] https://public-inbox.org/git/xmqqmuya43cs.fsf@gitster-ct.c.googlers.com/

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: avoid triggering add_cacheinfo error with dirty mod
Elijah Newren [Thu, 19 Apr 2018 17:58:18 +0000 (10:58 -0700)] 
merge-recursive: avoid triggering add_cacheinfo error with dirty mod

If a cherry-pick or merge with a rename results in a skippable update
(due to the merged content matching what HEAD already had), but the
working directory is dirty, avoid trying to refresh the index as that
will fail.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: move more is_dirty handling to merge_content
Elijah Newren [Thu, 19 Apr 2018 17:58:17 +0000 (10:58 -0700)] 
merge-recursive: move more is_dirty handling to merge_content

conflict_rename_normal() was doing some handling for dirty files that
more naturally belonged in merge_content.  Move it, and rename a
parameter for clarity while at it.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: improve add_cacheinfo error handling
Elijah Newren [Thu, 19 Apr 2018 17:58:16 +0000 (10:58 -0700)] 
merge-recursive: improve add_cacheinfo error handling

Four closely related changes all with the purpose of fixing error handling
in this function:
  - fix reported function name in add_cacheinfo error messages
  - differentiate between the two error messages
  - abort early when we hit the error (stop ignoring return code)
  - mark a test which was hitting this error as failing until we get the
    right fix

In more detail...

In commit 0424138d5715 ("Fix bogus error message from merge-recursive
error path", 2007-04-01), it was noted that the name of the function which
the error message claimed it was reported from did not match the actual
function name.  This was changed to something closer to the real function
name, but it still didn't match the actual function name.  Fix the
reported name to match.

Second, the two errors in this function had identical messages, preventing
us from knowing which error had been triggered.  Add a couple words to the
second error message to differentiate the two.

Next, make sure callers do not ignore the return code so that it will stop
processing further entries (processing further entries could result in
more output which could cause the error to scroll off the screen, or at
least be missed by the user) and make it clear the error is the cause of
the early abort.  These errors should never be triggered in production; if
either one is, it represents a bug in the calling path somewhere and is
likely to have resulted in mis-merged content.  The combination of
ignoring of the return code and continuing to print other standard
messages after hitting the error resulted in the following bug report from
Junio: "...the command pretends that everything went well and merged
cleanly in that path...[Behaving] in a buggy and unexplainable way is bad
enough, doing so silently is unexcusable."  Fix this.

Finally, there was one test in the testsuite that did hit this error path,
but was passing anyway.  This would have been easy to miss since it had a
test_must_fail and thus could have failed for the wrong reason, but in a
separate testing step I added an intentional NULL-dereference to the
codepath where these error messages are printed in order to flush out such
cases.  I could modify that test to explicitly check for this error and
fail the test if it is hit, but since this test operates in a bit of a
gray area and needed other changes, I went for a different fix.  The gray
area this test operates in is the following: If the merge of a certain
file results in the same version of the file that existed in HEAD, but
there are dirty modifications to the file, is that an error with a
"Refusing to overwrite existing file" expected, or a case where the merge
should succeed since we shouldn't have to touch the dirty file anyway?
Recent discussion on the list leaned towards saying it should be a
success.  Therefore, change the expected behavior of this test to match.
As a side effect, this makes the failed-due-to-hitting-add_cacheinfo-error
very clear, and we can mark the test as test_expect_failure.  A subsequent
commit will implement the necessary changes to get this test to pass
again.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: avoid spurious rename/rename conflict from dir renames
Elijah Newren [Thu, 19 Apr 2018 17:58:15 +0000 (10:58 -0700)] 
merge-recursive: avoid spurious rename/rename conflict from dir renames

If a file on one side of history was renamed, and merely modified on the
other side, then applying a directory rename to the modified side gives us
a rename/rename(1to2) conflict.  We should only apply directory renames to
pairs representing either adds or renames.

Making this change means that a directory rename testcase that was
previously reported as a rename/delete conflict will now be reported as a
modify/delete conflict.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agodirectory rename detection: new testcases showcasing a pair of bugs
Elijah Newren [Thu, 19 Apr 2018 17:58:14 +0000 (10:58 -0700)] 
directory rename detection: new testcases showcasing a pair of bugs

Add a testcase showing spurious rename/rename(1to2) conflicts occurring
due to directory rename detection.

Also add a pair of testcases dealing with moving directory hierarchies
around that were suggested by Stefan Beller as "food for thought" during
his review of an earlier patch series, but which actually uncovered a
bug.  Round things out with a test that is a cross between the two
testcases that showed existing bugs in order to make sure we aren't
merely addressing problems in isolation but in general.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: fix remaining directory rename + dirty overwrite cases
Elijah Newren [Thu, 19 Apr 2018 17:58:13 +0000 (10:58 -0700)] 
merge-recursive: fix remaining directory rename + dirty overwrite cases

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: fix overwriting dirty files involved in renames
Elijah Newren [Thu, 19 Apr 2018 17:58:12 +0000 (10:58 -0700)] 
merge-recursive: fix overwriting dirty files involved in renames

This fixes an issue that existed before my directory rename detection
patches that affects both normal renames and renames implied by
directory rename detection.  Additional codepaths that only affect
overwriting of dirty files that are involved in directory rename
detection will be added in a subsequent commit.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: avoid clobbering untracked files with directory renames
Elijah Newren [Thu, 19 Apr 2018 17:58:11 +0000 (10:58 -0700)] 
merge-recursive: avoid clobbering untracked files with directory renames

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: apply necessary modifications for directory renames
Elijah Newren [Thu, 19 Apr 2018 17:58:10 +0000 (10:58 -0700)] 
merge-recursive: apply necessary modifications for directory renames

This commit hooks together all the directory rename logic by making the
necessary changes to the rename struct, it's dst_entry, and the
diff_filepair under consideration.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: when comparing files, don't include trees
Elijah Newren [Thu, 19 Apr 2018 17:58:09 +0000 (10:58 -0700)] 
merge-recursive: when comparing files, don't include trees

get_renames() would look up stage data that already existed (populated
in get_unmerged(), taken from whatever unpack_trees() created), and if
it didn't exist, would call insert_stage_data() to create the necessary
entry for the given file.  The insert_stage_data() fallback becomes
much more important for directory rename detection, because that creates
a mechanism to have a file in the resulting merge that didn't exist on
either side of history.  However, insert_stage_data(), due to calling
get_tree_entry() loaded up trees as readily as files.  We aren't
interested in comparing trees to files; the D/F conflict handling is
done elsewhere.  This code is just concerned with what entries existed
for a given path on the different sides of the merge, so create a
get_tree_entry_if_blob() helper function and use it.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: check for file level conflicts then get new name
Elijah Newren [Thu, 19 Apr 2018 17:58:08 +0000 (10:58 -0700)] 
merge-recursive: check for file level conflicts then get new name

Before trying to apply directory renames to paths within the given
directories, we want to make sure that there aren't conflicts at the
file level either.  If there aren't any, then get the new name from
any directory renames.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: add computation of collisions due to dir rename & merging
Elijah Newren [Thu, 19 Apr 2018 17:58:07 +0000 (10:58 -0700)] 
merge-recursive: add computation of collisions due to dir rename & merging

directory renaming and merging can cause one or more files to be moved to
where an existing file is, or to cause several files to all be moved to
the same (otherwise vacant) location.  Add checking and reporting for such
cases, falling back to no-directory-rename handling for such paths.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: check for directory level conflicts
Elijah Newren [Thu, 19 Apr 2018 17:58:06 +0000 (10:58 -0700)] 
merge-recursive: check for directory level conflicts

Before trying to apply directory renames to paths within the given
directories, we want to make sure that there aren't conflicts at the
directory level.  There will be additional checks at the individual
file level too, which will be added later.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agomerge-recursive: add get_directory_renames()
Elijah Newren [Thu, 19 Apr 2018 17:58:05 +0000 (10:58 -0700)] 
merge-recursive: add get_directory_renames()

This populates a set of directory renames for us.  The set of directory
renames is not yet used, but will be in subsequent commits.

Note that the use of a string_list for possible_new_dirs in the new
dir_rename_entry struct implies an O(n^2) algorithm; however, in practice
I expect the number of distinct directories that files were renamed into
from a single original directory to be O(1).  My guess is that n has a
mode of 1 and a mean of less than 2, so, for now, string_list seems good
enough for possible_new_dirs.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoThe fifth batch for 2.18
Junio C Hamano [Tue, 8 May 2018 06:50:30 +0000 (15:50 +0900)] 
The fifth batch for 2.18

Signed-off-by: Junio C Hamano <gitster@pobox.com>
6 years agoMerge branch 'ma/http-walker-no-partial'
Junio C Hamano [Tue, 8 May 2018 06:59:35 +0000 (15:59 +0900)] 
Merge branch 'ma/http-walker-no-partial'

"git http-fetch" (deprecated) had an optional and experimental
"feature" to fetch only commits and/or trees, which nobody used.
This has been removed.

* ma/http-walker-no-partial:
  walker: drop fields of `struct walker` which are always 1
  http-fetch: make `-a` standard behaviour

6 years agoMerge branch 'js/runtime-prefix'
Junio C Hamano [Tue, 8 May 2018 06:59:34 +0000 (15:59 +0900)] 
Merge branch 'js/runtime-prefix'

* js/runtime-prefix:
  Avoid multiple PREFIX definitions
  git_setup_gettext: plug memory leak
  gettext: avoid initialization if the locale dir is not present

6 years agoMerge branch 'js/colored-push-errors'
Junio C Hamano [Tue, 8 May 2018 06:59:34 +0000 (15:59 +0900)] 
Merge branch 'js/colored-push-errors'

Error messages from "git push" can be painted for more visibility.

* js/colored-push-errors:
  config: document the settings to colorize push errors/hints
  push: test to verify that push errors are colored
  push: colorize errors
  color: introduce support for colorizing stderr

6 years agoMerge branch 'jc/parseopt-expiry-errors'
Junio C Hamano [Tue, 8 May 2018 06:59:33 +0000 (15:59 +0900)] 
Merge branch 'jc/parseopt-expiry-errors'

"git gc --prune=nonsense" spent long time repacking and then
silently failed when underlying "git prune --expire=nonsense"
failed to parse its command line.  This has been corrected.

* jc/parseopt-expiry-errors:
  parseopt: handle malformed --expire arguments more nicely
  gc: do not upcase error message shown with die()

6 years agoMerge branch 'ma/fast-export-skip-merge-fix'
Junio C Hamano [Tue, 8 May 2018 06:59:33 +0000 (15:59 +0900)] 
Merge branch 'ma/fast-export-skip-merge-fix'

"git fast-export" had a regression in v2.15.0 era where it skipped
some merge commits in certain cases, which has been corrected.

* ma/fast-export-skip-merge-fix:
  fast-export: fix regression skipping some merge-commits

6 years agoMerge branch 'tz/doc-git-urls-reference'
Junio C Hamano [Tue, 8 May 2018 06:59:32 +0000 (15:59 +0900)] 
Merge branch 'tz/doc-git-urls-reference'

Doc fix.

* tz/doc-git-urls-reference:
  doc/clone: update caption for GIT URLS cross-reference

6 years agoMerge branch 'tg/demote-stash-save-in-completion'
Junio C Hamano [Tue, 8 May 2018 06:59:32 +0000 (15:59 +0900)] 
Merge branch 'tg/demote-stash-save-in-completion'

The command line completion (in contrib/) has been taught that "git
stash save" has been deprecated ("git stash push" is the preferred
spelling in the new world) and does not offer it as a possible
completion candidate when "git stash push" can be.

* tg/demote-stash-save-in-completion:
  completion: make stash -p and alias for stash push -p
  completion: stop showing 'save' for stash by default

6 years agoMerge branch 'sa/send-email-dedup-some-headers'
Junio C Hamano [Tue, 8 May 2018 06:59:31 +0000 (15:59 +0900)] 
Merge branch 'sa/send-email-dedup-some-headers'

When fed input that already has In-Reply-To: and/or References:
headers and told to add the same information, "git send-email"
added these headers separately, instead of appending to an existing
one, which is a violation of the RFC.  This has been corrected.

* sa/send-email-dedup-some-headers:
  send-email: avoid duplicate In-Reply-To/References

6 years agoMerge branch 'nd/submodule-status-fix'
Junio C Hamano [Tue, 8 May 2018 06:59:31 +0000 (15:59 +0900)] 
Merge branch 'nd/submodule-status-fix'

"git submodule status" did not check the symbolic revision name it
computed for the submodule HEAD is not the NULL, and threw it at
printf routines, which has been corrected.

* nd/submodule-status-fix:
  submodule--helper: don't print null in 'submodule status'

6 years agoMerge branch 'js/ident-date-fix'
Junio C Hamano [Tue, 8 May 2018 06:59:30 +0000 (15:59 +0900)] 
Merge branch 'js/ident-date-fix'

During a "rebase -i" session, the code could give older timestamp
to commits created by later "pick" than an earlier "reword", which
has been corrected.

* js/ident-date-fix:
  sequencer: reset the committer date before commits

6 years agoMerge branch 'bt/gpg-interface'
Junio C Hamano [Tue, 8 May 2018 06:59:29 +0000 (15:59 +0900)] 
Merge branch 'bt/gpg-interface'

What is queued here is only the obviously correct and
uncontroversial code clean-up part, which is an earlier 7 patches,
of a larger series.

The remainder that is not queued introduces a few configuration
variables to deal with e-signature backends with different
signature format.

* bt/gpg-interface:
  gpg-interface: find the last gpg signature line
  gpg-interface: extract gpg line matching helper
  gpg-interface: fix const-correctness of "eol" pointer
  gpg-interface: use size_t for signature buffer size
  gpg-interface: modernize function declarations
  gpg-interface: handle bool user.signingkey
  t7004: fix mistaken tag name

6 years agoMerge branch 'hn/sort-ls-remote'
Junio C Hamano [Tue, 8 May 2018 06:59:29 +0000 (15:59 +0900)] 
Merge branch 'hn/sort-ls-remote'

"git ls-remote" learned an option to allow sorting its output based
on the refnames being shown.

* hn/sort-ls-remote:
  ls-remote: create '--sort' option

6 years agoMerge branch 'ab/git-svn-get-record-typofix'
Junio C Hamano [Tue, 8 May 2018 06:59:28 +0000 (15:59 +0900)] 
Merge branch 'ab/git-svn-get-record-typofix'

"git svn" had a minor thinko/typo which has been fixed.

* ab/git-svn-get-record-typofix:
  git-svn: avoid warning on undef readline()

6 years agoMerge branch 'tb/config-default'
Junio C Hamano [Tue, 8 May 2018 06:59:27 +0000 (15:59 +0900)] 
Merge branch 'tb/config-default'

"git config --get" learned the "--default" option, to help the
calling script.  Building on top of the tb/config-type topic, the
"git config" learns "--type=color" type.  Taken together, you can
do things like "git config --get foo.color --default blue" and get
the ANSI color sequence for the color given to foo.color variable,
or "blue" if the variable does not exist.

* tb/config-default:
  builtin/config: introduce `color` type specifier
  config.c: introduce 'git_config_color' to parse ANSI colors
  builtin/config: introduce `--default`

6 years agoMerge branch 'tb/config-type'
Junio C Hamano [Tue, 8 May 2018 06:59:26 +0000 (15:59 +0900)] 
Merge branch 'tb/config-type'

The "git config" command uses separate options e.g. "--int",
"--bool", etc. to specify what type the caller wants the value to
be interpreted as.  A new "--type=<typename>" option has been
introduced, which would make it cleaner to define new types.

* tb/config-type:
  builtin/config.c: support `--type=<type>` as preferred alias for `--<type>`
  builtin/config.c: treat type specifiers singularly

6 years agoMerge branch 'sg/doc-gc-quote-mismatch-fix'
Junio C Hamano [Tue, 8 May 2018 06:59:26 +0000 (15:59 +0900)] 
Merge branch 'sg/doc-gc-quote-mismatch-fix'

Doc formatting fix.

* sg/doc-gc-quote-mismatch-fix:
  docs/git-gc: fix minor rendering issue

6 years agoMerge branch 'sg/completion-clear-cached'
Junio C Hamano [Tue, 8 May 2018 06:59:25 +0000 (15:59 +0900)] 
Merge branch 'sg/completion-clear-cached'

The completion script (in contrib/) learned to clear cached list of
command line options upon dot-sourcing it again in a more efficient
way.

* sg/completion-clear-cached:
  completion: reduce overhead of clearing cached --options

6 years agoMerge branch 'sb/worktree-remove-opt-force'
Junio C Hamano [Tue, 8 May 2018 06:59:24 +0000 (15:59 +0900)] 
Merge branch 'sb/worktree-remove-opt-force'

"git worktree remove" learned that "-f" is a shorthand for
"--force" option, just like for "git worktree add".

* sb/worktree-remove-opt-force:
  worktree: accept -f as short for --force for removal

6 years agoMerge branch 'ma/double-dashes-in-docs'
Junio C Hamano [Tue, 8 May 2018 06:59:24 +0000 (15:59 +0900)] 
Merge branch 'ma/double-dashes-in-docs'

Doc formatting updates.

* ma/double-dashes-in-docs:
  git-submodule.txt: quote usage in monospace, drop backslash
  git-[short]log.txt: unify quoted standalone --
  doc: convert [\--] to [--]
  doc: convert \--option to --option

6 years agoMerge branch 'tq/t1510'
Junio C Hamano [Tue, 8 May 2018 06:59:23 +0000 (15:59 +0900)] 
Merge branch 'tq/t1510'

Test cleanup.

* tq/t1510:
  t1510-repo-setup.sh: remove useless mkdir

6 years agoMerge branch 'so/glossary-ancestor'
Junio C Hamano [Tue, 8 May 2018 06:59:23 +0000 (15:59 +0900)] 
Merge branch 'so/glossary-ancestor'

Docfix.

* so/glossary-ancestor:
  glossary: substitute "ancestor" for "direct ancestor" in 'push' description.

6 years agoMerge branch 'ls/checkout-encoding'
Junio C Hamano [Tue, 8 May 2018 06:59:22 +0000 (15:59 +0900)] 
Merge branch 'ls/checkout-encoding'

The new "checkout-encoding" attribute can ask Git to convert the
contents to the specified encoding when checking out to the working
tree (and the other way around when checking in).

* ls/checkout-encoding:
  convert: add round trip check based on 'core.checkRoundtripEncoding'
  convert: add tracing for 'working-tree-encoding' attribute
  convert: check for detectable errors in UTF encodings
  convert: add 'working-tree-encoding' attribute
  utf8: add function to detect a missing UTF-16/32 BOM
  utf8: add function to detect prohibited UTF-16/32 BOM
  utf8: teach same_encoding() alternative UTF encoding names
  strbuf: add a case insensitive starts_with()
  strbuf: add xstrdup_toupper()
  strbuf: remove unnecessary NUL assignment in xstrdup_tolower()

6 years agoMerge branch 'ab/nuke-emacs-contrib'
Junio C Hamano [Tue, 8 May 2018 06:59:22 +0000 (15:59 +0900)] 
Merge branch 'ab/nuke-emacs-contrib'

The scripts in contrib/emacs/ have outlived their usefulness and
have been replaced with a stub that errors out and tells the user
there are replacements.

* ab/nuke-emacs-contrib:
  git{,-blame}.el: remove old bitrotting Emacs code

6 years agoMerge branch 'nd/warn-more-for-devs'
Junio C Hamano [Tue, 8 May 2018 06:59:21 +0000 (15:59 +0900)] 
Merge branch 'nd/warn-more-for-devs'

The build procedure "make DEVELOPER=YesPlease" learned to enable a
bit more warning options depending on the compiler used to help
developers more.  There also is "make DEVOPTS=tokens" knob
available now, for those who want to help fixing warnings we
usually ignore, for example.

* nd/warn-more-for-devs:
  Makefile: add a DEVOPTS to get all of -Wextra
  Makefile: add a DEVOPTS to suppress -Werror under DEVELOPER
  Makefile: detect compiler and enable more warnings in DEVELOPER=1
  connect.c: mark die_initial_contact() NORETURN