gitweb.git
Merge branch 'tb/file-url-to-unc-path'Junio C Hamano Mon, 30 Sep 2019 04:19:27 +0000 (13:19 +0900)

Merge branch 'tb/file-url-to-unc-path'

Windows update.

* tb/file-url-to-unc-path:
mingw: support UNC in git clone file://server/share/repo

Merge branch 'js/gitdir-at-unc-root'Junio C Hamano Mon, 30 Sep 2019 04:19:26 +0000 (13:19 +0900)

Merge branch 'js/gitdir-at-unc-root'

On Windows, the root level of UNC share is now allowed to be used
just like any other directory.

* js/gitdir-at-unc-root:
setup_git_directory(): handle UNC root paths correctly
Fix .git/ discovery at the root of UNC shares
setup_git_directory(): handle UNC paths correctly

Merge branch 'ar/mingw-run-external-with-non-ascii... Junio C Hamano Mon, 30 Sep 2019 04:19:26 +0000 (13:19 +0900)

Merge branch 'ar/mingw-run-external-with-non-ascii-path'

Windows update.

* ar/mingw-run-external-with-non-ascii-path:
mingw: fix launching of externals from Unicode paths

Merge branch 'rs/parse-tree-indirect'Junio C Hamano Mon, 30 Sep 2019 04:19:26 +0000 (13:19 +0900)

Merge branch 'rs/parse-tree-indirect'

Code cleanup.

* rs/parse-tree-indirect:
tree: simplify parse_tree_indirect()

Merge branch 'jk/fast-import-history-bugfix'Junio C Hamano Mon, 30 Sep 2019 04:19:25 +0000 (13:19 +0900)

Merge branch 'jk/fast-import-history-bugfix'

The memory ownership model of the "git fast-import" got
straightened out.

* jk/fast-import-history-bugfix:
fast-import: duplicate into history rather than passing ownership
fast-import: duplicate parsed encoding string

Merge branch 'mh/notes-duplicate-entries'Junio C Hamano Mon, 30 Sep 2019 04:19:25 +0000 (13:19 +0900)

Merge branch 'mh/notes-duplicate-entries'

A few implementation fixes in the notes API.

* mh/notes-duplicate-entries:
notes: avoid potential use-after-free during insertion
notes: avoid leaking duplicate entries

Merge branch 'tb/banned-vsprintf-namefix'Junio C Hamano Mon, 30 Sep 2019 04:19:25 +0000 (13:19 +0900)

Merge branch 'tb/banned-vsprintf-namefix'

Error message fix.

* tb/banned-vsprintf-namefix:
banned.h: fix vsprintf()'s ban message

Merge branch 'mh/release-commit-memory-fix'Junio C Hamano Mon, 30 Sep 2019 04:19:25 +0000 (13:19 +0900)

Merge branch 'mh/release-commit-memory-fix'

Leakfix.

* mh/release-commit-memory-fix:
commit: free the right buffer in release_commit_memory

Merge branch 'mh/http-urlmatch-cleanup'Junio C Hamano Mon, 30 Sep 2019 04:19:24 +0000 (13:19 +0900)

Merge branch 'mh/http-urlmatch-cleanup'

Leakfix.

* mh/http-urlmatch-cleanup:
http: don't leak urlmatch_config.vars

Merge branch 'rs/strbuf-detach'Junio C Hamano Mon, 30 Sep 2019 04:19:24 +0000 (13:19 +0900)

Merge branch 'rs/strbuf-detach'

Straighten out the use of strbuf_detach() API function.

* rs/strbuf-detach:
grep: use return value of strbuf_detach()
log-tree: always use return value of strbuf_detach()

Merge branch 'rs/trace2-dst-warning'Junio C Hamano Mon, 30 Sep 2019 04:19:24 +0000 (13:19 +0900)

Merge branch 'rs/trace2-dst-warning'

Code cleanup.

* rs/trace2-dst-warning:
trace2: use warning() directly in tr2_dst_malformed_warning()

Merge branch 'dl/format-patch-doc-test-cleanup'Junio C Hamano Mon, 30 Sep 2019 04:19:23 +0000 (13:19 +0900)

Merge branch 'dl/format-patch-doc-test-cleanup'

The documentation and tests for "git format-patch" have been
cleaned up.

* dl/format-patch-doc-test-cleanup:
config/format.txt: specify default value of format.coverLetter
Doc: add more detail for git-format-patch
t4014: stop losing return codes of git commands
t4014: remove confusing pipe in check_threading()
t4014: use test_line_count() where possible
t4014: let sed open its own files
t4014: drop redirections to /dev/null
t4014: use indentable here-docs
t4014: remove spaces after redirect operators
t4014: use sq for test case names
t4014: move closing sq onto its own line
t4014: s/expected/expect/
t4014: drop unnecessary blank lines from test cases

Merge branch 'bc/hash-independent-tests-part-5'Junio C Hamano Mon, 30 Sep 2019 04:19:23 +0000 (13:19 +0900)

Merge branch 'bc/hash-independent-tests-part-5'

Preparation for SHA-256 upgrade continues in the test department.

* bc/hash-independent-tests-part-5:
t4009: make hash size independent
t4002: make hash independent
t4000: make hash size independent
t3903: abstract away SHA-1-specific constants
t3800: make hash-size independent
t3600: make hash size independent
t3506: make hash independent
t3430: avoid hard-coded object IDs
t3404: abstract away SHA-1-specific constants
t3306: abstract away SHA-1-specific constants
t3305: make hash size independent
t3301: abstract away SHA-1-specific constants
t3206: abstract away hash size constants
t3201: abstract away SHA-1-specific constants

Merge branch 'jc/test-cleanup'Junio C Hamano Mon, 30 Sep 2019 04:19:23 +0000 (13:19 +0900)

Merge branch 'jc/test-cleanup'

Code cleanup.

* jc/test-cleanup:
t3005: remove unused variable
t: use LF variable defined in the test harness

Merge branch 'dl/compat-cleanup'Junio C Hamano Mon, 30 Sep 2019 04:19:23 +0000 (13:19 +0900)

Merge branch 'dl/compat-cleanup'

Code cleanup.

