Junio C Hamano [Thu, 5 Dec 2019 20:52:46 +0000 (12:52 -0800)]
Merge branch 'js/git-svn-use-rebase-merges'
Prepare further for "rebase --preserve-merges" deprecation.
* js/git-svn-use-rebase-merges:
git svn: stop using `rebase --preserve-merges`
Junio C Hamano [Thu, 5 Dec 2019 20:52:46 +0000 (12:52 -0800)]
Merge branch 'hi/gpg-optional-pkfp-fix'
The code to parse GPG output used to assume incorrectly that the
finterprint for the primary key would always be present for a valid
signature, which has been corrected.
* hi/gpg-optional-pkfp-fix:
gpg-interface: limit search for primary key fingerprint
gpg-interface: refactor the free-and-xmemdupz pattern
Junio C Hamano [Thu, 5 Dec 2019 20:52:46 +0000 (12:52 -0800)]
Merge branch 'pw/sequencer-compare-with-right-parent-to-check-empty-commits'
The sequencer machinery compared the HEAD and the state it is
attempting to commit to decide if the result would be a no-op
commit, even when amending a commit, which was incorrect, and
has been corrected.
* pw/sequencer-compare-with-right-parent-to-check-empty-commits:
sequencer: fix empty commit check when amending
Junio C Hamano [Thu, 5 Dec 2019 20:52:45 +0000 (12:52 -0800)]
Merge branch 'jk/fail-show-toplevel-outside-working-tree'
"git rev-parse --show-toplevel" run outside of any working tree did
not error out, which has been corrected.
* jk/fail-show-toplevel-outside-working-tree:
rev-parse: make --show-toplevel without a worktree an error
Junio C Hamano [Thu, 5 Dec 2019 20:52:45 +0000 (12:52 -0800)]
Merge branch 'sg/unpack-progress-throughput'
"git unpack-objects" used to show progress based only on the number
of received and unpacked objects, which stalled when it has to
handle an unusually large object. It now shows the throughput as
well.
* sg/unpack-progress-throughput:
builtin/unpack-objects.c: show throughput progress
Junio C Hamano [Thu, 5 Dec 2019 20:52:45 +0000 (12:52 -0800)]
Merge branch 'pb/submodule-update-fetches'
Doc update.
* pb/submodule-update-fetches:
doc: mention that 'git submodule update' fetches missing commits
Junio C Hamano [Thu, 5 Dec 2019 20:52:44 +0000 (12:52 -0800)]
Merge branch 'jc/azure-ci-osx-fix-fix'
CI jobs for macOS has been made less chatty when updating perforce
package used during testing.
* jc/azure-ci-osx-fix-fix:
ci(osx): update homebrew-cask repository with less noise
Junio C Hamano [Thu, 5 Dec 2019 20:52:44 +0000 (12:52 -0800)]
Merge branch 'dl/range-diff-with-notes'
"git range-diff" learned to take the "--notes=<ref>" and the
"--no-notes" options to control the commit notes included in the
log message that gets compared.
* dl/range-diff-with-notes:
format-patch: pass notes configuration to range-diff
range-diff: pass through --notes to `git log`
range-diff: output `## Notes ##` header
t3206: range-diff compares logs with commit notes
t3206: s/expected/expect/
t3206: disable parameter substitution in heredoc
t3206: remove spaces after redirect operators
pretty-options.txt: --notes accepts a ref instead of treeish
rev-list-options.txt: remove reference to --show-notes
argv-array: add space after `while`
Junio C Hamano [Thu, 5 Dec 2019 20:52:44 +0000 (12:52 -0800)]
Merge branch 'jh/userdiff-python-async'
The userdiff machinery has been taught that "async def" is another
way to begin a "function" in Python.
* jh/userdiff-python-async:
userdiff: support Python async functions
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'ec/fetch-mark-common-refs-trace2'
Trace2 annotation.
* ec/fetch-mark-common-refs-trace2:
fetch: add trace2 instrumentation
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'dd/rebase-merge-reserves-onto-label'
The logic to avoid duplicate label names generated by "git rebase
--rebase-merges" forgot that the machinery itself uses "onto" as a
label name, which must be avoided by auto-generated labels, which
has been corrected.
* dd/rebase-merge-reserves-onto-label:
sequencer: handle rebase-merges for "onto" message
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'js/builtin-add-i'
The beginning of rewriting "git add -i" in C.
* js/builtin-add-i:
built-in add -i: implement the `help` command
built-in add -i: use color in the main loop
built-in add -i: support `?` (prompt help)
built-in add -i: show unique prefixes of the commands
built-in add -i: implement the main loop
built-in add -i: color the header in the `status` command
built-in add -i: implement the `status` command
diff: export diffstat interface
Start to implement a built-in version of `git add --interactive`
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'js/rebase-r-safer-label'
A label used in the todo list that are generated by "git rebase
--rebase-merges" is used as a part of a refname; the logic to come
up with the label has been tightened to avoid names that cannot be
used as such.
* js/rebase-r-safer-label:
rebase -r: let `label` generate safer labels
rebase-merges: move labels' whitespace mangling into `label_oid()`
Junio C Hamano [Thu, 5 Dec 2019 20:52:43 +0000 (12:52 -0800)]
Merge branch 'ep/guard-kset-tar-headers'
Code clean-up.
* ep/guard-kset-tar-headers:
kset.h, tar.h: add missing header guard to prevent multiple inclusion
Junio C Hamano [Sun, 1 Dec 2019 17:04:07 +0000 (09:04 -0800)]
The second batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Sun, 1 Dec 2019 17:04:41 +0000 (09:04 -0800)]
Merge branch 'jk/gitweb-anti-xss'
Some codepaths in "gitweb" that forgot to escape URLs generated
based on end-user input have been corrected.
* jk/gitweb-anti-xss:
gitweb: escape URLs generated by href()
t/gitweb-lib.sh: set $REQUEST_URI
t/gitweb-lib.sh: drop confusing quotes
t9502: pass along all arguments in xss helper
Junio C Hamano [Sun, 1 Dec 2019 17:04:41 +0000 (09:04 -0800)]
Merge branch 'ar/install-doc-update-cmds-needing-the-shell'
Doc update.
* ar/install-doc-update-cmds-needing-the-shell:
INSTALL: use existing shell scripts as example
Junio C Hamano [Sun, 1 Dec 2019 17:04:41 +0000 (09:04 -0800)]
Merge branch 'ma/t7004'
Test fix.
* ma/t7004:
t7004: check existence of correct tag
Junio C Hamano [Sun, 1 Dec 2019 17:04:40 +0000 (09:04 -0800)]
Merge branch 'js/complete-svn-recursive'
The completion script (in contrib/) has been taught that "git svn"
supports the "--recursive" option.
* js/complete-svn-recursive:
completion: tab-complete "git svn --recursive"
Junio C Hamano [Sun, 1 Dec 2019 17:04:40 +0000 (09:04 -0800)]
Merge branch 'jk/send-pack-remote-failure'
Error handling after "git push" finishes sending the packdata and
waits for the response to the remote side has been improved.
* jk/send-pack-remote-failure:
send-pack: check remote ref status on pack-objects failure
Junio C Hamano [Sun, 1 Dec 2019 17:04:39 +0000 (09:04 -0800)]
Merge branch 'jc/fsmonitor-sanity-fix'
Remove an incorrect BUG() that should not trigger.
* jc/fsmonitor-sanity-fix:
fsmonitor: do not compare bitmap size with size of split index
Junio C Hamano [Sun, 1 Dec 2019 17:04:39 +0000 (09:04 -0800)]
Merge branch 'sg/skip-skipped-prereq'
Test update to avoid wasted cycles.
* sg/skip-skipped-prereq:
test-lib: don't check prereqs of test cases that won't be run anyway
Junio C Hamano [Sun, 1 Dec 2019 17:04:39 +0000 (09:04 -0800)]
Merge branch 'ds/test-read-graph'
Dev support for commit-graph feature.
* ds/test-read-graph:
test-tool: use 'read-graph' helper
Junio C Hamano [Sun, 1 Dec 2019 17:04:39 +0000 (09:04 -0800)]
Merge branch 'rs/use-copy-array-in-mingw-shell-command-preparation'
Code cleanup.
* rs/use-copy-array-in-mingw-shell-command-preparation:
mingw: use COPY_ARRAY for copying array
Junio C Hamano [Sun, 1 Dec 2019 17:04:38 +0000 (09:04 -0800)]
Merge branch 'rs/parse-options-dup-null-fix'
Code cleanup.
* rs/parse-options-dup-null-fix:
parse-options: avoid arithmetic on pointer that's potentially NULL
Junio C Hamano [Sun, 1 Dec 2019 17:04:38 +0000 (09:04 -0800)]
Merge branch 'jt/fetch-remove-lazy-fetch-plugging'
"git fetch" codepath had a big "do not lazily fetch missing objects
when I ask if something exists" switch. This has been corrected by
marking the "does this thing exist?" calls with "if not please do not
lazily fetch it" flag.
* jt/fetch-remove-lazy-fetch-plugging:
promisor-remote: remove fetch_if_missing=0
clone: remove fetch_if_missing=0
fetch: remove fetch_if_missing=0
Junio C Hamano [Sun, 1 Dec 2019 17:04:38 +0000 (09:04 -0800)]
Merge branch 'jk/optim-in-pack-idx-conversion'
Code clean-up.
* jk/optim-in-pack-idx-conversion:
pack-objects: avoid pointless oe_map_new_pack() calls
Junio C Hamano [Sun, 1 Dec 2019 17:04:37 +0000 (09:04 -0800)]
Merge branch 'dl/complete-rebase-onto'
The completion script (in contrib/) learned that the "--onto"
option of "git rebase" can take its argument as the value of the
option.
* dl/complete-rebase-onto:
completion: learn to complete `git rebase --onto=`
Junio C Hamano [Sun, 1 Dec 2019 17:04:37 +0000 (09:04 -0800)]
Merge branch 'tg/stash-refresh-index'
Recent update to "git stash pop" made the command empty the index
when run with the "--quiet" option, which has been corrected.
* tg/stash-refresh-index:
stash: make sure we have a valid index before writing it
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)]
Merge branch 'nn/doc-rebase-merges'
Doc update.
* nn/doc-rebase-merges:
doc: improve readability of --rebase-merges in git-rebase
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)]
Merge branch 'dd/sequencer-utf8'
Handling of commit objects that use non UTF-8 encoding during
"rebase -i" has been improved.
* dd/sequencer-utf8:
sequencer: reencode commit message for am/rebase --show-current-patch
sequencer: reencode old merge-commit message
sequencer: reencode squashing commit's message
sequencer: reencode revert/cherry-pick's todo list
sequencer: reencode to utf-8 before arrange rebase's todo list
t3900: demonstrate git-rebase problem with multi encoding
configure.ac: define ICONV_OMITS_BOM if necessary
t0028: eliminate non-standard usage of printf
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)]
Merge branch 'jk/remove-sha1-to-hex'
Code clean-up.
* jk/remove-sha1-to-hex:
hex: drop sha1_to_hex()
hex: drop sha1_to_hex_r()
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)]
Merge branch 'dj/typofix-merge-strat'
Typofix.
* dj/typofix-merge-strat:
merge-strategies: fix typo "reflected to" to "reflected in"
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)]
Merge branch 'rj/bundle-ui-updates'
"git bundle" has been taught to use the parse options API. "git
bundle verify" learned "--quiet" and "git bundle create" learned
options to control the progress output.
* rj/bundle-ui-updates:
bundle-verify: add --quiet
bundle-create: progress output control
bundle: framework for options before bundle file
Junio C Hamano [Sun, 1 Dec 2019 17:04:36 +0000 (09:04 -0800)]
Merge branch 'rs/skip-iprefix'
Code simplification.
* rs/skip-iprefix:
convert: use skip_iprefix() in validate_encoding()
utf8: use skip_iprefix() in same_utf_encoding()
Junio C Hamano [Sun, 1 Dec 2019 17:04:35 +0000 (09:04 -0800)]
Merge branch 'ln/userdiff-elixir'
The patterns to detect function boundary for Elixir language has
been added.
* ln/userdiff-elixir:
userdiff: add Elixir to supported userdiff languages
Junio C Hamano [Sun, 1 Dec 2019 17:04:35 +0000 (09:04 -0800)]
Merge branch 'py/shortlog-list-options-for-log'
Documentation pages for "git shortlog" now lists commit limiting
options explicitly.
* py/shortlog-list-options-for-log:
git-shortlog.txt: include commit limiting options
Junio C Hamano [Sun, 1 Dec 2019 17:04:35 +0000 (09:04 -0800)]
Merge branch 'en/doc-typofix'
Docfix.
* en/doc-typofix:
Fix spelling errors in no-longer-updated-from-upstream modules
multimail: fix a few simple spelling errors
sha1dc: fix trivial comment spelling error
Fix spelling errors in test commands
Fix spelling errors in messages shown to users
Fix spelling errors in names of tests
Fix spelling errors in comments of testcases
Fix spelling errors in code comments
Fix spelling errors in documentation outside of Documentation/
Documentation: fix a bunch of typos, both old and new
Junio C Hamano [Sun, 1 Dec 2019 17:04:34 +0000 (09:04 -0800)]
Merge branch 'ns/test-desc-typofix'
Typofix.
* ns/test-desc-typofix:
t: fix typo in test descriptions
Junio C Hamano [Sun, 1 Dec 2019 17:04:34 +0000 (09:04 -0800)]
Merge branch 'en/t6024-style'
Test updates.
* en/t6024-style:
t6024: modernize style
Junio C Hamano [Sun, 1 Dec 2019 17:04:34 +0000 (09:04 -0800)]
Merge branch 'en/misc-doc-fixes'
Misc doc fixes.
* en/misc-doc-fixes:
name-hash.c: remove duplicate word in comment
hashmap: fix documentation misuses of -> versus .
git-filter-branch.txt: correct argument name typo
Junio C Hamano [Sun, 1 Dec 2019 17:04:33 +0000 (09:04 -0800)]
Merge branch 'js/fetch-multi-lockfix'
Fetching from multiple remotes into the same repository in parallel
had a bad interaction with the recent change to (optionally) update
the commit-graph after a fetch job finishes, as these parallel
fetches compete with each other. Which has been corrected.
* js/fetch-multi-lockfix:
fetch: avoid locking issues between fetch.jobs/fetch.writeCommitGraph
fetch: add the command-line option `--write-commit-graph`
Junio C Hamano [Sun, 1 Dec 2019 17:04:33 +0000 (09:04 -0800)]
Merge branch 'rs/trace2-dots'
Code cleanup.
* rs/trace2-dots:
trace2: add dots directly to strbuf in perf_fmt_prepare()
Junio C Hamano [Sun, 1 Dec 2019 17:04:33 +0000 (09:04 -0800)]
Merge branch 'kw/fsmonitor-watchman-fix'
The watchman integration for fsmonitor was racy, which has been
corrected to be more conservative.
* kw/fsmonitor-watchman-fix:
fsmonitor: fix watchman integration
Junio C Hamano [Sun, 1 Dec 2019 17:04:33 +0000 (09:04 -0800)]
Merge branch 'cb/curl-use-xmalloc'
HTTP transport had possible allocator/deallocator mismatch, which
has been corrected.
* cb/curl-use-xmalloc:
remote-curl: unbreak http.extraHeader with custom allocators
Junio C Hamano [Sun, 1 Dec 2019 17:04:32 +0000 (09:04 -0800)]
Merge branch 'rt/fetch-message-fix'
A small message update.
* rt/fetch-message-fix:
fetch.c: fix typo in a warning message
Junio C Hamano [Sun, 1 Dec 2019 17:04:32 +0000 (09:04 -0800)]
Merge branch 'es/myfirstcontrib-updates'
Doc updates.
* es/myfirstcontrib-updates:
myfirstcontrib: hint to find gitgitgadget allower
myfirstcontrib: add dependency installation step
myfirstcontrib: add 'psuh' to command-list.txt
Junio C Hamano [Sun, 1 Dec 2019 17:04:32 +0000 (09:04 -0800)]
Merge branch 'hw/config-doc-in-header'
Follow recent push to move API docs from Documentation/ to header
files and update config.h
* hw/config-doc-in-header:
config: move documentation to config.h
Junio C Hamano [Sun, 1 Dec 2019 17:04:31 +0000 (09:04 -0800)]
Merge branch 'dl/doc-diff-no-index-implies-exit-code'
Doc update.
* dl/doc-diff-no-index-implies-exit-code:
git-diff.txt: document return code of `--no-index`
Junio C Hamano [Sun, 1 Dec 2019 17:04:31 +0000 (09:04 -0800)]
Merge branch 'js/vreportf-wo-buffering'
Messages from die() etc. can be mixed up from multiple processes
without even line buffering on Windows, which has been worked
around.
* js/vreportf-wo-buffering:
vreportf(): avoid relying on stdio buffering
Junio C Hamano [Sun, 1 Dec 2019 17:04:31 +0000 (09:04 -0800)]
Merge branch 'pb/no-recursive-reset-hard-in-worktree-add'
"git worktree add" internally calls "reset --hard" that should not
descend into submodules, even when submodule.recurse configuration
is set, but it was affected. This has been corrected.
* pb/no-recursive-reset-hard-in-worktree-add:
worktree: teach "add" to ignore submodule.recurse config
Junio C Hamano [Sun, 1 Dec 2019 17:04:30 +0000 (09:04 -0800)]
Merge branch 'pb/help-list-gitsubmodules-among-guides'
Help update.
* pb/help-list-gitsubmodules-among-guides:
help: add gitsubmodules to the list of guides
Junio C Hamano [Sun, 1 Dec 2019 17:04:30 +0000 (09:04 -0800)]
Merge branch 'sg/blame-indent-heuristics-is-now-the-default'
Message update.
* sg/blame-indent-heuristics-is-now-the-default:
builtin/blame.c: remove '--indent-heuristic' from usage string
Junio C Hamano [Sun, 1 Dec 2019 17:04:29 +0000 (09:04 -0800)]
Merge branch 'mr/clone-dir-exists-to-path-exists'
Code cleanup.
* mr/clone-dir-exists-to-path-exists:
clone: rename static function `dir_exists()`.
Junio C Hamano [Sun, 1 Dec 2019 17:04:29 +0000 (09:04 -0800)]
Merge branch 'ma/bisect-doc-sample-update'
"git merge --no-commit" needs "--no-ff" if you do not want to move
HEAD, which has been corrected in the manual page for "git bisect".
* ma/bisect-doc-sample-update:
Documentation/git-bisect.txt: add --no-ff to merge command
Junio C Hamano [Sun, 1 Dec 2019 17:04:29 +0000 (09:04 -0800)]
Merge branch 'js/git-path-head-dot-lock-fix'
"git rev-parse --git-path HEAD.lock" did not give the right path
when run in a secondary worktree.
* js/git-path-head-dot-lock-fix:
git_path(): handle `.lock` files correctly
t1400: wrap setup code in test case
Junio C Hamano [Sun, 1 Dec 2019 17:04:28 +0000 (09:04 -0800)]
Merge branch 'jc/log-graph-simplify'
The implementation of "git log --graph" got refactored and then its
output got simplified.
* jc/log-graph-simplify:
t4215: use helper function to check output
graph: fix coloring of octopus dashes
graph: flatten edges that fuse with their right neighbor
graph: smooth appearance of collapsing edges on commit lines
graph: rename `new_mapping` to `old_mapping`
graph: commit and post-merge lines for left-skewed merges
graph: tidy up display of left-skewed merges
graph: example of graph output that can be simplified
graph: extract logic for moving to GRAPH_PRE_COMMIT state
graph: remove `mapping_idx` and `graph_update_width()`
graph: reduce duplication in `graph_insert_into_new_columns()`
graph: reuse `find_new_column_by_commit()`
graph: handle line padding in `graph_next_line()`
graph: automatically track display width of graph lines
Junio C Hamano [Sun, 1 Dec 2019 17:04:28 +0000 (09:04 -0800)]
Merge branch 'jk/cleanup-object-parsing-and-fsck'
Crufty code and logic accumulated over time around the object
parsing and low-level object access used in "git fsck" have been
cleaned up.
* jk/cleanup-object-parsing-and-fsck: (23 commits)
fsck: accept an oid instead of a "struct tree" for fsck_tree()
fsck: accept an oid instead of a "struct commit" for fsck_commit()
fsck: accept an oid instead of a "struct tag" for fsck_tag()
fsck: rename vague "oid" local variables
fsck: don't require an object struct in verify_headers()
fsck: don't require an object struct for fsck_ident()
fsck: drop blob struct from fsck_finish()
fsck: accept an oid instead of a "struct blob" for fsck_blob()
fsck: don't require an object struct for report()
fsck: only require an oid for skiplist functions
fsck: only provide oid/type in fsck_error callback
fsck: don't require object structs for display functions
fsck: use oids rather than objects for object_name API
fsck_describe_object(): build on our get_object_name() primitive
fsck: unify object-name code
fsck: require an actual buffer for non-blobs
fsck: stop checking tag->tagged
fsck: stop checking commit->parent counts
fsck: stop checking commit->tree value
commit, tag: don't set parsed bit for parse failures
...
Philippe Blain [Sun, 24 Nov 2019 02:01:35 +0000 (21:01 -0500)]
doc: mention that 'git submodule update' fetches missing commits
'git submodule update' will fetch new commits from the submodule remote
if the SHA-1 recorded in the superproject is not found. This was not
mentioned in the documentation.
Helped-by: Junio C Hamano <gitster@pobox.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood [Fri, 22 Nov 2019 19:43:03 +0000 (19:43 +0000)]
sequencer: fix empty commit check when amending
This fixes a regression introduced in
356ee4659b ("sequencer: try to
commit without forking 'git commit'", 2017-11-24). When amending a
commit try_to_commit() was using the wrong parent when checking if the
commit would be empty. When amending we need to check against HEAD^ not
HEAD.
t3403 may not seem like the natural home for the new tests but a further
patch series will improve the advice printed by `git commit`. That
series will mutate these tests to check that the advice includes
suggesting `rebase --skip` to skip the fixup that would empty the
commit.
Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Fri, 22 Nov 2019 22:59:29 +0000 (22:59 +0000)]
git svn: stop using `rebase --preserve-merges`
We deprecated `--preserve-merges` in favor of `--rebase-merges`; Let's
reflect that in `git svn`.
Note: Even when the user asks for `--preserve-merges`, we now silently
pass `--rebase-merges` to `git rebase` instead. Technically, this is a
change of behavior. But practically, `git svn` only ever asks for a
non-interactive rebase, and `--preserve-merges` and `--rebase-merges`
are on par with regard to that.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Acked-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Hans Jerry Illikainen [Fri, 22 Nov 2019 20:23:12 +0000 (20:23 +0000)]
gpg-interface: limit search for primary key fingerprint
The VALIDSIG status line from GnuPG with --status-fd is documented to
have 9 required and 1 optional fields [1]. The final, and optional,
field is used to specify the fingerprint of the primary key that made
the signature in case it was made by a subkey. However, this field is
only available for OpenPGP signatures; not for CMS/X.509.
If the VALIDSIG status line does not have the optional 10th field, the
current code will continue reading onto the next status line. And this
is the case for non-OpenPGP signatures [1].
The consequence is that a subsequent status line may be considered as
the "primary key" for signatures that does not have an actual primary
key.
Limit the search of these 9 or 10 fields to the single line to avoid
this problem. If the 10th field is missing, report that there is no
primary key fingerprint.
[Reference]
[1] GnuPG Details, General status codes
https://git.gnupg.org/cgi-bin/gitweb.cgi?p=gnupg.git;a=blob;f=doc/DETAILS;h=
6ce340e8c04794add995e84308bb3091450bd28f;hb=HEAD#l483
The documentation says:
VALIDSIG <args>
The args are:
- <fingerprint_in_hex>
- <sig_creation_date>
- <sig-timestamp>
- <expire-timestamp>
- <sig-version>
- <reserved>
- <pubkey-algo>
- <hash-algo>
- <sig-class>
- [ <primary-key-fpr> ]
This status indicates that the signature is cryptographically
valid. [...] PRIMARY-KEY-FPR is the fingerprint of the primary key
or identical to the first argument.
The primary-key-fpr parameter is used for OpenPGP and not available
for CMS signatures. [...]
Signed-off-by: Hans Jerry Illikainen <hji@dyntopia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Hans Jerry Illikainen [Thu, 21 Nov 2019 23:43:35 +0000 (23:43 +0000)]
gpg-interface: refactor the free-and-xmemdupz pattern
Introduce a static replace_cstring() function to simplify repeated
pattern of free-and-xmemdupz() for GPG status line parsing.
This also helps us avoid potential memleaks if parsing of new status
lines are introduced in the future.
Signed-off-by: Hans Jerry Illikainen <hji@dyntopia.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Wed, 20 Nov 2019 21:18:47 +0000 (13:18 -0800)]
format-patch: pass notes configuration to range-diff
Since format-patch accepts `--[no-]notes`, one would expect the
range-diff generated to also respect the setting. Unfortunately, the
range-diff we currently generate only uses the default option (which
always outputs default notes, even when notes are not being used
elsewhere).
Pass the notes configuration to range-diff so that it can honor it.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Wed, 20 Nov 2019 21:18:45 +0000 (13:18 -0800)]
range-diff: pass through --notes to `git log`
When a commit being range-diff'd has a note attached to it, the note
will be compared as well. However, if a user has multiple notes refs or
if they want to suppress notes from being printed, there is currently no
way to do this.
Pass through `--[no-]notes[=<ref>]` to the `git log` call so that this
option is customizable.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Wed, 20 Nov 2019 21:18:43 +0000 (13:18 -0800)]
range-diff: output `## Notes ##` header
When notes were included in the output of range-diff, they were just
mashed together with the rest of the commit message. As a result, users
wouldn't be able to clearly distinguish where the commit message ended
and where the notes started.
Output a `## Notes ##` header when notes are detected so that notes can
be compared more clearly.
Note that we handle case of `Notes (<ref>): -> ## Notes (<ref>) ##` with
this code as well. We can't test this in this patch, however, since
there is currently no way to pass along different notes refs to `git
log`. This will be fixed in a future patch.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Wed, 20 Nov 2019 21:18:41 +0000 (13:18 -0800)]
t3206: range-diff compares logs with commit notes
The test suite had a blindspot where it did not check the behavior of
range-diff and format-patch when notes were present. Cover this
blindspot.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Wed, 20 Nov 2019 21:18:38 +0000 (13:18 -0800)]
t3206: 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".
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Wed, 20 Nov 2019 21:18:36 +0000 (13:18 -0800)]
t3206: disable parameter substitution in heredoc
In the first heredoc, parameter substitution is not used so prevent it
from happening in the future (perhaps by accident) by escaping the limit
EOF.
The remaining heredocs use parameter substitution so they cannot be
changed.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Wed, 20 Nov 2019 21:18:33 +0000 (13:18 -0800)]
t3206: 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 the
one instance of this.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Wed, 20 Nov 2019 21:18:31 +0000 (13:18 -0800)]
pretty-options.txt: --notes accepts a ref instead of treeish
Although `--notes=` accepts and handles a tree-ish just fine, it isn't a
common use-case for users to pass in bare trees. By having "treeish", it
makes it harder to click in users' minds that the argument here is the
same type as the `notes.displayRef` configuration variable, for example.
Change `treeish` to `ref` so that it will be easier for users to make
this connection.
Note that we don't completely lose the notion that `--notes=` can accept
a tree-ish. In git-notes.txt, we have
It is also permitted for a notes ref to point directly to a tree
object, in which case the history of the notes can be read with
`git log -p -g <refname>`.
which means that a hardcore user who wants to take advantage of this
obscure use-case will be able to infer the connection and not be
completely left in the dark.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Josh Holland [Tue, 19 Nov 2019 15:08:10 +0000 (15:08 +0000)]
userdiff: support Python async functions
Python's async functions (declared with "async def" rather than "def")
were not being displayed in hunk headers. This commit teaches git about
the async function syntax, and adds tests for the Python userdiff regex.
Signed-off-by: Josh Holland <anowlcalledjosh@gmail.com>
Acked-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Tue, 19 Nov 2019 23:55:32 +0000 (15:55 -0800)]
rev-list-options.txt: remove reference to --show-notes
In
ab18b2c0df ("log/pretty-options: Document --[no-]notes and deprecate
old notes options", 2011-03-30), the `--show-notes` option was
deprecated. However, this reference to it still remains. Change it to
reference the replacement option: `--notes`.
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Denton Liu [Tue, 19 Nov 2019 23:55:29 +0000 (15:55 -0800)]
argv-array: add space after `while`
Signed-off-by: Denton Liu <liu.denton@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Junio C Hamano [Wed, 20 Nov 2019 01:18:39 +0000 (10:18 +0900)]
ci(osx): update homebrew-cask repository with less noise
The OSX CI build procedure updates the homebrew-cask repository
before attempting to install perforce again, after seeing an
installation failure. This involves a "git pull" that by default
computes and outputs diffstat, which would only grow as the time
goes by and the repository cast in stone in the CI build image
becomes more and more stale relative to the upstream repository in
the outside world.
Suppress the diffstat to both save cycles to generate it, and strain
on the eyeballs to skip it.
Reported-by: SZEDER Gábor <szeder.dev@gmail.com>
Helped-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Doan Tran Cong Danh [Mon, 18 Nov 2019 11:57:47 +0000 (18:57 +0700)]
sequencer: handle rebase-merges for "onto" message
In order to work correctly, git-rebase --rebase-merges needs to make
initial todo list with unique labels.
Those unique labels is being handled by employing a hashmap and
appending an unique number if any duplicate is found.
But, we forget that beside those labels for side branches,
we also have a special label `onto' for our so-called new-base.
In a special case that any of those labels for side branches named
`onto', git will run into trouble.
Correct it.
Signed-off-by: Doan Tran Cong Danh <congdanhqx@gmail.com>
Acked-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
SZEDER Gábor [Tue, 19 Nov 2019 01:25:25 +0000 (02:25 +0100)]
builtin/unpack-objects.c: show throughput progress
'git unpack-objects' shows a progress line only counting the number of
unpacked objects, so if some of the received objects are unusually
large, then that progress might appear to be frozen while processing
such a larger object. I just stared at a seemingly stuck progress
line for over half a minute, while 'git fetch' was busy receiving a
pack with only a couple of objects (i.e. fewer than
'fetch.unpackLimit'), with one of them being over 80MB.
Display throughput in 'git unpack-objects' progress line, so we show
that something is going on even when receiving and processing a large
object.
Counting the consumed bytes is far away from the place that
counts objects and displays progress, and to pass around the 'struct
progress' instance we would have to modify the signature of five
functions and 14 of their callsites: this is just too much churn, so
let's rather make it file-scope static.
'git index-pack', i.e. the non-unpacking cousin of 'git
unpack-objects' already includes throughput in its progress line, and
it uses a file-scope static 'struct progress' instance as well.
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Tue, 19 Nov 2019 08:05:43 +0000 (03:05 -0500)]
rev-parse: make --show-toplevel without a worktree an error
Ever since it was introduced in
7cceca5ccc (Add 'git rev-parse
--show-toplevel' option., 2010-01-12), the --show-toplevel option has
treated a missing working tree as a quiet success: it neither prints a
toplevel path, but nor does it report any kind of error.
While a caller could distinguish this case by looking for an empty
response, the behavior is rather confusing. We're better off complaining
that there is no working tree, as other internal commands would do in
similar cases (e.g., "git status" or any builtin with NEED_WORK_TREE set
would just die()). So let's do the same here.
While we're at it, let's clarify the documentation and add some tests,
both for the new behavior and for the more mundane case (which was not
covered).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Erik Chen [Tue, 19 Nov 2019 23:02:09 +0000 (23:02 +0000)]
fetch: add trace2 instrumentation
Add trace2 regions to fetch-pack.c to better track time spent in the various
phases of a fetch:
* parsing remote refs and finding a cutoff
* marking local refs as complete
* marking complete remote refs as common
All stages could potentially be slow for repositories with many refs.
Signed-off-by: Erik Chen <erikchen@chromium.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Matthew Rogers [Sun, 17 Nov 2019 23:16:10 +0000 (23:16 +0000)]
rebase -r: let `label` generate safer labels
The `label` todo command in interactive rebases creates temporary refs
in the `refs/rewritten/` namespace. These refs are stored as loose refs,
i.e. as files in `.git/refs/rewritten/`, therefore they have to conform
with file name limitations on the current filesystem in addition to the
accepted ref format.
This poses a problem in particular on NTFS/FAT, where e.g. the colon,
double-quote and pipe characters are disallowed as part of a file name.
Let's safeguard against this by replacing not only white-space
characters by dashes, but all non-alpha-numeric ones.
However, we exempt non-ASCII UTF-8 characters from that, as it should be
quite possible to reflect branch names such as `↯↯↯` in refs/file names.
Signed-off-by: Matthew Rogers <mattr94@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Sun, 17 Nov 2019 23:16:09 +0000 (23:16 +0000)]
rebase-merges: move labels' whitespace mangling into `label_oid()`
One of the trickier aspects of the design of `git rebase
--rebase-merges` is the way labels are generated for the initial todo
list: those labels are supposed to be intuitive and first and foremost
unique.
To that end, `label_oid()` appends a unique suffix when necessary.
Those labels not only need to be unique, but they also need to be valid
refs. To make sure of that, `make_script_with_merges()` replaces
whitespace by dashes.
That would appear to be the wrong layer for that sanitizing step,
though: all callers of `label_oid()` should get that same benefit.
Even if it does not make a difference currently (the only called of
`label_oid()` that passes a label that might need to be sanitized _is_
`make_script_with_merges()`), let's move the responsibility for
sanitizing labels into the `label_oid()` function.
This commit is best viewed with `-w` because it unfortunately needs to
change the indentation of a large block of code in `label_oid()`.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Slavica Đukić [Fri, 15 Nov 2019 11:11:20 +0000 (11:11 +0000)]
built-in add -i: implement the `help` command
This imitates the code to show the help text from the Perl script
`git-add--interactive.perl` in the built-in version.
To make sure that it renders exactly like the Perl version of `git add
-i`, we also add a test case for that to `t3701-add-interactive.sh`.
Signed-off-by: Slavica Đukić <slawica92@hotmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Slavica Đukić [Fri, 15 Nov 2019 11:11:19 +0000 (11:11 +0000)]
built-in add -i: use color in the main loop
The error messages as well as the unique prefixes are colored in `git
add -i` by default; We need to do the same in the built-in version.
Signed-off-by: Slavica Đukić <slawica92@hotmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Fri, 15 Nov 2019 11:11:18 +0000 (11:11 +0000)]
built-in add -i: support `?` (prompt help)
With this change, we print out the same colored help text that the
Perl-based `git add -i` prints in the main loop when question mark is
entered.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Fri, 15 Nov 2019 11:11:17 +0000 (11:11 +0000)]
built-in add -i: show unique prefixes of the commands
Just like in the Perl script `git-add--interactive.perl`, for each
command a unique prefix is determined (if there exists any within the
given parameters), and shown in the list, and accepted as a shortcut for
the command.
To determine the unique prefixes, as well as to look up the command in
question, we use a copy of the list and sort it.
While this might seem like overkill for a single command, it will make
much more sense when all the commands are implemented, and when we reuse
the same logic to present a list of files to edit, with convenient
unique prefixes.
At the start of the development of this patch series, a dedicated data
structure was introduced that imitated the Trie that the Perl version
implements. However, this was deemed overkill, and we now simply sort
the list before determining the length of the unique prefixes by looking
at each item's neighbor. As a bonus, we now use the same sorted list to
perform a binary search using the user-provided prefix as search key.
Original-patch-by: Slavica Đukić <slawica92@hotmail.com>
Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Fri, 15 Nov 2019 11:11:16 +0000 (11:11 +0000)]
built-in add -i: implement the main loop
The reason why we did not start with the main loop to begin with is that
it is the first user of `list_and_choose()`, which uses the `list()`
function that we conveniently introduced for use by the `status`
command.
In contrast to the Perl version, in the built-in interactive `add`, we
will keep the `list()` function (which only displays items) and the
`list_and_choose()` function (which uses `list()` to display the items,
and only takes care of the "and choose" part) separate.
The `list_and_choose()` function, as implemented in
`git-add--interactive.perl` knows a few more tricks than the function we
introduce in this patch:
- There is a flag to let the user select multiple items.
- In multi-select mode, the list of items is prefixed with a marker
indicating what items have been selected.
- Initially, for each item a unique prefix is determined (if there
exists any within the given parameters), and shown in the list, and
accepted as a shortcut for the selection.
These features will be implemented in the C version later.
This patch does not add any new main loop command, of course, the
built-in `git add -i` still only supports the `status` command. The
remaining commands to follow over the course of the next commits.
To accommodate for listing the commands in columns, preparing for the
commands that will be implemented over the course of the next
patches/patch series, we teach the `list()` function to do precisely
that.
Note that we only have a prompt ending in a single ">" at this stage;
later commits will add commands that display a double ">>" to indicate
that the user is in a different loop than the main one.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 15 Nov 2019 09:06:07 +0000 (04:06 -0500)]
gitweb: escape URLs generated by href()
There's a cross-site scripting problem in gitweb, where it will print
URLs generated by its href() helper without further quoting. This allows
an attacker to point a victim to a specially crafted gitweb URL and
inject arbitrary HTML into the resulting page (which the victim sees as
coming from gitweb).
The base of the URL comes from evaluate_uri(), which pulls the value of
$REQUEST_URI via the CGI module. It tries to strip off $PATH_INFO, but
fails to do so in some cases (including ones that contain special
characters, like "+"). Most of the uses of the URL end up being passed
to "$cgi->a(-href = href())", which will get quoted properly by the CGI
module. But in a few places, we output them ourselves as part of
manually-generated HTML, and whatever was in the original URL will
appear unquoted in the output.
Given that all of the nearby variables placed into this manual HTML
_are_ quoted, it seems like the authors assumed that these URLs would
not need quoting. So it's possible that the bug is actually in
evaluate_uri(), which should be doing a more careful job of stripping
$PATH_INFO. There's some discussion in a comment in that function, as
well as the commit message in
81d3fe9f48 (gitweb: fix wrong base URL
when non-root DirectoryIndex, 2009-02-15). But I'm not sure I understand
it.
Regardless, it's a good idea to quote these values at the point of
insertion into the HTML output:
1. Even if there is a bug in evaluate_uri(), this would give us
belt-and-suspenders protection.
2. evaluate_uri() is only handling the base. Some generated URLs will
also mention arbitrary refs or filenames in the repositories, and
these should be quoted anyway.
3. It should never _hurt_ to quote (and that's what all of the
$cgi->a() calls are doing already).
So there may be further work here, but this patch at least prevents the
XSS vulnerability, and shouldn't make anything worse.
The test here covers the calls in print_feed_meta(), but I manually
audited every call to href() to see how its output was used, and quoted
appropriately. Most of them are esc_attr(), as they're used in tag
attributes, but I used esc_html() when the URLs were printed bare. The
distinction is largely academic, as one is implemented as a wrapper for
the other.
Reported-by: NAKAYAMA DAISUKE <nakyamad@icloud.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 15 Nov 2019 09:06:04 +0000 (04:06 -0500)]
t/gitweb-lib.sh: set $REQUEST_URI
In a real webserver's CGI call, gitweb.cgi would typically see
$REQUEST_URI set. This variable does impact how we display our URL in
the resulting page, so let's try to make our test as realistic as
possible (we can just use the $PATH_INFO our caller passed in, if any).
This doesn't change the outcome of any tests, but it will help us add
some new tests in a future patch.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 15 Nov 2019 09:06:01 +0000 (04:06 -0500)]
t/gitweb-lib.sh: drop confusing quotes
Some variables assignments in gitweb_run() look like this:
FOO=""$1""
The extra quotes aren't doing anything. Each set opens and closes an
empty string, and $1 is actually outside of any double-quotes (which is
OK, because variable assignment does not do whitespace splitting on the
expanded value).
Let's drop them, as they're simply confusing.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Fri, 15 Nov 2019 09:05:56 +0000 (04:05 -0500)]
t9502: pass along all arguments in xss helper
This function is just a thin wrapper around gitweb_run(), which takes
multiple arguments. But we only pass along "$1". Let's pass everything
we get, which will let a future patch add an XSS test that affects
PATH_INFO (which gitweb_run() takes as $2).
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Andrei Rybak [Thu, 14 Nov 2019 17:33:16 +0000 (18:33 +0100)]
INSTALL: use existing shell scripts as example
Script git-pull.sh has been removed in commit [1]. Use command
"request-pull" as an example of a shell script instead. Recently, many
of shell script commands have been re-written in C, so tweak the wording
of the sentence, while we're here.
[1]:
b1456605c2 (pull: remove redirection to git-pull.sh, 2015-06-18)
Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Martin Ågren [Wed, 13 Nov 2019 19:39:02 +0000 (20:39 +0100)]
t7004: check existence of correct tag
We try to delete the non-existing tag "anothertag", but for the
verifications, we check that the tag "myhead" doesn't exist. "myhead"
isn't used in this test except for this checking. Comparing to the test
two tests earlier, it looks like a copy-paste mistake.
Perhaps it's overkill to check that `git tag -d` didn't decide to
*create* a tag. But since we're trying to be this careful, let's
actually check the correct tag. While we're doing this, let's use a more
descriptive tag name instead -- "nonexistingtag" should be obvious.
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Slavica Đukić [Wed, 13 Nov 2019 12:41:00 +0000 (12:41 +0000)]
built-in add -i: color the header in the `status` command
For simplicity, we only implemented the `status` command without colors.
This patch starts adding color, matching what the Perl script
`git-add--interactive.perl` does.
Original-Patch-By: Daniel Ferreira <bnmvco@gmail.com>
Signed-off-by: Slavica Đukić <slawica92@hotmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Daniel Ferreira [Wed, 13 Nov 2019 12:40:59 +0000 (12:40 +0000)]
built-in add -i: implement the `status` command
This implements the `status` command of `git add -i`. The data
structures introduced in this commit will be extended later, as needed.
At this point, we re-implement only part of the `list_and_choose()`
function of the Perl script `git-add--interactive.perl` and call it
`list()`. It does not yet color anything, or do columns, or allow user
input.
Over the course of the next commits, we will introduce a
`list_and_choose()` function that uses `list()` to display the list of
options and let the user choose one or more of the displayed items. This
will be used to implement the main loop of the built-in `git add -i`, at
which point the new `status` command can actually be used.
Signed-off-by: Daniel Ferreira <bnmvco@gmail.com>
Signed-off-by: Slavica Đukić <slawica92@hotmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Daniel Ferreira [Wed, 13 Nov 2019 12:40:58 +0000 (12:40 +0000)]
diff: export diffstat interface
Make the diffstat interface (namely, the diffstat_t struct and
compute_diffstat) no longer be internal to diff.c and allow it to be used
by other parts of git.
This is helpful for code that may want to easily extract information
from files using the diff machinery, while flushing it differently from
how the show_* functions used by diff_flush() do it. One example is the
builtin implementation of git-add--interactive's status.
Signed-off-by: Daniel Ferreira <bnmvco@gmail.com>
Signed-off-by: Slavica Đukić <slawica92@hotmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin [Wed, 13 Nov 2019 12:40:57 +0000 (12:40 +0000)]
Start to implement a built-in version of `git add --interactive`
Unlike previous conversions to C, where we started with a built-in
helper, we start this conversion by adding an interception in the
`run_add_interactive()` function when the new opt-in
`add.interactive.useBuiltin` config knob is turned on (or the
corresponding environment variable `GIT_TEST_ADD_I_USE_BUILTIN`), and
calling the new internal API function `run_add_i()` that is implemented
directly in libgit.a.
At this point, the built-in version of `git add -i` only states that it
cannot do anything yet. In subsequent patches/patch series, the
`run_add_i()` function will gain more and more functionality, until it
is feature complete. The whole arc of the conversion can be found in the
PRs #170-175 at https://github.com/gitgitgadget/git.
The "--helper approach" can unfortunately not be used here: on Windows
we face the very specific problem that a `system()` call in
Perl seems to close `stdin` in the parent process when the spawned
process consumes even one character from `stdin`. Which prevents us from
implementing the main loop in C and still trying to hand off to the Perl
script.
The very real downside of the approach we have to take here is that the
test suite won't pass with `GIT_TEST_ADD_I_USE_BUILTIN=true` until the
conversion is complete (the `--helper` approach would have let it pass,
even at each of the incremental conversion steps).
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Thomas Gummerer [Wed, 13 Nov 2019 15:01:36 +0000 (15:01 +0000)]
stash: make sure we have a valid index before writing it
In 'do_apply_stash()' we refresh the index in the end. Since
34933d0eff ("stash: make sure to write refreshed cache", 2019-09-11),
we also write that refreshed index when --quiet is given to 'git stash
apply'.
However if '--index' is not given to 'git stash apply', we also
discard the index in the else clause just before. We need to do so
because we use an external 'git update-index --add --stdin', which
leads to an out of date in-core index.
Later we call 'refresh_and_write_cache', which now leads to writing
the discarded index, which means we essentially write an empty index
file. This is obviously not correct, or the behaviour the user
wanted. We should not modify the users index without being asked to
do so.
Make sure to re-read the index after discarding the current in-core
index, to avoid dealing with outdated information. Instead we could
also drop the 'discard_cache()' + 'read_cache()', however that would
make it easy to fall into the same trap as
34933d0eff did, so it's
better to avoid that.
We can also drop the 'refresh_and_write_cache' completely in the quiet
case. Previously in legacy stash we relied on 'git status' to refresh
the index after calling 'git read-tree' when '--index' was passed to
'git apply'. However the 'reset_tree()' call that replaced 'git
read-tree' always passes options that are equivalent to '-m', making
the refresh of the index unnecessary.
Reported-by: Grzegorz Rajchman <rayman17@gmail.com>
Signed-off-by: Thomas Gummerer <t.gummerer@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King [Wed, 13 Nov 2019 02:07:19 +0000 (21:07 -0500)]
send-pack: check remote ref status on pack-objects failure
When we're pushing a pack and our local pack-objects fails, we enter an
error code path that does a few things:
1. Set the status of every ref to REF_STATUS_NONE
2. Call receive_unpack_status() to try to get an error report from
the other side
3. Return an error to the caller
If pack-objects failed because the connection to the server dropped,
there's not much more we can do than report the hangup. And indeed, step
2 will try to read a packet from the other side, which will die() in the
packet-reading code with "the remote end hung up unexpectedly".
But if the connection _didn't_ die, then the most common issue is that
the remote index-pack or unpack-objects complained about our pack (we
could also have a local pack-objects error, but this ends up being the
same; we'd send an incomplete pack and the remote side would complain).
In that case we do report the error from the other side (because of step
2), but we fail to say anything further about the refs. The issue is
two-fold:
- in step 1, the "NONE" status is not "we saw an error, so we have no
status". It generally means "this ref did not match our refspecs, so
we didn't try to push it". So when we print out the push status
table, we won't mention any refs at all!
But even if we had a status enum for "pack-objects error", we
wouldn't want to blindly set it for every ref. For example, in a
non-atomic push we might have rejected some refs already on the
client side (e.g., REF_STATUS_REJECT_NODELETE) and we'd want to
report that.
- in step 2, we read just the unpack status. But receive-pack will
also tell us about each ref (usually that it rejected them because
of the unpacker error).
So a much better strategy is to leave the ref status fields as they are
(usually EXPECTING_REPORT) and then actually receive (and print) the
full per-ref status.
This case is actually covered in the test suite, as t5504.8, which
writes a pack that will be rejected by the remote unpack-objects. But
it's racy. Because our pack is small, most of the time pack-objects
manages to write the whole thing before the remote rejects it, and so it
returns success and we print out the errors from the remote. But very
occasionally (or when run under --stress) it goes slow enough to see a
failure in writing, and git-push reports nothing for the refs.
With this patch, the test should behave consistently.
There shouldn't be any downside to this approach. If we really did see
the connection drop, we'd already die in receive_unpack_status(), and
we'll continue to do so. If the connection drops _after_ we get the
unpack status but before we see any ref status, we'll still print the
remote unpacker error, but will now say "remote end hung up" instead of
returning the error up the call-stack. But as discussed, we weren't
showing anything more useful than that with the current code. And
anyway, that case is quite unlikely (the connection dropping at that
point would have to be unrelated to the pack-objects error, because of
the ordering of events).
In the future we might want to handle packet-read errors ourself instead
of dying, which would print a full ref status table even for hangups.
But in the meantime, this patch should be a strict improvement.
Helped-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
James Shubin [Wed, 13 Nov 2019 00:47:52 +0000 (00:47 +0000)]
completion: tab-complete "git svn --recursive"
Signed-off-by: James Shubin <james@shubin.ca>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Tan [Wed, 13 Nov 2019 00:34:20 +0000 (16:34 -0800)]
promisor-remote: remove fetch_if_missing=0
Commit
6462d5eb9a ("fetch: remove fetch_if_missing=0", 2019-11-08)
strove to remove the need for fetch_if_missing=0 from the fetching
mechanism, so it is plausible to attempt removing fetch_if_missing=0
from the lazy-fetching mechanism in promisor-remote as well.
But doing so reveals a bug - when the server does not send an object
pointed to by a tag object, an infinite loop occurs: Git attempts to
fetch the missing object, which causes a deferencing of all refs (for
negotiation), which causes a lazy fetch of that missing object, and so
on. This bug is because of unnecessary use of the fetch negotiator
during lazy fetching - it is not used after initialization, but it is
still initialized (which causes the dereferencing of all refs).
Thus, when the negotiator is not used during fetching, refrain from
initializing it. Then, remove fetch_if_missing from promisor-remote.
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>