* dl/compat-cleanup:
compat/*.[ch]: remove extern from function declarations using spatch
mingw: apply array.cocci rule

Merge branch 'js/visual-studio'Junio C Hamano Mon, 30 Sep 2019 04:19:22 +0000 (13:19 +0900)

Merge branch 'js/visual-studio'

Adjust .gitignore to unignore a path that we started to track.

* js/visual-studio:
.gitignore: stop ignoring `.manifest` files

Third batchJunio C Hamano Wed, 18 Sep 2019 18:55:13 +0000 (11:55 -0700)

Third batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'jt/avoid-ls-refs-with-http'Junio C Hamano Wed, 18 Sep 2019 18:50:10 +0000 (11:50 -0700)

Merge branch 'jt/avoid-ls-refs-with-http'

The http transport lacked some optimization the native transports
learned to avoid unnecessary ref advertisement, which has been
corrected.

* jt/avoid-ls-refs-with-http:
transport: teach all vtables to allow fetch first
transport-helper: skip ls-refs if unnecessary

Merge branch 'md/list-objects-filter-combo'Junio C Hamano Wed, 18 Sep 2019 18:50:09 +0000 (11:50 -0700)

Merge branch 'md/list-objects-filter-combo'

The list-objects-filter API (used to create a sparse/lazy clone)
learned to take a combined filter specification.

* md/list-objects-filter-combo:
list-objects-filter-options: make parser void
list-objects-filter-options: clean up use of ALLOC_GROW
list-objects-filter-options: allow mult. --filter
strbuf: give URL-encoding API a char predicate fn
list-objects-filter-options: make filter_spec a string_list
list-objects-filter-options: move error check up
list-objects-filter: implement composite filters
list-objects-filter-options: always supply *errbuf
list-objects-filter: put omits set in filter struct
list-objects-filter: encapsulate filter components

Merge branch 'cc/multi-promisor'Junio C Hamano Wed, 18 Sep 2019 18:50:09 +0000 (11:50 -0700)

Merge branch 'cc/multi-promisor'

Teach the lazy clone machinery that there can be more than one
promisor remote and consult them in order when downloading missing
objects on demand.

* cc/multi-promisor:
Move core_partial_clone_filter_default to promisor-remote.c
Move repository_format_partial_clone to promisor-remote.c
Remove fetch-object.{c,h} in favor of promisor-remote.{c,h}
remote: add promisor and partial clone config to the doc
partial-clone: add multiple remotes in the doc
t0410: test fetching from many promisor remotes
builtin/fetch: remove unique promisor remote limitation
promisor-remote: parse remote.*.partialclonefilter
Use promisor_remote_get_direct() and has_promisor_remote()
promisor-remote: use repository_format_partial_clone
promisor-remote: add promisor_remote_reinit()
promisor-remote: implement promisor_remote_get_direct()
Add initial support for many promisor remotes
fetch-object: make functions return an error code
t0410: remove pipes after git commands

Merge branch 'sg/line-log-tree-diff-optim'Junio C Hamano Wed, 18 Sep 2019 18:50:09 +0000 (11:50 -0700)

Merge branch 'sg/line-log-tree-diff-optim'

Optimize unnecessary full-tree diff away from "git log -L" machinery.

* sg/line-log-tree-diff-optim:
line-log: avoid unnecessary full tree diffs
line-log: extract pathspec parsing from line ranges into a helper function

Merge branch 'sg/complete-configuration-variables'Junio C Hamano Wed, 18 Sep 2019 18:50:08 +0000 (11:50 -0700)

Merge branch 'sg/complete-configuration-variables'

Command line completion updates for "git -c var.name=val"

* sg/complete-configuration-variables:
completion: complete config variables and values for 'git clone --config='
completion: complete config variables names and values for 'git clone -c'
completion: complete values of configuration variables after 'git -c var='
completion: complete configuration sections and variable names for 'git -c'
completion: split _git_config()
completion: simplify inner 'case' pattern in __gitcomp()
completion: use 'sort -u' to deduplicate config variable names
completion: deduplicate configuration sections
completion: add tests for 'git config' completion
completion: complete more values of more 'color.*' configuration variables
completion: fix a typo in a comment

Merge branch 'js/pre-merge-commit-hook'Junio C Hamano Wed, 18 Sep 2019 18:50:08 +0000 (11:50 -0700)

Merge branch 'js/pre-merge-commit-hook'

A new "pre-merge-commit" hook has been introduced.

* js/pre-merge-commit-hook:
merge: --no-verify to bypass pre-merge-commit hook
git-merge: honor pre-merge-commit hook
merge: do no-verify like commit
t7503: verify proper hook execution

Merge branch 'cb/curl-use-xmalloc'Junio C Hamano Wed, 18 Sep 2019 18:50:08 +0000 (11:50 -0700)

Merge branch 'cb/curl-use-xmalloc'

Tell cURL library to use the same malloc() implementation, with the
xmalloc() wrapper, as the rest of the system, for consistency.

* cb/curl-use-xmalloc:
http: use xmalloc with cURL

Merge branch 'jk/drop-release-pack-memory'Junio C Hamano Wed, 18 Sep 2019 18:50:07 +0000 (11:50 -0700)

Merge branch 'jk/drop-release-pack-memory'

xmalloc() used to have a mechanism to ditch memory and address
space resources as the last resort upon seeing an allocation
failure from the underlying malloc(), which made the code complex
and thread-unsafe with dubious benefit, as major memory resource
users already do limit their uses with various other mechanisms.
It has been simplified away.

* jk/drop-release-pack-memory:
packfile: drop release_pack_memory()

Merge branch 'js/rebase-r-strategy'Junio C Hamano Wed, 18 Sep 2019 18:50:07 +0000 (11:50 -0700)

Merge branch 'js/rebase-r-strategy'

"git rebase --rebase-merges" learned to drive different merge
strategies and pass strategy specific options to them.

* js/rebase-r-strategy:
t3427: accelerate this test by using fast-export and fast-import
rebase -r: do not (re-)generate root commits with `--root` *and* `--onto`
t3418: test `rebase -r` with merge strategies
t/lib-rebase: prepare for testing `git rebase --rebase-merges`
rebase -r: support merge strategies other than `recursive`
t3427: fix another incorrect assumption
t3427: accommodate for the `rebase --merge` backend having been replaced
t3427: fix erroneous assumption
t3427: condense the unnecessarily repetitive test cases into three
t3427: move the `filter-branch` invocation into the `setup` case
t3427: simplify the `setup` test case significantly
t3427: add a clarifying comment
rebase: fold git-rebase--common into the -p backend
sequencer: the `am` and `rebase--interactive` scripts are gone
.gitignore: there is no longer a built-in `git-rebase--interactive`
t3400: stop referring to the scripted rebase
Drop unused git-rebase--am.sh

Merge branch 'master' of https://github.com/prati0100... Junio C Hamano Wed, 18 Sep 2019 18:22:11 +0000 (11:22 -0700)

Merge branch 'master' of https://github.com/prati0100/git-gui

* 'master' of https://github.com/prati0100/git-gui:
git-gui: add hotkey to toggle "Amend Last Commit"
git-gui: add horizontal scrollbar to commit buffer
git-gui: convert new/amend commit radiobutton to checkbutton
git-gui: add hotkeys to set widget focus
git-gui: allow undoing last revert
git-gui: return early when patch fails to apply
git-gui: allow reverting selected hunk
git-gui: allow reverting selected lines

Merge gitk to pick up emergency build fixJunio C Hamano Tue, 17 Sep 2019 21:59:18 +0000 (14:59 -0700)

Merge gitk to pick up emergency build fix

gitk: rename zh_CN.po to zh_cn.po

gitk: rename zh_CN.po to zh_cn.poDenton Liu Tue, 17 Sep 2019 08:52:06 +0000 (01:52 -0700)

gitk: rename zh_CN.po to zh_cn.po

When running make from a clean environment, all of the *.po files should
be converted into *.msg files. After that, when make is run without any
changes, make should not do anything.

After beffae768a (gitk: Add Chinese (zh_CN) translation, 2017-03-11),
zh_CN.po was introduced. When make was run, a zh_cn.msg file was
generated (notice the lowercase). However, since make is case-sensitive,
it expects zh_CN.po to generate a zh_CN.msg file so make will keep
reattempting to generate a zh_CN.msg so successive make invocations
result in

Generating catalog po/zh_cn.msg
msgfmt --statistics --tcl po/zh_cn.po -l zh_cn -d po/
317 translated messages.

happening continuously.

Rename zh_CN.po to zh_cn.po so that when make generates the zh_cn.msg
file, it will realize that it was successfully generated and only run
once.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'master' of git://ozlabs.org/~paulus/gitkJunio C Hamano Mon, 16 Sep 2019 17:25:08 +0000 (10:25 -0700)

Merge branch 'master' of git://ozlabs.org/~paulus/gitk

* 'master' of git://ozlabs.org/~paulus/gitk:
gitk: Do not mistake unchanged lines for submodule changes
gitk: Use right colour for remote refs in the "Tags and heads" dialog
gitk: Add Chinese (zh_CN) translation
gitk: Make web links clickable

Merge branch 'bp/amend-toggle-bind'Pratyush Yadav Sat, 14 Sep 2019 17:53:12 +0000 (23:23 +0530)

Merge branch 'bp/amend-toggle-bind'

Toggle amend on and off with the keyboard shortcut "Ctrl+e".

* bp/amend-toggle-bind:
git-gui: add hotkey to toggle "Amend Last Commit"

git-gui: add hotkey to toggle "Amend Last Commit"Birger Skogeng Pedersen Sat, 14 Sep 2019 09:18:35 +0000 (11:18 +0200)

git-gui: add hotkey to toggle "Amend Last Commit"

Selecting whether to "Amend Last Commit" or not does not have a hotkey.

With this patch, the user may toggle between the two options with
CTRL/CMD+e.

Signed-off-by: Birger Skogeng Pedersen <birger.sp@gmail.com>
Rebased-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

gitk: Do not mistake unchanged lines for submodule... Gabriele Mazzotta Sat, 23 Mar 2019 17:00:36 +0000 (18:00 +0100)

gitk: Do not mistake unchanged lines for submodule changes

Unchanged lines are prefixed with a white-space, thus unchanged lines
starting with either " <" or " >" are mistaken for submodule changes.
Check if a line starts with either " <" or " >" only if we are listing
the changes of a submodule.

Signed-off-by: Gabriele Mazzotta <gabriele.mzt@gmail.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

gitk: Use right colour for remote refs in the "Tags... Paul Wise Thu, 21 Mar 2019 07:05:32 +0000 (15:05 +0800)

gitk: Use right colour for remote refs in the "Tags and heads" dialog

Makes it easier to see which refs are local and which refs are remote.
Adds consistency with the remote background colour in the graph display.

Signed-off-by: Paul Wise <pabs3@bonedaddy.net>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

gitk: Add Chinese (zh_CN) translationYanKe Fri, 10 Mar 2017 19:00:00 +0000 (03:00 +0800)

gitk: Add Chinese (zh_CN) translation

Signed-off-by: YanKe <imyanke@163.com>
Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

Merge branch 'bw/commit-scrollbuffer'Pratyush Yadav Fri, 13 Sep 2019 20:49:38 +0000 (02:19 +0530)

Merge branch 'bw/commit-scrollbuffer'

Add a scrollbar at the bottom of the commit message buffer.

* bw/commit-scrollbuffer:
git-gui: add horizontal scrollbar to commit buffer

Merge branch 'bw/amend-checkbutton'Pratyush Yadav Fri, 13 Sep 2019 20:48:27 +0000 (02:18 +0530)

Merge branch 'bw/amend-checkbutton'

Change the amend setting from two radio buttons ("New commit" and "Amend
commit") to a single checkbutton. The two radio buttons can never be
selected together because they are exactly the opposite of each other,
so it makes sense to change it to a single checkbutton.

* bw/amend-checkbutton:
git-gui: convert new/amend commit radiobutton to checkbutton

git-gui: add horizontal scrollbar to commit bufferBert Wesarg Fri, 13 Sep 2019 20:16:28 +0000 (22:16 +0200)

git-gui: add horizontal scrollbar to commit buffer

While the commit message widget has a configurable fixed width, it
nevertheless allowed to write commit messages which exceeded this limit.
Though there is no visual clue, that there is scrolling going on. Now
there is a horizontal scrollbar.

There seems to be a bug in at least Tcl/Tk up to version 8.6.8, which
does not update the horizontal scrollbar if one removes the whole
content at once.

Suggested-by: Birger Skogeng Pedersen <birger.sp@gmail.com>
Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

git-gui: convert new/amend commit radiobutton to checkb... Bert Wesarg Fri, 13 Sep 2019 06:02:30 +0000 (08:02 +0200)

git-gui: convert new/amend commit radiobutton to checkbutton

Its a bi-state anyway and also saves one line in the menu.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

Merge branch 'py/revert-hunks-lines'Pratyush Yadav Wed, 11 Sep 2019 21:11:12 +0000 (02:41 +0530)

Merge branch 'py/revert-hunks-lines'

git-gui learned to revert selected lines and hunks, just like it can
stage selected lines and hunks. To provide a safety net for accidental
revert, the most recent revert can be undone.

* py/revert-hunks-lines:
git-gui: allow undoing last revert
git-gui: return early when patch fails to apply
git-gui: allow reverting selected hunk
git-gui: allow reverting selected lines

Merge branch 'bp/widget-focus-hotkeys'Pratyush Yadav Wed, 11 Sep 2019 21:10:24 +0000 (02:40 +0530)

Merge branch 'bp/widget-focus-hotkeys'

git-gui learned to switch focus between widgets "unstaged commits",
"staged commits", "diff", and "commit message" using the keyboard
shortcuts Alt+1, Alt+2, Alt+3, and Alt+4 respectively.

* bp/widget-focus-hotkeys:
git-gui: add hotkeys to set widget focus

git-gui: add hotkeys to set widget focusBirger Skogeng Pedersen Wed, 4 Sep 2019 14:30:55 +0000 (16:30 +0200)

git-gui: add hotkeys to set widget focus

The user cannot change focus between the list of files, the diff view and
the commit message widgets without using the mouse (clicking either of
the four widgets).

With this patch, the user may set ui focus to the previously selected path
in either the "Unstaged Changes" or "Staged Changes" widgets, using
ALT+1 or ALT+2.

The user may also set the ui focus to the diff view widget with
ALT+3, or to the commit message widget with ALT+4.

This enables the user to select/unselect files, view the diff and create a
commit in git-gui using keyboard-only.

Signed-off-by: Birger Skogeng Pedersen <birger.sp@gmail.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

Second batchJunio C Hamano Mon, 9 Sep 2019 19:31:27 +0000 (12:31 -0700)

Second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>

Merge branch 'bc/reread-attributes-during-rebase'Junio C Hamano Mon, 9 Sep 2019 19:26:40 +0000 (12:26 -0700)

Merge branch 'bc/reread-attributes-during-rebase'

The "git am" based backend of "git rebase" ignored the result of
updating ".gitattributes" done in one step when replaying
subsequent steps.

* bc/reread-attributes-during-rebase:
am: reload .gitattributes after patching it
path: add a function to check for path suffix

Merge branch 'tg/t0021-racefix'Junio C Hamano Mon, 9 Sep 2019 19:26:40 +0000 (12:26 -0700)

Merge branch 'tg/t0021-racefix'

A test fix.

* tg/t0021-racefix:
t0021: make sure clean filter runs

Merge branch 'mp/for-each-ref-missing-name-or-email'Junio C Hamano Mon, 9 Sep 2019 19:26:39 +0000 (12:26 -0700)

Merge branch 'mp/for-each-ref-missing-name-or-email'

"for-each-ref" and friends that shows refs did not protect themselves
against ancient tags that did not record tagger names when asked to
show "%(taggername)", which have been corrected.

* mp/for-each-ref-missing-name-or-email:
ref-filter: initialize empty name or email fields

Merge branch 'sb/userdiff-dts'Junio C Hamano Mon, 9 Sep 2019 19:26:39 +0000 (12:26 -0700)

Merge branch 'sb/userdiff-dts'

Device-tree files learned their own userdiff patterns.

* sb/userdiff-dts:
userdiff: add a builtin pattern for dts files

Merge branch 'rs/sort-oid-array-thread-safe'Junio C Hamano Mon, 9 Sep 2019 19:26:39 +0000 (12:26 -0700)

Merge branch 'rs/sort-oid-array-thread-safe'

Prepare get_short_oid() codepath to be thread-safe.

* rs/sort-oid-array-thread-safe:
sha1-name: make sort_ambiguous_oid_array() thread-safe

Merge branch 'nd/diff-parseopt'Junio C Hamano Mon, 9 Sep 2019 19:26:38 +0000 (12:26 -0700)

Merge branch 'nd/diff-parseopt'

Compilation fix.

* nd/diff-parseopt:
parseopt: move definition of enum parse_opt_result up

Merge branch 'jt/diff-lazy-fetch-submodule-fix'Junio C Hamano Mon, 9 Sep 2019 19:26:38 +0000 (12:26 -0700)

Merge branch 'jt/diff-lazy-fetch-submodule-fix'

On-demand object fetching in lazy clone incorrectly tried to fetch
commits from submodule projects, while still working in the
superproject, which has been corrected.

* jt/diff-lazy-fetch-submodule-fix:
diff: skip GITLINK when lazy fetching missing objs

Merge branch 'ds/midx-expire-repack'Junio C Hamano Mon, 9 Sep 2019 19:26:38 +0000 (12:26 -0700)

Merge branch 'ds/midx-expire-repack'

Code cleanup.

* ds/midx-expire-repack:
packfile.h: drop extern from function declaration

Merge branch 'cb/fetch-set-upstream'Junio C Hamano Mon, 9 Sep 2019 19:26:37 +0000 (12:26 -0700)

Merge branch 'cb/fetch-set-upstream'

"git fetch" learned "--set-upstream" option to help those who first
clone from their private fork they intend to push to, add the true
upstream via "git remote add" and then "git fetch" from it.

* cb/fetch-set-upstream:
pull, fetch: add --set-upstream option

Merge branch 'rs/pax-extended-header-length-fix'Junio C Hamano Mon, 9 Sep 2019 19:26:37 +0000 (12:26 -0700)

Merge branch 'rs/pax-extended-header-length-fix'

"git archive" recorded incorrect length in extended pax header in
some corner cases, which has been corrected.

* rs/pax-extended-header-length-fix:
archive-tar: turn length miscalculation warning into BUG
archive-tar: use size_t in strbuf_append_ext_header()
archive-tar: fix pax extended header length calculation
archive-tar: report wrong pax extended header length

Merge branch 'bm/repository-layout-typofix'Junio C Hamano Mon, 9 Sep 2019 19:26:37 +0000 (12:26 -0700)

Merge branch 'bm/repository-layout-typofix'

Typofix.

* bm/repository-layout-typofix:
repository-layout.txt: correct pluralization of 'object'

Merge branch 'en/checkout-mismerge-fix'Junio C Hamano Mon, 9 Sep 2019 19:26:36 +0000 (12:26 -0700)

Merge branch 'en/checkout-mismerge-fix'

Fix a mismerge that happened in 2.22 timeframe.

* en/checkout-mismerge-fix:
checkout: remove duplicate code

Merge branch 'sg/diff-indent-heuristic-non-experimental'Junio C Hamano Mon, 9 Sep 2019 19:26:36 +0000 (12:26 -0700)

Merge branch 'sg/diff-indent-heuristic-non-experimental'

We promoted the "indent heuristics" that decides where to split
diff hunks from experimental to the default a few years ago, but
some stale documentation still marked it as experimental, which has
been corrected.

* sg/diff-indent-heuristic-non-experimental:
diff: 'diff.indentHeuristic' is no longer experimental

Merge branch 'ds/feature-macros'Junio C Hamano Mon, 9 Sep 2019 19:26:36 +0000 (12:26 -0700)

Merge branch 'ds/feature-macros'

A mechanism to affect the default setting for a (related) group of
configuration variables is introduced.

* ds/feature-macros:
repo-settings: create feature.experimental setting
repo-settings: create feature.manyFiles setting
repo-settings: parse core.untrackedCache
commit-graph: turn on commit-graph by default
t6501: use 'git gc' in quiet mode
repo-settings: consolidate some config settings

Merge branch 'jk/eoo'Junio C Hamano Mon, 9 Sep 2019 19:26:35 +0000 (12:26 -0700)

Merge branch 'jk/eoo'

The command line parser learned "--end-of-options" notation; the
standard convention for scripters to have hardcoded set of options
first on the command line, and force the command to treat end-user
input as non-options, has been to use "--" as the delimiter, but
that would not work for commands that use "--" as a delimiter
between revs and pathspec.

* jk/eoo:
gitcli: document --end-of-options
parse-options: allow --end-of-options as a synonym for "--"
revision: allow --end-of-options to end option parsing

Merge branch 'jk/repo-init-cleanup'Junio C Hamano Mon, 9 Sep 2019 19:26:35 +0000 (12:26 -0700)

Merge branch 'jk/repo-init-cleanup'

Further clean-up of the initialization code.

* jk/repo-init-cleanup:
config: stop checking whether the_repository is NULL
common-main: delay trace2 initialization
t1309: use short branch name in includeIf.onbranch test

Merge branch 'py/git-gui-do-quit'Junio C Hamano Mon, 9 Sep 2019 19:26:35 +0000 (12:26 -0700)

Merge branch 'py/git-gui-do-quit'

"git gui" learned to call the clean-up procedure before exiting.

* py/git-gui-do-quit:
git-gui: call do_quit before destroying the main window

config/format.txt: specify default value of format... Denton Liu Tue, 27 Aug 2019 04:05:20 +0000 (00:05 -0400)

config/format.txt: specify default value of format.coverLetter

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Doc: add more detail for git-format-patchDenton Liu Tue, 27 Aug 2019 04:05:17 +0000 (00:05 -0400)

Doc: add more detail for git-format-patch

In git-format-patch.txt, we were missing some key user information.
First of all, document the special value of `--base=auto`.

Next, while we're at it, surround option arguments with <> and change
existing names such as "Message-Id" to "message id", which conforms with
how existing documentation is written.

Finally, document the `format.outputDirectory` config and change
`format.coverletter` to use camel case.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: stop losing return codes of git commandsDenton Liu Tue, 27 Aug 2019 04:05:15 +0000 (00:05 -0400)

t4014: stop losing return codes of git commands

Currently, there are two ways where the return codes of Git commands are
lost. The first way is when a command is in the upstream of a pipe. In a
pipe, only the return code of the last command is used. Thus, all other
commands will have their return codes masked. Rewrite pipes so that
there are no Git commands upstream.

The other way is when a command is in a non-assignment subshell. The
return code will be lost in favour of the surrounding command's. Rewrite
instances of this such that Git commands output to a file and
surrounding commands only call subshells with non-Git commands.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: remove confusing pipe in check_threading()Denton Liu Tue, 27 Aug 2019 04:05:12 +0000 (00:05 -0400)

t4014: remove confusing pipe in check_threading()

In check_threading(), there was a Git command in the upstream of a pipe.
In order to not lose its status code, it was saved into a file. However,
this may be confusing so rewrite to redirect IO to file. This allows us
to directly use the conventional &&-chain.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: use test_line_count() where possibleDenton Liu Tue, 27 Aug 2019 04:05:10 +0000 (00:05 -0400)

t4014: use test_line_count() where possible

Convert all instances of `cnt=$(... | wc -l) && test $cnt = N` into uses
of `test_line_count()`.

While we're at it, convert one instance of a Git command upstream of a
pipe into two commands. This prevents a failure of a Git command from
being masked since only the return code of the last member of the pipe
is shown.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: let sed open its own filesDenton Liu Tue, 27 Aug 2019 04:05:07 +0000 (00:05 -0400)

t4014: let sed open its own files

In some cases, we were using a redirection operator to feed input into
sed. However, since sed is capable of opening its own files, make sed
open its own files instead of redirecting input into it.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: drop redirections to /dev/nullDenton Liu Tue, 27 Aug 2019 04:05:05 +0000 (00:05 -0400)

t4014: drop redirections to /dev/null

Since output is silenced when running without `-v` and debugging output
is useful with `-v`, remove redirections to /dev/null as it is not
useful.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: use indentable here-docsDenton Liu Tue, 27 Aug 2019 04:05:03 +0000 (00:05 -0400)

t4014: use indentable here-docs

The convention is to use indentable here-docs within test cases so that
the here-docs line up with the rest of the code within the test case.
Change here-docs from `<<\EOF` to `<<-\EOF` so that they can be indented
along with the rest of the test case.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: remove spaces after redirect operatorsDenton Liu Tue, 27 Aug 2019 04:05:00 +0000 (00:05 -0400)

t4014: remove spaces after redirect operators

For shell scripts, the usual convention is for there to be no space
after redirection operators, (e.g. `>file`, not `> file`). Remove these
spaces wherever they appear.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: use sq for test case namesDenton Liu Tue, 27 Aug 2019 04:04:58 +0000 (00:04 -0400)

t4014: use sq for test case names

The usual convention is for test case names to be written between
single-quotes. Change all double-quoted test case names to single-quotes
except for one test case name that uses a sq for a contraction.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: move closing sq onto its own lineDenton Liu Tue, 27 Aug 2019 04:04:55 +0000 (00:04 -0400)

t4014: move closing sq onto its own line

The usual convention for test cases is for the closing sq to be on its
own line. Move the sq onto its own line for cases that do not conform to
this style.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4014: s/expected/expect/Denton Liu Tue, 27 Aug 2019 04:04:52 +0000 (00:04 -0400)

t4014: s/expected/expect/

For test cases, the usual convention is to name expected output files
"expect", not "expected". Replace all instances of "expected" with
"expect", except for one case where the "expected" is used as the name
of a test case.

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3005: remove unused variableJunio C Hamano Thu, 5 Sep 2019 18:17:57 +0000 (11:17 -0700)

t3005: remove unused variable

Since the beginning of the script, $new_line variable was never used.
Remove it.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

t: use LF variable defined in the test harnessJunio C Hamano Tue, 3 Sep 2019 21:11:22 +0000 (14:11 -0700)

t: use LF variable defined in the test harness

A few test scripts assign a single LF to $LF, but that is already
given by test-lib.sh to everybody.

Remove the unnecessary reassignment.

Signed-off-by: Junio C Hamano <gitster@pobox.com>

compat/*.[ch]: remove extern from function declarations... Denton Liu Wed, 4 Sep 2019 11:09:48 +0000 (04:09 -0700)

compat/*.[ch]: remove extern from function declarations using spatch

In 554544276a (*.[ch]: remove extern from function declarations using
spatch, 2019-04-29), we removed externs from function declarations using
spatch but we intentionally excluded files under compat/ since some are
directly copied from an upstream and we should avoid churning them so
that manually merging future updates will be simpler.

In the last commit, we determined the files which taken from an upstream
so we can exclude them and run spatch on the remainder.

This was the Coccinelle patch used:

@@
type T;
identifier f;
@@
- extern
T f(...);

and it was run with:

$ git ls-files compat/\*\*.{c,h} |
xargs spatch --sp-file contrib/coccinelle/noextern.cocci --in-place
$ git checkout -- \
compat/regex/ \
compat/inet_ntop.c \
compat/inet_pton.c \
compat/nedmalloc/ \
compat/obstack.{c,h} \
compat/poll/

Coccinelle has some trouble dealing with `__attribute__` and varargs so
we ran the following to ensure that no remaining changes were left
behind:

$ git ls-files compat/\*\*.{c,h} |
xargs sed -i'' -e 's/^\(\s*\)extern \([^(]*([^*]\)/\1\2/'
$ git checkout -- \
compat/regex/ \
compat/inet_ntop.c \
compat/inet_pton.c \
compat/nedmalloc/ \
compat/obstack.{c,h} \
compat/poll/

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: apply array.cocci ruleDenton Liu Wed, 4 Sep 2019 11:09:45 +0000 (04:09 -0700)

mingw: apply array.cocci rule

After running Coccinelle on all sources inside compat/ that were created
by us[1], it was found that compat/mingw.c violated an array.cocci rule
in two places and, thus, a patch was generated. Apply this patch so that
all compat/ sources created by us follows all cocci rules.

[1]: Do not run Coccinelle on files that are taken from some upstream
because in case we need to pull updates from them, we would like to have
diverged as little as possible in order to make merging updates simpler.

The following sources were determined to have been taken from some
upstream:

* compat/regex/
* compat/inet_ntop.c
* compat/inet_pton.c
* compat/nedmalloc/
* compat/obstack.{c,h}
* compat/poll/

Signed-off-by: Denton Liu <liu.denton@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t3427: accelerate this test by using fast-export and... Elijah Newren Wed, 4 Sep 2019 21:40:48 +0000 (14:40 -0700)

t3427: accelerate this test by using fast-export and fast-import

fast-export and fast-import can easily handle the simple rewrite that
was being done by filter-branch, and should be faster on systems with a
slow fork. Measuring the overall time taken for all of t3427 (not just
the difference between filter-branch and fast-export/fast-import) shows
a speedup of about 5% on Linux and 11% on Mac.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

.gitignore: stop ignoring `.manifest` filesJohannes Schindelin Thu, 5 Sep 2019 11:16:33 +0000 (04:16 -0700)

.gitignore: stop ignoring `.manifest` files

On Windows, it is possible to embed additional metadata into an
executable by linking in a "manifest", i.e. an XML document that
describes capabilities and requirements (such as minimum or maximum
Windows version). These XML documents are expected to be stored in
`.manifest` files.

At least _some_ Visual Studio versions auto-generate `.manifest` files
when none is specified explicitly, therefore we used to ask Git to
ignore them.

However, we do have a beautiful `.manifest` file now:
`compat/win32/git.manifest`, so neither does Visual Studio auto-generate
a manifest for us, nor do we want Git to ignore the `.manifest` files
anymore.

Further reading on auto-generated `.manifest` files:
https://docs.microsoft.com/en-us/cpp/build/manifest-generation-in-visual-studio

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

am: reload .gitattributes after patching itbrian m. carlson Mon, 2 Sep 2019 22:39:44 +0000 (22:39 +0000)

am: reload .gitattributes after patching it

When applying multiple patches with git am, or when rebasing using the
am backend, it's possible that one of our patches has updated a
gitattributes file. Currently, we cache this information, so if a
file in a subsequent patch has attributes applied, the file will be
written out with the attributes in place as of the time we started the
rebase or am operation, not with the attributes applied by the previous
patch. This problem does not occur when using the -m or -i flags to
rebase.

To ensure we write the correct data into the working tree, expire the
cache after each patch that touches a path ending in ".gitattributes".
Since we load these attributes in multiple separate files, we must
expire them accordingly.

Verify that both the am and rebase code paths work correctly, including
the conflict marker size with am -3.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

tree: simplify parse_tree_indirect()René Scharfe Thu, 29 Aug 2019 19:06:22 +0000 (21:06 +0200)

tree: simplify parse_tree_indirect()

Reduce code duplication by turning parse_tree_indirect() into a wrapper
of repo_peel_to_type(). This avoids a segfault when handling a broken
tag where ->tagged is NULL. The new version also checks the return
value of parse_object() that was ignored by the old one.

Initial-patch-by: Stefan Sperling <stsp@stsp.name>
Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

gitk: Make web links clickablePaul Mackerras Mon, 26 Aug 2019 22:12:34 +0000 (08:12 +1000)

gitk: Make web links clickable

This makes gitk look for http or https URLs in the commit description
and make the URLs clickable. Clicking on them will invoke an external
web browser with the URL.

The web browser command is by default "xdg-open" on Linux, "open" on
MacOS, and "cmd /c start" on Windows. The command can be changed in
the preferences window, and it can include parameters as well as the
command name. If it is set to the empty string then URLs will no
longer be made clickable.

Signed-off-by: Paul Mackerras <paulus@ozlabs.org>

git-gui: allow undoing last revertPratyush Yadav Sun, 25 Aug 2019 20:13:23 +0000 (01:43 +0530)

git-gui: allow undoing last revert

Accidental clicks on the revert hunk/lines buttons can cause loss of
work, and can be frustrating. So, allow undoing the last revert.

Right now, a stack or deque are not being used for the sake of
simplicity, so only one undo is possible. Any reverts before the
previous one are lost.

Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>

fast-import: duplicate into history rather than passing... Jeff King Sun, 25 Aug 2019 08:10:55 +0000 (04:10 -0400)

fast-import: duplicate into history rather than passing ownership

Fast-import's read_next_command() has somewhat odd memory ownership
semantics for the command_buf strbuf. After reading a command, we copy
the strbuf's pointer (without duplicating the string) into our cmd_hist
array of recent commands. And then when we're about to read a new
command, we clear the strbuf by calling strbuf_detach(), dropping
ownership from the strbuf (leaving the cmd_hist reference as the
remaining owner).

This has a few surprising implications:

- if the strbuf hasn't been copied into cmd_hist (e.g., because we
haven't ready any commands yet), then the strbuf_detach() will leak
the resulting string

- any modification to command_buf risks invalidating the pointer held
by cmd_hist. There doesn't seem to be any way to trigger this
currently (since we tend to modify it only by detaching and reading
in a new value), but it's subtly dangerous.

- any pointers into an input string will remain valid as long as
cmd_hist points to them. So in general, you can point into
command_buf.buf and call read_next_command() up to 100 times before
your string is cycled out and freed, leaving you with a dangling
pointer. This makes it easy to miss bugs during testing, as they
might trigger only for a sufficiently large commit (e.g., the bug
fixed in the previous commit).

Instead, let's make a new string to copy the command into the history
array, rather than having dual ownership with the old. Then we can drop
the strbuf_detach() calls entirely, and just reuse the same buffer
within command_buf over and over. We'd normally have to strbuf_reset()
it before using it again, but in both cases here we're using
strbuf_getline(), which does it automatically for us.

This fixes the leak, and it means that even a single call to
read_next_command() will invalidate any held pointers, making it easier
to find bugs. In fact, we can drop the extra input lines added to the
test case by the previous commit, as the unfixed bug would now trigger
just from reading the commit message, even without any modified files in
the commit.

Reported-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

fast-import: duplicate parsed encoding stringJeff King Sun, 25 Aug 2019 08:08:21 +0000 (04:08 -0400)

fast-import: duplicate parsed encoding string

We read each line of the fast-import stream into the command_buf strbuf.
When reading a commit, we parse a line like "encoding foo" by storing a
pointer to "foo", but not making a copy. We may then read an unbounded
number of other lines (e.g., one for each modified file in the commit),
each of which writes into command_buf.

This works out in practice for small cases, because we hand off
ownership of the heap buffer from command_buf to the cmd_hist array, and
read new commands into a fresh heap buffer. And thus the pointer to
"foo" remains valid as long as there aren't so many intermediate lines
that we end up dropping the original "encoding" line from the history.

But as the test modification shows, if we go over our default of 100
lines, we end up with our encoding string pointing into freed heap
memory. This seems to fail reliably by writing garbage into the output,
but running under ASan definitely detects this as a use-after-free.

We can fix it by duplicating the encoding value, just as we do for other
parsed lines (e.g., an author line ends up in parse_ident, which copies
it to a new string).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

trace2: use warning() directly in tr2_dst_malformed_war... René Scharfe Sun, 25 Aug 2019 17:44:10 +0000 (19:44 +0200)

trace2: use warning() directly in tr2_dst_malformed_warning()

Let warning() format the message instead of using an intermediate strbuf
for that. This is shorter, easier to read and avoids an allocation.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

grep: use return value of strbuf_detach()René Scharfe Sun, 25 Aug 2019 13:26:40 +0000 (15:26 +0200)

grep: use return value of strbuf_detach()

Append the strbuf buffer only after detaching it. There is no practical
difference here, as the strbuf is not empty and no strbuf_ function is
called between storing the pointer to the still attached buffer and
calling strbuf_detach(), so that pointer is valid, but make sure to
follow the standard sequence anyway for consistency.

Signed-off-by: René Scharfe <l.s.r@web.de>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

log-tree: always use return value of strbuf_detach()René Scharfe Sun, 25 Aug 2019 12:53:26 +0000 (14:53 +0200)

log-tree: always use return value of strbuf_detach()

strbuf_detach() has been returning a pointer to a buffer even for empty
strbufs since 08ad56f3f0 ("strbuf: always return a non-NULL value from
strbuf_detach", 2012-10-18). Use that feature in show_log() instead of
having it handle empty strbufs specially.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

http: don't leak urlmatch_config.varsMike Hommey Mon, 26 Aug 2019 07:49:11 +0000 (16:49 +0900)

http: don't leak urlmatch_config.vars

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

commit: free the right buffer in release_commit_memoryMike Hommey Mon, 26 Aug 2019 02:01:37 +0000 (11:01 +0900)

commit: free the right buffer in release_commit_memory

The index field in the commit object is used to find the buffer
corresponding to that commit in the buffer_slab. Resetting it first
means free_commit_buffer is not going to free the right buffer.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

path: add a function to check for path suffixbrian m. carlson Sun, 25 Aug 2019 23:33:39 +0000 (23:33 +0000)

path: add a function to check for path suffix

We have a function to strip the path suffix from a commit, but we don't
have one to check for a path suffix. For a plain filename, we can use
basename, but that requires an allocation, since POSIX allows it to
modify its argument. Refactor strip_path_suffix into a helper function
and a new function, ends_with_path_components, to meet this need.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

banned.h: fix vsprintf()'s ban messageTaylor Blau Sun, 25 Aug 2019 19:42:13 +0000 (15:42 -0400)

banned.h: fix vsprintf()'s ban message

In cc8fdaee1e (banned.h: mark sprintf() as banned, 2018-07-24), both
'sprintf()' and 'vsprintf()' were marked as banned functions. The
non-variadic macro to ban 'vsprintf' has a typo which says that
'sprintf', not 'vsprintf' is banned. The variadic version does not have
the same typo.

Fix this by updating the explicit form of 'vsprintf' as the banned
version of itself, not 'sprintf'.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes: avoid potential use-after-free during insertionJeff King Sun, 25 Aug 2019 07:19:51 +0000 (03:19 -0400)

notes: avoid potential use-after-free during insertion

The note_tree_insert() function may free the leaf_node struct we pass in
(e.g., if it's a duplicate, or if it needs to be combined with an
existing note).

Most callers are happy with this, as they assume that ownership of the
struct is handed off. But in load_subtree(), if we see an error we'll
use the handed-off struct's key_oid to generate the die() message,
potentially accessing freed memory.

We can easily fix this by instead using the original oid that we copied
into the leaf_node struct.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

notes: avoid leaking duplicate entriesMike Hommey Sun, 25 Aug 2019 05:18:18 +0000 (14:18 +0900)

notes: avoid leaking duplicate entries

When add_note is called multiple times with the same key/value pair, the
leaf_node it creates is leaked by notes_tree_insert.

Signed-off-by: Mike Hommey <mh@glandium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: fix launching of externals from Unicode pathsAdam Roben Sat, 24 Aug 2019 22:38:56 +0000 (15:38 -0700)

mingw: fix launching of externals from Unicode paths

If Git were installed in a path containing non-ASCII characters,
commands such as `git am` and `git submodule`, which are implemented as
externals, would fail to launch with the following error:

> fatal: 'am' appears to be a git command, but we were not
> able to execute it. Maybe git-am is broken?

This was due to lookup_prog not being Unicode-aware. It was somehow
missed in 85faec9d3a (Win32: Unicode file name support (except dirent),
2012-03-15).

Note that the only problem in this function was calling
`GetFileAttributes()` instead of `GetFileAttributesW()`. The calls to
`access()` were fine because `access()` is a macro which resolves to
`mingw_access()`, which already handles Unicode correctly. But
`lookup_prog()` was changed to use `_waccess()` directly so that we only
convert the path to UTF-16 once.

To make things work correctly, we have to maintain UTF-8 and UTF-16
versions in tandem in `lookup_prog()`.

Signed-off-by: Adam Roben <adam@roben.org>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup_git_directory(): handle UNC root paths correctlyJohannes Schindelin Sat, 24 Aug 2019 22:10:46 +0000 (15:10 -0700)

setup_git_directory(): handle UNC root paths correctly

When working in the root directory of a file share (this is only
possible in Git Bash and Powershell, but not in CMD), the current
directory is reported without a trailing slash.

This is different from Unix and standard Windows directories: both / and
C:\ are reported with a trailing slash as current directories.

If a Git worktree is located there, Git is not quite prepared for that:
while it does manage to find the .git directory/file, it returns as
length of the top-level directory's path *one more* than the length of
the current directory, and setup_git_directory_gently() would then
return an undefined string as prefix.

In practice, this undefined string usually points to NUL bytes, and does
not cause much harm. Under rare circumstances that are really involved
to reproduce (and not reliably so), the reported prefix could be a
suffix string of Git's exec path, though.

A careful analysis determined that this bug is unlikely to be
exploitable, therefore we mark this as a regular bug fix.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

Fix .git/ discovery at the root of UNC sharesJohannes Schindelin Sat, 24 Aug 2019 22:10:45 +0000 (15:10 -0700)

Fix .git/ discovery at the root of UNC shares

A very common assumption in Git's source code base is that
offset_1st_component() returns either 0 for relative paths, or 1 for
absolute paths that start with a slash. In other words, the return value
is either 0 or points just after the dir separator.

This assumption is not fulfilled when calling offset_1st_component()
e.g. on UNC paths on Windows, e.g. "//my-server/my-share". In this case,
offset_1st_component() returns the length of the entire string (which is
correct, because stripping the last "component" would not result in a
valid directory), yet the return value still does not point just after a
dir separator.

This assumption is most prominently seen in the
setup_git_directory_gently_1() function, where we want to append a
".git" component and simply assume that there is already a dir
separator. In the UNC example given above, this assumption is incorrect.

As a consequence, Git will fail to handle a worktree at the top of a UNC
share correctly.

Let's fix this by adding a dir separator specifically for that case: we
found that there is no first component in the path and it does not end
in a dir separator? Then add it.

This fixes https://github.com/git-for-windows/git/issues/1320

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

setup_git_directory(): handle UNC paths correctlyJohannes Schindelin Sat, 24 Aug 2019 22:10:44 +0000 (15:10 -0700)

setup_git_directory(): handle UNC paths correctly

The first offset in a UNC path is not the host name, but the folder name after that.

This fixes https://github.com/git-for-windows/git/issues/1181

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

mingw: support UNC in git clone file://server/share... Torsten Bögershausen Sat, 24 Aug 2019 22:07:59 +0000 (15:07 -0700)

mingw: support UNC in git clone file://server/share/repo

Extend the parser to accept file://server/share/repo in the way that
Windows users expect it to be parsed who are used to referring to file
shares by UNC paths of the form \\server\share\folder.

[jes: tightened check to avoid handling file://C:/some/path as a UNC
path.]

This closes https://github.com/git-for-windows/git/issues/1264.

Signed-off-by: Torsten Bögershausen <tboegi@web.de>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4009: make hash size independentbrian m. carlson Mon, 26 Aug 2019 01:43:44 +0000 (01:43 +0000)

t4009: make hash size independent

Instead of hard-coding object IDs, compute them and use those in the
comparison. Note that the comparison code ignores the actual object
IDs, but does check that they're the right size, so computing them is
the easiest way to ensure that they are.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

t4002: make hash independentbrian m. carlson Mon, 26 Aug 2019 01:43:43 +0000 (01:43 +0000)

t4002: make hash independent

Factor out the hard-coded object IDs and use test_oid to provide values
for both SHA-1 and SHA-256.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>