]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Merge branch 'la/strvec-comment-fix' into maint-2.43
authorJunio C Hamano <gitster@pobox.com>
Tue, 13 Feb 2024 22:44:49 +0000 (14:44 -0800)
committerJunio C Hamano <gitster@pobox.com>
Tue, 13 Feb 2024 22:44:49 +0000 (14:44 -0800)
Comment fix.

* la/strvec-comment-fix:
  strvec: use correct member name in comments

397 files changed:
.gitlab-ci.yml [new file with mode: 0644]
Documentation/CodingGuidelines
Documentation/MyFirstContribution.txt
Documentation/RelNotes/1.6.2.txt
Documentation/RelNotes/1.6.3.txt
Documentation/RelNotes/1.6.4.txt
Documentation/RelNotes/1.6.5.txt
Documentation/RelNotes/1.6.6.txt
Documentation/RelNotes/2.43.1.txt [new file with mode: 0644]
Documentation/SubmittingPatches
Documentation/config/advice.txt
Documentation/config/format.txt
Documentation/config/rebase.txt
Documentation/git-add.txt
Documentation/git-bisect.txt
Documentation/git-checkout.txt
Documentation/git-cvsimport.txt
Documentation/git-diff.txt
Documentation/git-format-patch.txt
Documentation/git-imap-send.txt
Documentation/git-merge.txt
Documentation/git-rebase.txt
Documentation/git-send-email.txt
Documentation/git-switch.txt
Documentation/git-worktree.txt
Documentation/git.txt
Documentation/gitcore-tutorial.txt
Documentation/gitprotocol-http.txt
Documentation/gitrepository-layout.txt
Documentation/gitweb.conf.txt
Documentation/gitweb.txt
Documentation/glossary-content.txt
Documentation/howto/keep-canonical-history-correct.txt
Documentation/merge-options.txt
Documentation/rev-list-options.txt
Documentation/signoff-option.txt
Documentation/user-manual.txt
GIT-VERSION-GEN
INSTALL
Makefile
README.md
RelNotes
add-patch.c
apply.c
archive-tar.c
archive-zip.c
archive.c
archive.h
bisect.c
blame.c
blame.h
blob.c
bloom.c
branch.c
builtin/add.c
builtin/am.c
builtin/apply.c
builtin/archive.c
builtin/bisect.c
builtin/blame.c
builtin/branch.c
builtin/cat-file.c
builtin/checkout-index.c
builtin/checkout.c
builtin/clean.c
builtin/clone.c
builtin/column.c
builtin/commit-graph.c
builtin/commit-tree.c
builtin/commit.c
builtin/credential-cache.c
builtin/describe.c
builtin/diff-files.c
builtin/diff-index.c
builtin/diff-tree.c
builtin/diff.c
builtin/difftool.c
builtin/fast-export.c
builtin/fast-import.c
builtin/fetch.c
builtin/for-each-ref.c
builtin/fsck.c
builtin/fsmonitor--daemon.c
builtin/get-tar-commit-id.c
builtin/grep.c
builtin/hash-object.c
builtin/hook.c
builtin/index-pack.c
builtin/init-db.c
builtin/log.c
builtin/ls-files.c
builtin/ls-remote.c
builtin/ls-tree.c
builtin/mailinfo.c
builtin/merge-base.c
builtin/merge-recursive.c
builtin/merge-tree.c
builtin/merge.c
builtin/mktag.c
builtin/mv.c
builtin/notes.c
builtin/pack-objects.c
builtin/pull.c
builtin/push.c
builtin/range-diff.c
builtin/read-tree.c
builtin/rebase.c
builtin/receive-pack.c
builtin/reflog.c
builtin/repack.c
builtin/rerere.c
builtin/reset.c
builtin/rev-list.c
builtin/rev-parse.c
builtin/revert.c
builtin/rm.c
builtin/send-pack.c
builtin/show-ref.c
builtin/sparse-checkout.c
builtin/stash.c
builtin/submodule--helper.c
builtin/tag.c
builtin/unpack-objects.c
builtin/update-ref.c
builtin/verify-commit.c
builtin/verify-tag.c
builtin/worktree.c
bulk-checkin.c
bundle-uri.c
cache-tree.c
ci/install-docker-dependencies.sh
ci/lib.sh
ci/print-test-failures.sh
combine-diff.c
commit-graph.c
commit-reach.c
commit.c
commit.h
compat/fsmonitor/fsm-health-win32.c
compat/fsmonitor/fsm-listen-darwin.c
compat/fsmonitor/fsm-listen-win32.c
compat/mingw.c
compat/simple-ipc/ipc-shared.c
compat/simple-ipc/ipc-unix-socket.c
config.c
contrib/completion/git-completion.bash
contrib/diff-highlight/DiffHighlight.pm
contrib/mw-to-git/Git/Mediawiki.pm
convert.h
delta-islands.c
diff-lib.c
diff-no-index.c
diff.c
diffcore-break.c
diffcore-delta.c
dir.c
entry.c
environment.c
exec-cmd.c
fetch-pack.c
fetch-pack.h
fsck.c
fsmonitor--daemon.h
fsmonitor-ipc.c
gettext.c
git-archimport.perl
git-cvsexportcommit.perl
git-cvsimport.perl
git-cvsserver.perl
git-gui/git-gui.sh
git-gui/lib/encoding.tcl
git-gui/po/README
git-instaweb.sh
git-send-email.perl
git-svn.perl
gitk-git/gitk
gitweb/INSTALL
gitweb/gitweb.perl
gitweb/static/gitweb.css
gitweb/static/js/lib/common-lib.js
gpg-interface.c
gpg-interface.h
graph.h
grep.c
help.c
http-fetch.c
http-push.c
http-walker.c
http.c
http.h
imap-send.c
json-writer.h
kwset.c
kwset.h
line-log.c
line-log.h
line-range.c
list-objects-filter-options.c
list-objects-filter.c
list.h
log-tree.c
ls-refs.c
mailinfo.c
merge-blobs.c
merge-ll.c
merge-ort.c
merge-recursive.c
merge.c
midx.h
negotiator/noop.c
notes-utils.c
notes.c
object-file.c
object-name.c
pack-bitmap-write.c
pack-check.c
pack-write.c
packfile.c
packfile.h
parse-options.c
patch-ids.c
perl/FromCPAN/Error.pm
perl/Git.pm
perl/Git/I18N.pm
perl/Git/LoadCPAN.pm
perl/Git/LoadCPAN/Error.pm
perl/Git/LoadCPAN/Mail/Address.pm
perl/Git/Packet.pm
perl/Git/SVN.pm
pkt-line.c
pkt-line.h
protocol-caps.c
protocol.h
reachable.c
read-cache.c
ref-filter.c
ref-filter.h
reflog.c
refs.h
refs/files-backend.c
refs/packed-backend.c
refs/ref-cache.c
reftable/block.c
reftable/block.h
reftable/block_test.c
reftable/blocksource.c
reftable/dump.c
reftable/generic.c
reftable/iter.h
reftable/merged.c
reftable/merged.h
reftable/merged_test.c
reftable/pq_test.c
reftable/reader.c
reftable/readwrite_test.c
reftable/refname_test.c
reftable/stack.c
reftable/stack_test.c
reftable/test_framework.c
reftable/test_framework.h
reftable/tree_test.c
remote-curl.c
remote.c
remote.h
repo-settings.c
rerere.c
reset.c
revision.c
run-command.c
send-pack.c
sequencer.c
setup.c
sh-i18n--envsubst.c
sha1dc/sha1.c
shallow.c
shell.c
sideband.c
submodule-config.c
submodule-config.h
submodule.c
t/Makefile
t/README
t/chainlint/blank-line-before-esac.expect
t/chainlint/blank-line.expect
t/chainlint/block.expect
t/chainlint/chain-break-background.expect
t/chainlint/chain-break-return-exit.expect
t/chainlint/chain-break-status.expect
t/chainlint/chained-subshell.expect
t/chainlint/command-substitution-subsubshell.expect
t/chainlint/dqstring-line-splice.expect
t/chainlint/dqstring-no-interpolate.expect
t/chainlint/empty-here-doc.expect
t/chainlint/exclamation.expect
t/chainlint/for-loop-abbreviated.expect
t/chainlint/for-loop.expect
t/chainlint/function.expect
t/chainlint/here-doc.expect
t/chainlint/loop-detect-status.expect
t/chainlint/nested-cuddled-subshell.expect
t/chainlint/nested-loop-detect-failure.expect
t/chainlint/nested-subshell.expect
t/chainlint/pipe.expect
t/chainlint/subshell-here-doc.expect
t/chainlint/subshell-one-liner.expect
t/chainlint/t7900-subtree.expect
t/chainlint/token-pasting.expect
t/chainlint/while-loop.expect
t/helper/test-bundle-uri.c
t/helper/test-pkt-line.c
t/helper/test-reach.c
t/helper/test-regex.c
t/helper/test-repository.c
t/helper/test-simple-ipc.c
t/helper/test-submodule.c
t/helper/test-trace2.c
t/lib-gpg.sh
t/lib-httpd.sh
t/perf/perf-lib.sh
t/t0040-parse-options.sh
t/t0070-fundamental.sh
t/t0202/test.pl
t/t0210-trace2-normal.sh
t/t0211-trace2-perf.sh
t/t0212-trace2-event.sh
t/t0410-partial-clone.sh
t/t1006-cat-file.sh
t/t1400-update-ref.sh
t/t1401-symbolic-ref.sh
t/t1403-show-ref.sh
t/t1410-reflog.sh
t/t1417-reflog-updateref.sh
t/t2400-worktree-add.sh
t/t3310-notes-merge-manual-resolve.sh
t/t3903-stash.sh
t/t4001-diff-rename.sh
t/t4013-diff-various.sh
t/t4053-diff-no-index.sh
t/t4301-merge-tree-write-tree.sh
t/t5000-tar-tree.sh
t/t5100-mailinfo.sh
t/t5100/comment.expect
t/t5100/comment.in
t/t5318-commit-graph.sh
t/t5401-update-hooks.sh
t/t5510-fetch.sh
t/t5551-http-fetch-smart.sh
t/t5562/invoke-with-content-length.pl
t/t5574-fetch-output.sh
t/t5606-clone-options.sh
t/t6005-rev-list-count.sh
t/t6009-rev-list-parent.sh
t/t6018-rev-list-glob.sh
t/t6021-rev-list-exclude-hidden.sh
t/t6022-rev-list-missing.sh
t/t6030-bisect-porcelain.sh
t/t6300-for-each-ref.sh
t/t6301-for-each-ref-errors.sh
t/t7102-reset.sh
t/t7512-status-help.sh
t/t7700-repack.sh
t/t9002-column.sh
t/t9114-git-svn-dcommit-merge.sh
t/t9350-fast-export.sh
t/t9700/test.pl
t/t9801-git-p4-branch.sh
t/t9816-git-p4-locked.sh
t/test-lib-functions.sh
t/test-lib-github-workflow-markup.sh
t/test-lib-junit.sh
t/test-lib.sh
t/test-terminal.perl
templates/hooks--pre-commit.sample
tmp-objdir.c
trace.c
trace2.c
trace2.h
trace2/tr2_ctr.c
trace2/tr2_sysenv.c
trace2/tr2_tgt_normal.c
trace2/tr2_tls.c
trace2/tr2_tls.h
trace2/tr2_tmr.c
trailer.c
trailer.h
transport-helper.c
transport.c
tree.c
upload-pack.c
utf8.c
utf8.h
worktree.c
wrapper.c
write-or-die.c
wt-status.c
wt-status.h
xdiff-interface.c

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
new file mode 100644 (file)
index 0000000..cd98bcb
--- /dev/null
@@ -0,0 +1,53 @@
+default:
+  timeout: 2h
+
+workflow:
+  rules:
+    - if: $CI_PIPELINE_SOURCE == "merge_request_event"
+    - if: $CI_COMMIT_TAG
+    - if: $CI_COMMIT_REF_PROTECTED == "true"
+
+test:
+  image: $image
+  before_script:
+    - ./ci/install-docker-dependencies.sh
+  script:
+    - useradd builder --create-home
+    - chown -R builder "${CI_PROJECT_DIR}"
+    - sudo --preserve-env --set-home --user=builder ./ci/run-build-and-tests.sh
+  after_script:
+    - |
+      if test "$CI_JOB_STATUS" != 'success'
+      then
+        sudo --preserve-env --set-home --user=builder ./ci/print-test-failures.sh
+      fi
+  parallel:
+    matrix:
+      - jobname: linux-sha256
+        image: ubuntu:latest
+        CC: clang
+      - jobname: linux-gcc
+        image: ubuntu:20.04
+        CC: gcc
+        CC_PACKAGE: gcc-8
+      - jobname: linux-TEST-vars
+        image: ubuntu:20.04
+        CC: gcc
+        CC_PACKAGE: gcc-8
+      - jobname: linux-gcc-default
+        image: ubuntu:latest
+        CC: gcc
+      - jobname: linux-leaks
+        image: ubuntu:latest
+        CC: gcc
+      - jobname: linux-asan-ubsan
+        image: ubuntu:latest
+        CC: clang
+      - jobname: pedantic
+        image: fedora:latest
+      - jobname: linux-musl
+        image: alpine:latest
+  artifacts:
+    paths:
+      - t/failed-test-artifacts
+    when: on_failure
index 8d3a467c0135319162b71290810917cca5f8316f..578587a47155e929457e12862cd648c9fdf81acd 100644 (file)
@@ -450,7 +450,7 @@ For C programs:
    one of the approved headers that includes it first for you.  (The
    approved headers currently include "builtin.h",
    "t/helper/test-tool.h", "xdiff/xinclude.h", or
-   "reftable/system.h").  You do not have to include more than one of
+   "reftable/system.h".)  You do not have to include more than one of
    these.
 
  - A C file must directly include the header files that declare the
@@ -490,7 +490,7 @@ For Perl programs:
 
  - Most of the C guidelines above apply.
 
- - We try to support Perl 5.8 and later ("use Perl 5.008").
+ - We try to support Perl 5.8.1 and later ("use Perl 5.008001").
 
  - use strict and use warnings are strongly preferred.
 
@@ -518,7 +518,7 @@ For Perl programs:
 
 For Python scripts:
 
- - We follow PEP-8 (http://www.python.org/dev/peps/pep-0008/).
+ - We follow PEP-8 (https://peps.python.org/pep-0008/).
 
  - As a minimum, we aim to be compatible with Python 2.7.
 
@@ -578,7 +578,7 @@ Externally Visible Names
    . The variable name describes the effect of tweaking this knob.
 
    The section and variable names that consist of multiple words are
-   formed by concatenating the words without punctuations (e.g. `-`),
+   formed by concatenating the words without punctuation marks (e.g. `-`),
    and are broken using bumpyCaps in documentation as a hint to the
    reader.
 
index 7cfed60c2e984f4fa29aca68983c2260faf451ee..279f6a3e7ca4678f01196e9f60cdea372d0cc4f1 100644 (file)
@@ -833,7 +833,7 @@ Johannes Schindelin to make life as a Git contributor easier for those used to
 the GitHub PR workflow. It allows contributors to open pull requests against its
 mirror of the Git project, and does some magic to turn the PR into a set of
 emails and send them out for you. It also runs the Git continuous integration
-suite for you. It's documented at http://gitgitgadget.github.io.
+suite for you. It's documented at https://gitgitgadget.github.io/.
 
 [[create-fork]]
 === Forking `git/git` on GitHub
index 980adfb31546974b69e4aff8ef91ab05e00da41f..166d73c60fb11e021b77afc0b759de52cfba0495 100644 (file)
@@ -10,7 +10,7 @@ To ease the transition plan, the receiving repository of such a
 push running this release will issue a big warning when the
 configuration variable is missing.  Please refer to:
 
-  http://git.or.cz/gitwiki/GitFaq#non-bare
+  https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
   https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
 for more details on the reason why this change is needed and the
index 4bcff945e019d92f58cef08517fa1e7a70553b66..bbf177fc3c5ba4f76a1e002623e32b9106204ee5 100644 (file)
@@ -10,7 +10,7 @@ To ease the transition plan, the receiving repository of such a
 push running this release will issue a big warning when the
 configuration variable is missing.  Please refer to:
 
-  http://git.or.cz/gitwiki/GitFaq#non-bare
+  https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
   https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
 for more details on the reason why this change is needed and the
index a2a34b43a75d1b213eb51afae09d06454607e644..0fccfb0bf0bddf99a181653648d0af630d631b95 100644 (file)
@@ -10,7 +10,7 @@ To ease the transition plan, the receiving repository of such a
 push running this release will issue a big warning when the
 configuration variable is missing.  Please refer to:
 
-  http://git.or.cz/gitwiki/GitFaq#non-bare
+  https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
   https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
 for more details on the reason why this change is needed and the
index 6c7f7da7eb9a10971c42552cafc5e85f6b226319..79cb1b2b6df88a5ccdf9a237f83379839227057b 100644 (file)
@@ -21,7 +21,7 @@ To ease the transition plan, the receiving repository of such a
 push running this release will issue a big warning when the
 configuration variable is missing.  Please refer to:
 
-  http://git.or.cz/gitwiki/GitFaq#non-bare
+  https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
   https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
 for more details on the reason why this change is needed and the
index 3ed1e01433745aed586a5de3770f88b8cdf08233..88b86a827e807e5463a3a353ec004a47b52ecb52 100644 (file)
@@ -63,7 +63,7 @@ users will fare this time.
 
    Please refer to:
 
-   http://git.or.cz/gitwiki/GitFaq#non-bare
+   https://archive.kernel.org/oldwiki/git.wiki.kernel.org/index.php/GitFaq.html#non-bare
    https://lore.kernel.org/git/7vbptlsuyv.fsf@gitster.siamese.dyndns.org/
 
    for more details on the reason why this change is needed and the
diff --git a/Documentation/RelNotes/2.43.1.txt b/Documentation/RelNotes/2.43.1.txt
new file mode 100644 (file)
index 0000000..20e96f2
--- /dev/null
@@ -0,0 +1,82 @@
+Git 2.43.1 Release Notes
+========================
+
+There is nothing exciting to see here.  Relative to Git 2.43, this
+release contains the fixes that have already been merged to the
+'master' branch of the development towards the next major release.
+
+Fixes since Git 2.43.0
+----------------------
+
+ * The way CI testing used "prove" could lead to running the test
+   suite twice needlessly, which has been corrected.
+
+ * Newer versions of Getopt::Long started giving warnings against our
+   (ab)use of it in "git send-email".  Bump the minimum version
+   requirement for Perl to 5.8.1 (from September 2002) to allow
+   simplifying our implementation.
+
+ * Earlier we stopped relying on commit-graph that (still) records
+   information about commits that are lost from the object store,
+   which has negative performance implications.  The default has been
+   flipped to disable this pessimization.
+
+ * Stale URLs have been updated to their current counterparts (or
+   archive.org) and HTTP links are replaced with working HTTPS links.
+
+ * trace2 streams used to record the URLs that potentially embed
+   authentication material, which has been corrected.
+
+ * The sample pre-commit hook that tries to catch introduction of new
+   paths that use potentially non-portable characters did not notice
+   an existing path getting renamed to such a problematic path, when
+   rename detection was enabled.
+
+ * The command line parser for the "log" family of commands was too
+   loose when parsing certain numbers, e.g., silently ignoring the
+   extra 'q' in "git log -n 1q" without complaining, which has been
+   tightened up.
+
+ * "git $cmd --end-of-options --rev -- --path" for some $cmd failed
+   to interpret "--rev" as a rev, and "--path" as a path.  This was
+   fixed for many programs like "reset" and "checkout".
+
+ * "git bisect reset" has been taught to clean up state files and refs
+   even when BISECT_START file is gone.
+
+ * Some codepaths did not correctly parse configuration variables
+   specified with valueless "true", which has been corrected.
+
+ * Code clean-up for sanity checking of command line options for "git
+   show-ref".
+
+ * The code to parse the From e-mail header has been updated to avoid
+   recursion.
+
+ * "git fetch --atomic" issued an unnecessary empty error message,
+   which has been corrected.
+
+ * Command line completion script (in contrib/) learned to work better
+   with the reftable backend.
+
+ * "git status" is taught to show both the branch being bisected and
+   being rebased when both are in effect at the same time.
+   cf. <xmqqil76kyov.fsf@gitster.g>
+
+ * "git archive --list extra garbage" silently ignored excess command
+   line parameters, which has been corrected.
+
+ * "git sparse-checkout set" added default patterns even when the
+   patterns are being fed from the standard input, which has been
+   corrected.
+
+ * Unlike other environment variables that took the usual
+   true/false/yes/no as well as 0/1, GIT_FLUSH only understood 0/1,
+   which has been corrected.
+
+ * Clearing in-core repository (happens during e.g., "git fetch
+   --recurse-submodules" with commit graph enabled) made in-core
+   commit object in an inconsistent state by discarding the necessary
+   data from commit-graph too early, which has been corrected.
+
+Also contains various documentation updates, code clean-ups and minor fixups.
index bce7f97815cb52a5ebbba4289b4b5013929b99ee..e734a3f0f175795f0633e93c07afd13f9183efc8 100644 (file)
@@ -355,9 +355,21 @@ If you like, you can put extra tags at the end:
   patch after a detailed analysis.
 . `Tested-by:` is used to indicate that the person applied the patch
   and found it to have the desired effect.
-
-You can also create your own tag or use one that's in common usage
-such as "Thanks-to:", "Based-on-patch-by:", or "Mentored-by:".
+. `Co-authored-by:` is used to indicate that people exchanged drafts
+   of a patch before submitting it.
+. `Helped-by:` is used to credit someone who suggested ideas for
+  changes without providing the precise changes in patch form.
+. `Mentored-by:` is used to credit someone with helping develop a
+  patch as part of a mentorship program (e.g., GSoC or Outreachy).
+. `Suggested-by:` is used to credit someone with suggesting the idea
+  for a patch.
+
+While you can also create your own trailer if the situation warrants it, we
+encourage you to instead use one of the common trailers in this project
+highlighted above.
+
+Only capitalize the very first letter of tags, i.e. favor
+"Signed-off-by" over "Signed-Off-By" and "Acked-by:" over "Acked-By".
 
 [[git-tools]]
 === Generate your patch using Git tools out of your commits.
@@ -570,7 +582,7 @@ their trees themselves.
   master).
 
 * Read the Git mailing list, the maintainer regularly posts messages
-  entitled "What's cooking in git.git" and "What's in git.git" giving
+  entitled "What's cooking in git.git" giving
   the status of various proposed changes.
 
 == GitHub CI[[GHCI]]
@@ -590,11 +602,12 @@ After the initial setup, CI will run whenever you push new changes
 to your fork of Git on GitHub.  You can monitor the test state of all your
 branches here: `https://github.com/<Your GitHub handle>/git/actions/workflows/main.yml`
 
-If a branch did not pass all test cases then it is marked with a red
-cross. In that case you can click on the failing job and navigate to
-"ci/run-build-and-tests.sh" and/or "ci/print-test-failures.sh". You
-can also download "Artifacts" which are tarred (or zipped) archives
-with test data relevant for debugging.
+If a branch does not pass all test cases then it will be marked with a
+red +x+, instead of a green check. In that case, you can click on the
+failing job and navigate to "ci/run-build-and-tests.sh" and/or
+"ci/print-test-failures.sh". You can also download "Artifacts" which
+are zip archives containing tarred (or zipped) archives with test data
+relevant for debugging.
 
 Then fix the problem and push your fix to your GitHub fork. This will
 trigger a new CI build to ensure all tests pass.
@@ -686,7 +699,7 @@ message to an external program, and this is a handy way to drive
 `git am`.  However, if the message is MIME encoded, what is
 piped into the program is the representation you see in your
 `*Article*` buffer after unwrapping MIME.  This is often not what
-you would want for two reasons.  It tends to screw up non ASCII
+you would want for two reasons.  It tends to screw up non-ASCII
 characters (most notably in people's names), and also
 whitespaces (fatal in patches).  Running "C-u g" to display the
 message in raw form before using "|" to run the pipe can work
index 2737381a11a1b40dfb2ec3f6f6b182f83a91c9fd..4d7e5d875998fe1c3aa20c0bb5efdcf9fb6fad91 100644 (file)
@@ -140,6 +140,6 @@ advice.*::
                Advice shown when a fast-forward is not possible.
        worktreeAddOrphan::
                Advice shown when a user tries to create a worktree from an
-               invalid reference, to instruct how to create a new orphan
+               invalid reference, to instruct how to create a new unborn
                branch instead.
 --
index c98412b697efea446b5291c0bc52af3611ade5e0..7410e930e530fdf4b795da076dc6a3b3f1f4b0f1 100644 (file)
@@ -119,7 +119,7 @@ format.notes::
        `--notes=<ref>`, where `ref` is the non-boolean value. Defaults
        to false.
 +
-If one wishes to use the ref `ref/notes/true`, please use that literal
+If one wishes to use the ref `refs/notes/true`, please use that literal
 instead.
 +
 This configuration can be specified multiple times in order to allow
index 9c248accec2c5d572cf11f26ffcbfe8e7eab1465..7c57c5ee80fbe0770c2847371a2b1dd649d35ab8 100644 (file)
@@ -38,7 +38,7 @@ rebase.missingCommitsCheck::
 rebase.instructionFormat::
        A format string, as specified in linkgit:git-log[1], to be used for the
        todo list during an interactive rebase.  The format will
-       automatically have the long commit hash prepended to the format.
+       automatically have the commit hash prepended to the format.
 
 rebase.abbreviateCommands::
        If set to true, `git rebase` will use abbreviated command names in the
index ed44c1cb31ca6eaf7e63d7920cbc15c3a2e0619f..3d2e6707168b69d591e3bf2a50abe3a62fc2ee23 100644 (file)
@@ -9,7 +9,7 @@ SYNOPSIS
 --------
 [verse]
 'git add' [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [--patch | -p]
-         [--edit | -e] [--[no-]all | --[no-]ignore-removal | [--update | -u]] [--sparse]
+         [--edit | -e] [--[no-]all | -A | --[no-]ignore-removal | [--update | -u]] [--sparse]
          [--intent-to-add | -N] [--refresh] [--ignore-errors] [--ignore-missing] [--renormalize]
          [--chmod=(+|-)x] [--pathspec-from-file=<file> [--pathspec-file-nul]]
          [--] [<pathspec>...]
index 191b4a42b6dcca3f270e9087ad9f7aa6b214f0e0..aa02e462244ee0ad2836412cb2351fc43e9c43ad 100644 (file)
@@ -362,7 +362,7 @@ OPTIONS
 --no-checkout::
 +
 Do not checkout the new working tree at each iteration of the bisection
-process. Instead just update a special reference named `BISECT_HEAD` to make
+process. Instead just update the reference named `BISECT_HEAD` to make
 it point to the commit that should be tested.
 +
 This option may be useful when the test you would perform in each step
index 240c54639e8e85b5a3ecf1fb8fec0266614ec9b5..26ad1a5e27cc5af3334b49908ef1814ed315e180 100644 (file)
@@ -215,7 +215,7 @@ variable.
        below for details.
 
 --orphan <new-branch>::
-       Create a new 'orphan' branch, named `<new-branch>`, started from
+       Create a new unborn branch, named `<new-branch>`, started from
        `<start-point>` and switch to it.  The first commit made on this
        new branch will have no parents and it will be the root of a new
        history totally disconnected from all the other branches and
index b3f27671a0c6eb20bfd2bce88bcc74079691fe70..90fdc2551a349939a0cbf9ab12d792ab20f0b765 100644 (file)
@@ -22,7 +22,7 @@ DESCRIPTION
 deprecated; it does not work with cvsps version 3 and later.  If you are
 performing a one-shot import of a CVS repository consider using
 http://cvs2svn.tigris.org/cvs2git.html[cvs2git] or
-http://www.catb.org/esr/cvs-fast-export/[cvs-fast-export].
+https://gitlab.com/esr/cvs-fast-export[cvs-fast-export].
 
 Imports a CVS repository into Git. It will either create a new
 repository, or incrementally import into an existing one.
@@ -221,7 +221,7 @@ Problems related to tags:
 If you suspect that any of these issues may apply to the repository you
 want to import, consider using cvs2git:
 
-* cvs2git (part of cvs2svn), `http://subversion.apache.org/`
+* cvs2git (part of cvs2svn), `https://subversion.apache.org/`
 
 GIT
 ---
index 08087ffad5fe9929cc04629ba4aeaa4240f457e4..c065f023eca3fb1ce60c4c41d60d35c14b5c916b 100644 (file)
@@ -103,7 +103,7 @@ Just in case you are doing something exotic, it should be
 noted that all of the <commit> in the above description, except
 in the `--merge-base` case and in the last two forms that use `..`
 notations, can be any <tree>. A tree of interest is the one pointed to
-by the special ref `AUTO_MERGE`, which is written by the 'ort' merge
+by the ref named `AUTO_MERGE`, which is written by the 'ort' merge
 strategy upon hitting merge conflicts (see linkgit:git-merge[1]).
 Comparing the working tree with `AUTO_MERGE` shows changes you've made
 so far to resolve textual conflicts (see the examples below).
index aaafce24be20c5690adeb9d9e59133285fa10f96..414da6b73e7dc9bee177cd91227acb36c6ed070a 100644 (file)
@@ -610,8 +610,8 @@ Approach #3 (external editor)
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 The following Thunderbird extensions are needed:
-AboutConfig from http://aboutconfig.mozdev.org/ and
-External Editor from http://globs.org/articles.php?lng=en&pg=8
+AboutConfig from https://mjg.github.io/AboutConfig/ and
+External Editor from https://globs.org/articles.php?lng=en&pg=8
 
 1. Prepare the patch as a text file using your method of choice.
 
index f7b185151415b54b08fb21f54062842baf64e636..c8a89d7243bfbd43d68e3922998a378f68eb6c66 100644 (file)
@@ -135,7 +135,7 @@ flames ridiculing you if you don't check this.
 
 Thunderbird in particular is known to be problematic.  Thunderbird
 users may wish to visit this web page for more information:
-  http://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email
+  https://kb.mozillazine.org/Plain_text_e-mail_-_Thunderbird#Completely_plain_email
 
 SEE ALSO
 --------
index e8ab34031919fa4d2ac920e1cd706c77c7c65138..1ab69f61f5749a21def2b08d7cd9466f59c3cd5c 100644 (file)
@@ -20,12 +20,12 @@ DESCRIPTION
 -----------
 Incorporates changes from the named commits (since the time their
 histories diverged from the current branch) into the current
-branch.  This command is used by 'git pull' to incorporate changes
+branch.  This command is used by `git pull` to incorporate changes
 from another repository and can be used by hand to merge changes
 from one branch into another.
 
 Assume the following history exists and the current branch is
-"`master`":
+`master`:
 
 ------------
          A---B---C topic
@@ -33,7 +33,7 @@ Assume the following history exists and the current branch is
     D---E---F---G master
 ------------
 
-Then "`git merge topic`" will replay the changes made on the
+Then `git merge topic` will replay the changes made on the
 `topic` branch since it diverged from `master` (i.e., `E`) until
 its current commit (`C`) on top of `master`, and record the result
 in a new commit along with the names of the two parent commits and
@@ -46,21 +46,21 @@ a log message from the user describing the changes. Before the operation,
     D---E---F---G---H master
 ------------
 
-The second syntax ("`git merge --abort`") can only be run after the
-merge has resulted in conflicts. 'git merge --abort' will abort the
-merge process and try to reconstruct the pre-merge state. However,
-if there were uncommitted changes when the merge started (and
-especially if those changes were further modified after the merge
-was started), 'git merge --abort' will in some cases be unable to
-reconstruct the original (pre-merge) changes. Therefore:
+A merge stops if there's a conflict that cannot be resolved
+automatically or if `--no-commit` was provided when initiating the
+merge. At that point you can run `git merge --abort` or `git merge
+--continue`.
 
-*Warning*: Running 'git merge' with non-trivial uncommitted changes is
+`git merge --abort` will abort the merge process and try to reconstruct
+the pre-merge state. However, if there were uncommitted changes when the
+merge started (and especially if those changes were further modified
+after the merge was started), `git merge --abort` will in some cases be
+unable to reconstruct the original (pre-merge) changes. Therefore:
+
+*Warning*: Running `git merge` with non-trivial uncommitted changes is
 discouraged: while possible, it may leave you in a state that is hard to
 back out of in the case of a conflict.
 
-The third syntax ("`git merge --continue`") can only be run after the
-merge has resulted in conflicts.
-
 OPTIONS
 -------
 :git-merge: 1
@@ -74,8 +74,8 @@ include::merge-options.txt[]
 If `--log` is specified, a shortlog of the commits being merged
 will be appended to the specified message.
 +
-The 'git fmt-merge-msg' command can be
-used to give a good default for automated 'git merge'
+The `git fmt-merge-msg` command can be
+used to give a good default for automated `git merge`
 invocations. The automated message can include the branch description.
 
 --into-name <branch>::
@@ -104,14 +104,14 @@ include::rerere-options.txt[]
        present, apply it to the worktree.
 +
 If there were uncommitted worktree changes present when the merge
-started, 'git merge --abort' will in some cases be unable to
+started, `git merge --abort` will in some cases be unable to
 reconstruct these changes. It is therefore recommended to always
-commit or stash your changes before running 'git merge'.
+commit or stash your changes before running `git merge`.
 +
-'git merge --abort' is equivalent to 'git reset --merge' when
+`git merge --abort` is equivalent to `git reset --merge` when
 `MERGE_HEAD` is present unless `MERGE_AUTOSTASH` is also present in
-which case 'git merge --abort' applies the stash entry to the worktree
-whereas 'git reset --merge' will save the stashed changes in the stash
+which case `git merge --abort` applies the stash entry to the worktree
+whereas `git reset --merge` will save the stashed changes in the stash
 list.
 
 --quit::
@@ -120,8 +120,8 @@ list.
        stash entry will be saved to the stash list.
 
 --continue::
-       After a 'git merge' stops due to conflicts you can conclude the
-       merge by running 'git merge --continue' (see "HOW TO RESOLVE
+       After a `git merge` stops due to conflicts you can conclude the
+       merge by running `git merge --continue` (see "HOW TO RESOLVE
        CONFLICTS" section below).
 
 <commit>...::
@@ -144,25 +144,25 @@ PRE-MERGE CHECKS
 Before applying outside changes, you should get your own work in
 good shape and committed locally, so it will not be clobbered if
 there are conflicts.  See also linkgit:git-stash[1].
-'git pull' and 'git merge' will stop without doing anything when
-local uncommitted changes overlap with files that 'git pull'/'git
-merge' may need to update.
+`git pull` and `git merge` will stop without doing anything when
+local uncommitted changes overlap with files that `git pull`/`git
+merge` may need to update.
 
 To avoid recording unrelated changes in the merge commit,
-'git pull' and 'git merge' will also abort if there are any changes
+`git pull` and `git merge` will also abort if there are any changes
 registered in the index relative to the `HEAD` commit.  (Special
 narrow exceptions to this rule may exist depending on which merge
 strategy is in use, but generally, the index must match HEAD.)
 
-If all named commits are already ancestors of `HEAD`, 'git merge'
+If all named commits are already ancestors of `HEAD`, `git merge`
 will exit early with the message "Already up to date."
 
 FAST-FORWARD MERGE
 ------------------
 
 Often the current branch head is an ancestor of the named commit.
-This is the most common case especially when invoked from 'git
-pull': you are tracking an upstream repository, you have committed
+This is the most common case especially when invoked from `git
+pull`: you are tracking an upstream repository, you have committed
 no local changes, and now you want to update to a newer upstream
 revision.  In this case, a new commit is not needed to store the
 combined history; instead, the `HEAD` (along with the index) is
@@ -196,7 +196,7 @@ happens:
    can inspect the stages with `git ls-files -u`).  The working
    tree files contain the result of the merge operation; i.e. 3-way
    merge results with familiar conflict markers `<<<` `===` `>>>`.
-5. A special ref `AUTO_MERGE` is written, pointing to a tree
+5. A ref named `AUTO_MERGE` is written, pointing to a tree
    corresponding to the current content of the working tree (including
    conflict markers for textual conflicts).  Note that this ref is only
    written when the 'ort' merge strategy is used (the default).
@@ -269,7 +269,7 @@ Barbie's remark on your side.  The only thing you can tell is that your
 side wants to say it is hard and you'd prefer to go shopping, while the
 other side wants to claim it is easy.
 
-An alternative style can be used by setting the "merge.conflictStyle"
+An alternative style can be used by setting the `merge.conflictStyle`
 configuration variable to either "diff3" or "zdiff3".  In "diff3"
 style, the above conflict may look like this:
 
@@ -328,10 +328,10 @@ After seeing a conflict, you can do two things:
 
  * Resolve the conflicts.  Git will mark the conflicts in
    the working tree.  Edit the files into shape and
-   'git add' them to the index.  Use 'git commit' or
-   'git merge --continue' to seal the deal. The latter command
+   `git add` them to the index.  Use `git commit` or
+   `git merge --continue` to seal the deal. The latter command
    checks whether there is a (interrupted) merge in progress
-   before calling 'git commit'.
+   before calling `git commit`.
 
 You can work through the conflict with a number of tools:
 
@@ -392,7 +392,7 @@ CONFIGURATION
 
 branch.<name>.mergeOptions::
        Sets default options for merging into branch <name>. The syntax and
-       supported options are the same as those of 'git merge', but option
+       supported options are the same as those of `git merge`, but option
        values containing whitespace characters are currently not supported.
 
 include::includes/cmd-config-section-rest.txt[]
index b4526ca24612803e7b9a5242d706afd0459b7089..150734fb397e1c164a724db51a7472eeecaa222f 100644 (file)
@@ -523,7 +523,7 @@ See also INCOMPATIBLE OPTIONS below.
 +
 The commit list format can be changed by setting the configuration option
 rebase.instructionFormat.  A customized instruction format will automatically
-have the long commit hash prepended to the format.
+have the commit hash prepended to the format.
 +
 See also INCOMPATIBLE OPTIONS below.
 
@@ -620,13 +620,16 @@ See also INCOMPATIBLE OPTIONS below.
        Automatically reschedule `exec` commands that failed. This only makes
        sense in interactive mode (or when an `--exec` option was provided).
 +
-Even though this option applies once a rebase is started, it's set for
-the whole rebase at the start based on either the
-`rebase.rescheduleFailedExec` configuration (see linkgit:git-config[1]
-or "CONFIGURATION" below) or whether this option is
-provided. Otherwise an explicit `--no-reschedule-failed-exec` at the
-start would be overridden by the presence of
-`rebase.rescheduleFailedExec=true` configuration.
+This option applies once a rebase is started. It is preserved for the whole
+rebase based on, in order, the command line option provided to the initial `git
+rebase`, the `rebase.rescheduleFailedExec` configuration (see
+linkgit:git-config[1] or "CONFIGURATION" below), or it defaults to false.
++
+Recording this option for the whole rebase is a convenience feature. Otherwise
+an explicit `--no-reschedule-failed-exec` at the start would be overridden by
+the presence of a `rebase.rescheduleFailedExec=true` configuration when `git
+rebase --continue` is invoked. Currently, you cannot pass
+`--[no-]reschedule-failed-exec` to `git rebase --continue`.
 
 --update-refs::
 --no-update-refs::
index 465011bad5021a602ef74169a499e29a61c32e1a..30deb7fe2a4f5506745a938b76d8bbcfb504e34b 100644 (file)
@@ -454,7 +454,7 @@ have been specified, in which case default to 'compose'.
                        998 characters unless a suitable transfer encoding
                        ('auto', 'base64', or 'quoted-printable') is used;
                        this is due to SMTP limits as described by
-                       http://www.ietf.org/rfc/rfc5322.txt.
+                       https://www.ietf.org/rfc/rfc5322.txt.
 --
 +
 Default is the value of `sendemail.validate`; if this is not set,
index c60fc9c138b5981ce5727efa4482350e699dbac5..3e23a82cf2627acf551274ab014b6410df35b80b 100644 (file)
@@ -171,7 +171,7 @@ name, the guessing is aborted.  You can explicitly give a name with
        `branch.autoSetupMerge` configuration variable is true.
 
 --orphan <new-branch>::
-       Create a new 'orphan' branch, named `<new-branch>`. All
+       Create a new unborn branch, named `<new-branch>`. All
        tracked files are removed.
 
 --ignore-other-worktrees::
index 93d76f5d665a57a8bdca565add921cbd8b76bc37..2a240f53ba7f987b367a7fef689fe916543dedfd 100644 (file)
@@ -99,7 +99,7 @@ command will refuse to create the worktree (unless `--force` is used).
 If `<commit-ish>` is omitted, neither `--detach`, or `--orphan` is
 used, and there are no valid local branches (or remote branches if
 `--guess-remote` is specified) then, as a convenience, the new worktree is
-associated with a new orphan branch named `<branch>` (after
+associated with a new unborn branch named `<branch>` (after
 `$(basename <path>)` if neither `-b` or `-B` is used) as if `--orphan` was
 passed to the command. In the event the repository has a remote and
 `--guess-remote` is used, but no remote or local branches exist, then the
@@ -234,7 +234,7 @@ This can also be set up as the default behaviour by using the
 
 --orphan::
        With `add`, make the new worktree and index empty, associating
-       the worktree with a new orphan/unborn branch named `<new-branch>`.
+       the worktree with a new unborn branch named `<new-branch>`.
 
 --porcelain::
        With `list`, output in an easy-to-parse format for scripts.
index 2535a30194f978af900c0f84228680b3b8edf93a..962887f1907d1c18ce74bf36adb2d31abd76a940 100644 (file)
@@ -724,13 +724,12 @@ for further details.
        waiting for someone with sufficient permissions to fix it.
 
 `GIT_FLUSH`::
-// NEEDSWORK: make it into a usual Boolean environment variable
-       If this environment variable is set to "1", then commands such
+       If this Boolean environment variable is set to true, then commands such
        as 'git blame' (in incremental mode), 'git rev-list', 'git log',
        'git check-attr' and 'git check-ignore' will
        force a flush of the output stream after each record have been
        flushed. If this
-       variable is set to "0", the output of these commands will be done
+       variable is set to false, the output of these commands will be done
        using completely buffered I/O.   If this environment variable is
        not set, Git will choose buffered or record-oriented flushing
        based on whether stdout appears to be redirected to a file or not.
@@ -917,9 +916,9 @@ for full details.
        avoid issues with stale commit-graphs that contain references to
        already-deleted commits, but comes with a performance penalty.
 +
-The default is "true", which enables the aforementioned behavior.
-Setting this to "false" disables the existence check. This can lead to
-a performance improvement at the cost of consistency.
+The default is "false", which disables the aforementioned behavior.
+Setting this to "true" enables the existence check so that stale commits
+will never be returned from the commit-graph at the cost of performance.
 
 `GIT_ALLOW_PROTOCOL`::
        If set to a colon-separated list of protocols, behave as if
@@ -1025,10 +1024,11 @@ When first created, objects are stored in individual files, but for
 efficiency may later be compressed together into "pack files".
 
 Named pointers called refs mark interesting points in history.  A ref
-may contain the SHA-1 name of an object or the name of another ref.  Refs
-with names beginning `ref/head/` contain the SHA-1 name of the most
+may contain the SHA-1 name of an object or the name of another ref (the
+latter is called a "symbolic ref").
+Refs with names beginning `refs/head/` contain the SHA-1 name of the most
 recent commit (or "head") of a branch under development.  SHA-1 names of
-tags of interest are stored under `ref/tags/`.  A special ref named
+tags of interest are stored under `refs/tags/`.  A symbolic ref named
 `HEAD` contains the name of the currently checked-out branch.
 
 The index file is initialized with a list of all paths and, for each
@@ -1071,7 +1071,7 @@ Authors
 -------
 Git was started by Linus Torvalds, and is currently maintained by Junio
 C Hamano. Numerous contributions have come from the Git mailing list
-<git@vger.kernel.org>.  http://www.openhub.net/p/git/contributors/summary
+<git@vger.kernel.org>.  https://openhub.net/p/git/contributors/summary
 gives you a more complete list of contributors.
 
 If you have a clone of git.git itself, the
index c0b95256cc8c8d640d284f77b23d63c8785601d1..2122aeb976915750b843b89d49210e7c934cf2c8 100644 (file)
@@ -1089,7 +1089,7 @@ the remote repository URL in the local repository's config file
 like this:
 
 ------------------------------------------------
-$ git config remote.linus.url http://www.kernel.org/pub/scm/git/git.git/
+$ git config remote.linus.url https://git.kernel.org/pub/scm/git/git.git/
 ------------------------------------------------
 
 and use the "linus" keyword with 'git pull' instead of the full URL.
index 21b73b7a1f5bd0bee369cb56070ea6b684390446..836b3490ccda97f6fb8356b25244365198a8f681 100644 (file)
@@ -529,8 +529,8 @@ TODO: Document this further.
 REFERENCES
 ----------
 
-http://www.ietf.org/rfc/rfc1738.txt[RFC 1738: Uniform Resource Locators (URL)]
-http://www.ietf.org/rfc/rfc2616.txt[RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1]
+https://www.ietf.org/rfc/rfc1738.txt[RFC 1738: Uniform Resource Locators (URL)]
+https://www.ietf.org/rfc/rfc2616.txt[RFC 2616: Hypertext Transfer Protocol -- HTTP/1.1]
 
 SEE ALSO
 --------
index 1a2ef4c15055a20eaa65cbbf0f40525ba7e2ba48..949cd8a31e9a9e896ccec63d5c7e2f23f740973a 100644 (file)
@@ -23,7 +23,9 @@ A Git repository comes in two different flavours:
 
 *Note*: Also you can have a plain text file `.git` at the root of
 your working tree, containing `gitdir: <path>` to point at the real
-directory that has the repository.  This mechanism is often used for
+directory that has the repository.
+This mechanism is called a 'gitfile' and is usually managed via the
+`git submodule` and `git worktree` commands. It is often used for
 a working tree of a submodule checkout, to allow you in the
 containing superproject to `git checkout` a branch that does not
 have the submodule.  The `checkout` has to remove the entire
index b078fef6f5c6ff09c9db52ee8a3d3945144b6fc1..59fc1d27419f534edd42968c41ec83f00ff3647e 100644 (file)
@@ -242,7 +242,7 @@ $mimetypes_file::
 
 $highlight_bin::
        Path to the highlight executable to use (it must be the one from
-       http://www.andre-simon.de[] due to assumptions about parameters and output).
+       http://andre-simon.de/zip/download.php[] due to assumptions about parameters and output).
        By default set to 'highlight'; set it to full path to highlight
        executable if it is not installed on your web server's PATH.
        Note that 'highlight' feature must be set for gitweb to actually
@@ -820,7 +820,7 @@ filesystem (i.e. "$projectroot/$project"), `%h` to the current hash
 (\'h' gitweb parameter) and `%b` to the current hash base
 (\'hb' gitweb parameter); `%%` expands to \'%'.
 +
-For example, at the time this page was written, the http://repo.or.cz[]
+For example, at the time this page was written, the https://repo.or.cz[]
 Git hosting site set it to the following to enable graphical log
 (using the third party tool *git-browser*):
 +
index 1030e9667ea8c2a0089cef0a725f57581093aa19..ddd4a0fc70571b83ab6c00bbfc4fd94cabfd4464 100644 (file)
@@ -28,7 +28,7 @@ Gitweb provides a web interface to Git repositories.  Its features include:
   revisions one at a time, viewing the history of the repository.
 * Finding commits whose commit messages match a given search term.
 
-See http://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
+See https://repo.or.cz/w/git.git/tree/HEAD:/gitweb/[] for gitweb source code,
 browsed using gitweb itself.
 
 
index 59d8ab85721b93daaaa597eab45ab42cc0a9e6ff..f7d98c11e3dd0821094ae82cb488606a0de14732 100644 (file)
@@ -202,6 +202,8 @@ current branch integrates with) obviously do not work, as there is no
 [[def_gitfile]]gitfile::
        A plain file `.git` at the root of a working tree that
        points at the directory that is the real repository.
+       For proper use see linkgit:git-worktree[1] or linkgit:git-submodule[1].
+       For syntax see linkgit:gitrepository-layout[5].
 
 [[def_grafts]]grafts::
        Grafts enable two otherwise different lines of development to be joined
@@ -312,6 +314,12 @@ This commit is referred to as a "merge commit", or sometimes just a
 [[def_octopus]]octopus::
        To <<def_merge,merge>> more than two <<def_branch,branches>>.
 
+[[def_orphan]]orphan::
+       The act of getting on a <<def_branch,branch>> that does not
+       exist yet (i.e., an <<def_unborn,unborn>> branch).  After
+       such an operation, the commit first created becomes a commit
+       without a parent, starting a new history.
+
 [[def_origin]]origin::
        The default upstream <<def_repository,repository>>. Most projects have
        at least one upstream project which they track. By default
@@ -695,6 +703,18 @@ The most notable example is `HEAD`.
        object,
        etc.
 
+[[def_unborn]]unborn::
+       The <<def_HEAD,HEAD>> can point at a <<def_branch,branch>>
+       that does not yet exist and that does not have any commit on
+       it yet, and such a branch is called an unborn branch.  The
+       most typical way users encounter an unborn branch is by
+       creating a repository anew without cloning from elsewhere.
+       The HEAD would point at the 'main' (or 'master', depending
+       on your configuration) branch that is yet to be born.  Also
+       some operations can get you on an unborn branch with their
+       <<def_orphan,orphan>> option.
+
+
 [[def_unmerged_index]]unmerged index::
        An <<def_index,index>> which contains unmerged
        <<def_index_entry,index entries>>.
index 35d48ef714e9b2cddbbff68b63a14901844ded90..5f800fd85a3dbd4218bb0aaa2bd4de08a3c71434 100644 (file)
@@ -213,4 +213,4 @@ The procedure will result in a history that looks like this:
                 B0--B1---------B2
 ------------
 
-See also http://git-blame.blogspot.com/2013/09/fun-with-first-parent-history.html
+See also https://git-blame.blogspot.com/2013/09/fun-with-first-parent-history.html
index d8f7cd7ca017f4a257129e19ea7ce407aad5c3e8..3eaefc4e940518713e7d140badcd3734ce9abbf0 100644 (file)
@@ -191,7 +191,7 @@ endif::git-pull[]
 --autostash::
 --no-autostash::
        Automatically create a temporary stash entry before the operation
-       begins, record it in the special ref `MERGE_AUTOSTASH`
+       begins, record it in the ref `MERGE_AUTOSTASH`
        and apply it after the operation ends.  This means
        that you can run the operation on a dirty worktree.  However, use
        with care: the final stash application after a successful
index 2bf239ff0309aa0e45436c06788f49c094bfac8f..a583b52c612aece1f7d1fd24086c0f7961eecceb 100644 (file)
@@ -947,10 +947,10 @@ ifdef::git-rev-list[]
 +
 The form '--filter=blob:none' omits all blobs.
 +
-The form '--filter=blob:limit=<n>[kmg]' omits blobs larger than n bytes
-or units.  n may be zero.  The suffixes k, m, and g can be used to name
-units in KiB, MiB, or GiB.  For example, 'blob:limit=1k' is the same
-as 'blob:limit=1024'.
+The form '--filter=blob:limit=<n>[kmg]' omits blobs of size at least n
+bytes or units.  n may be zero.  The suffixes k, m, and g can be used
+to name units in KiB, MiB, or GiB.  For example, 'blob:limit=1k'
+is the same as 'blob:limit=1024'.
 +
 The form '--filter=object:type=(tag|commit|tree|blob)' omits all objects
 which are not of the requested type.
index 12aa2333e46b02aaf86106705bac722ceeec09f8..d98758f3cb70d7298cb5bd5a18c8fa23bfe2cd6e 100644 (file)
@@ -9,7 +9,7 @@ endif::git-commit[]
        the committer has the rights to submit the work under the
        project's license or agrees to some contributor representation,
        such as a Developer Certificate of Origin.
-       (See http://developercertificate.org for the one used by the
+       (See https://developercertificate.org for the one used by the
        Linux kernel and Git projects.)  Consult the documentation or
        leadership of the project to which you're contributing to
        understand how the signoffs are used in that project.
index d8dbe6b56d42a693461d7deae9ac76e214f3d1e4..5d32ff23844108f5a388ecd35f7a38d5286310eb 100644 (file)
@@ -1344,7 +1344,7 @@ $ git diff --theirs file.txt      # same as the above.
 -------------------------------------------------
 
 When using the 'ort' merge strategy (the default), before updating the working
-tree with the result of the merge, Git writes a special ref named AUTO_MERGE
+tree with the result of the merge, Git writes a ref named AUTO_MERGE
 reflecting the state of the tree it is about to write. Conflicted paths with
 textual conflicts that could not be automatically merged are written to this
 tree with conflict markers, just as in the working tree. AUTO_MERGE can thus be
index bc3e656eb8afea2a8c3085eb5365c2a363bd69d9..3d69127479cb4db20b26fde6ec64998be1f0f37e 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 GVF=GIT-VERSION-FILE
-DEF_VER=v2.43.0
+DEF_VER=v2.43.1
 
 LF='
 '
diff --git a/INSTALL b/INSTALL
index 4b422888828d0e99b7398f9e55055525330cf597..c6fb240c91eb9044f1baea43ae29c2991447bbc6 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -119,12 +119,12 @@ Issues of note:
        - A POSIX-compliant shell is required to run some scripts needed
          for everyday use (e.g. "bisect", "request-pull").
 
-       - "Perl" version 5.8 or later is needed to use some of the
+       - "Perl" version 5.8.1 or later is needed to use some of the
          features (e.g. sending patches using "git send-email",
          interacting with svn repositories with "git svn").  If you can
          live without these, use NO_PERL.  Note that recent releases of
          Redhat/Fedora are reported to ship Perl binary package with some
-         core modules stripped away (see http://lwn.net/Articles/477234/),
+         core modules stripped away (see https://lwn.net/Articles/477234/),
          so you might need to install additional packages other than Perl
          itself, e.g. Digest::MD5, File::Spec, File::Temp, Net::Domain,
          Net::SMTP, and Time::HiRes.
index 03adcb5a48072e2c7edd006ca9b249812f9a39c5..1618ee27d287d1b67a904d58908b1ba86f75dc44 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -186,7 +186,7 @@ include shared.mak
 # Define NO_DEFLATE_BOUND if your zlib does not have deflateBound.
 #
 # Define NO_NORETURN if using buggy versions of gcc 4.6+ and profile feedback,
-# as the compiler can crash (http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
+# as the compiler can crash (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=49299)
 #
 # Define USE_NSEC below if you want git to care about sub-second file mtimes
 # and ctimes. Note that you need recent glibc (at least 2.2.4) for this. On
@@ -2723,7 +2723,7 @@ $(OBJECTS): %.o: %.c GIT-CFLAGS $(missing_dep_dirs) $(missing_compdb_dir)
 
 ifdef USE_COMPUTED_HEADER_DEPENDENCIES
 # Take advantage of gcc's on-the-fly dependency generation
-# See <http://gcc.gnu.org/gcc-3.0/features.html>.
+# See <https://gcc.gnu.org/gcc-3.0/features.html>.
 dep_files_present := $(wildcard $(dep_files))
 ifneq ($(dep_files_present),)
 include $(dep_files_present)
index 7ce4f05bae8120d9fa258e854a8669f6ea9cb7b1..2c3de2f9c803798e9eb3bc31184b3d86ba69d60b 100644 (file)
--- a/README.md
+++ b/README.md
@@ -42,7 +42,7 @@ string translations (localization l10) should see [po/README.md][]
 To subscribe to the list, send an email with just "subscribe git" in
 the body to majordomo@vger.kernel.org (not the Git list). The mailing
 list archives are available at <https://lore.kernel.org/git/>,
-<http://marc.info/?l=git> and other archival sites.
+<https://marc.info/?l=git> and other archival sites.
 
 Issues which are security relevant should be disclosed privately to
 the Git Security mailing list <git-security@googlegroups.com>.
index 278cea33c4cc4cfaf34427ee340c163755d935df..93a7fcd2f249f8bd42bf862781726e8819e79419 120000 (symlink)
--- a/RelNotes
+++ b/RelNotes
@@ -1 +1 @@
-Documentation/RelNotes/2.43.0.txt
\ No newline at end of file
+Documentation/RelNotes/2.43.1.txt
\ No newline at end of file
index bfe19876cd50c5aca2e465d9334c49e65a1972fc..79eda168ebb7cdb739720c2c0d16a44484522822 100644 (file)
@@ -12,7 +12,6 @@
 #include "strvec.h"
 #include "pathspec.h"
 #include "color.h"
-#include "diff.h"
 #include "compat/terminal.h"
 #include "prompt.h"
 
diff --git a/apply.c b/apply.c
index 3d69fec836d41fbae10988606ac20ce96dad562d..7608e3301ca0727dcfec0a579ed46390afa41ab0 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -12,7 +12,6 @@
 #include "base85.h"
 #include "config.h"
 #include "object-store-ll.h"
-#include "blob.h"
 #include "delta.h"
 #include "diff.h"
 #include "dir.h"
index 07269968399a5e1b1731fb458d48f4188ed25577..f2a0ed77523b457fa17497498d3ffb4499773a1f 100644 (file)
@@ -9,6 +9,7 @@
 #include "tar.h"
 #include "archive.h"
 #include "object-store-ll.h"
+#include "strbuf.h"
 #include "streaming.h"
 #include "run-command.h"
 #include "write-or-die.h"
index 7229e3e454feb080509d1587a974925ff1318f31..fd1d3f816d30d696456cf1915bb40f2d325f3010 100644 (file)
@@ -10,6 +10,7 @@
 #include "streaming.h"
 #include "utf8.h"
 #include "object-store-ll.h"
+#include "strbuf.h"
 #include "userdiff.h"
 #include "write-or-die.h"
 #include "xdiff-interface.h"
index ca11db185b15a73dd31b239d91a609071faa9a2a..a6730bebfa07d65d003b5594c63081e6ef7d3e88 100644 (file)
--- a/archive.c
+++ b/archive.c
@@ -5,6 +5,7 @@
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
+#include "object-name.h"
 #include "path.h"
 #include "pretty.h"
 #include "setup.h"
@@ -17,7 +18,6 @@
 #include "archive.h"
 #include "parse-options.h"
 #include "unpack-trees.h"
-#include "dir.h"
 #include "quote.h"
 
 static char const * const archive_usage[] = {
@@ -685,6 +685,8 @@ static int parse_archive_args(int argc, const char **argv,
                base = "";
 
        if (list) {
+               if (argc)
+                       die(_("extra command line parameter '%s'"), *argv);
                for (i = 0; i < nr_archivers; i++)
                        if (!is_remote || archivers[i]->flags & ARCHIVER_REMOTE)
                                printf("%s\n", archivers[i]->name);
index 3a4bdfbd078109680dd54143d03ee2567a0cba31..bbe65ba0f900df1367d1d7607300d732a86c5c0c 100644 (file)
--- a/archive.h
+++ b/archive.h
@@ -1,7 +1,6 @@
 #ifndef ARCHIVE_H
 #define ARCHIVE_H
 
-#include "object-name.h"
 #include "pathspec.h"
 #include "string-list.h"
 
index 1be8e0a2711df9d29c1ba903fd4e8901379ea406..8487f8cd1bd740df2bd9f5af342f9373debf84da 100644 (file)
--- a/bisect.c
+++ b/bisect.c
@@ -9,7 +9,6 @@
 #include "refs.h"
 #include "list-objects.h"
 #include "quote.h"
-#include "hash-lookup.h"
 #include "run-command.h"
 #include "log-tree.h"
 #include "bisect.h"
diff --git a/blame.c b/blame.c
index 141756975bf5a58a1744eda78c1750d9d949272f..1a16d4eb6a59148325190f8152e13410398177ba 100644 (file)
--- a/blame.c
+++ b/blame.c
@@ -3,6 +3,7 @@
 #include "object-store-ll.h"
 #include "cache-tree.h"
 #include "mergesort.h"
+#include "commit.h"
 #include "convert.h"
 #include "diff.h"
 #include "diffcore.h"
@@ -10,6 +11,7 @@
 #include "hex.h"
 #include "path.h"
 #include "read-cache.h"
+#include "revision.h"
 #include "setup.h"
 #include "tag.h"
 #include "trace2.h"
diff --git a/blame.h b/blame.h
index 31ddc85f19e359908710162ad4aa144784dec16b..5b4e47d44c613e31fc4788c12ee9d8dc2a49d571 100644 (file)
--- a/blame.h
+++ b/blame.h
@@ -1,12 +1,9 @@
 #ifndef BLAME_H
 #define BLAME_H
 
-#include "commit.h"
 #include "oidset.h"
 #include "xdiff-interface.h"
-#include "revision.h"
 #include "prio-queue.h"
-#include "diff.h"
 
 #define PICKAXE_BLAME_MOVE             01
 #define PICKAXE_BLAME_COPY             02
diff --git a/blob.c b/blob.c
index 888e28a5594747bd263df0bb8f2179122bccb131..3fb2922b1ae65a552101d625a806e914b99eb339 100644 (file)
--- a/blob.c
+++ b/blob.c
@@ -1,6 +1,5 @@
 #include "git-compat-util.h"
 #include "blob.h"
-#include "repository.h"
 #include "alloc.h"
 
 const char *blob_type = "blob";
diff --git a/bloom.c b/bloom.c
index 1474aa19fa524ff1695c2b518259f61b1c2023b7..e529f7605ca14d3fcb779412fc22e1e20d45ac20 100644 (file)
--- a/bloom.c
+++ b/bloom.c
@@ -2,7 +2,6 @@
 #include "bloom.h"
 #include "diff.h"
 #include "diffcore.h"
-#include "revision.h"
 #include "hashmap.h"
 #include "commit-graph.h"
 #include "commit.h"
index 06f7af9dd47260d87158ba672f90d2b5c37e558e..534594f7f8006d11ebb9b8d10712b6fc6191a043 100644 (file)
--- a/branch.c
+++ b/branch.c
@@ -420,9 +420,9 @@ static void prepare_checked_out_branches(void)
                wt_status_state_free_buffers(&state);
 
                if (wt_status_check_bisect(wt, &state) &&
-                   state.branch) {
+                   state.bisecting_from) {
                        struct strbuf ref = STRBUF_INIT;
-                       strbuf_addf(&ref, "refs/heads/%s", state.branch);
+                       strbuf_addf(&ref, "refs/heads/%s", state.bisecting_from);
                        old = strmap_put(&current_checked_out_branches,
                                         ref.buf,
                                         xstrdup(wt->path));
index 5126d2ede3d7614f764c0cb7cab4b694a792074e..2151c45fbf097253af1b56d34622f69f06921456 100644 (file)
 #include "dir.h"
 #include "gettext.h"
 #include "pathspec.h"
-#include "exec-cmd.h"
-#include "cache-tree.h"
 #include "run-command.h"
 #include "parse-options.h"
 #include "path.h"
 #include "preload-index.h"
 #include "diff.h"
-#include "diffcore.h"
 #include "read-cache.h"
 #include "repository.h"
 #include "revision.h"
index 9f084d58bc705c74d6986541fe81161dcd37df8c..d1990d7edcbe37467c59a420a9b03a5894e6da93 100644 (file)
@@ -10,7 +10,6 @@
 #include "config.h"
 #include "editor.h"
 #include "environment.h"
-#include "exec-cmd.h"
 #include "gettext.h"
 #include "hex.h"
 #include "parse-options.h"
@@ -24,7 +23,6 @@
 #include "refs.h"
 #include "commit.h"
 #include "diff.h"
-#include "diffcore.h"
 #include "unpack-trees.h"
 #include "branch.h"
 #include "object-name.h"
 #include "log-tree.h"
 #include "notes-utils.h"
 #include "rerere.h"
-#include "prompt.h"
 #include "mailinfo.h"
 #include "apply.h"
 #include "string-list.h"
-#include "packfile.h"
 #include "pager.h"
 #include "path.h"
 #include "repository.h"
index c18b7ea5d3da4aa66d82c9fa0e911274308ad598..861a01910ca20bcb9bd18279ebd10f9d94032fe1 100644 (file)
@@ -1,6 +1,5 @@
 #include "builtin.h"
 #include "gettext.h"
-#include "parse-options.h"
 #include "repository.h"
 #include "apply.h"
 
index 90761fdfee0f58f0d2d8cca9c7b0bcd6e0ee7fe9..15ee1ec7bb765fe6307dc3f17cde238242169cc4 100644 (file)
@@ -9,7 +9,6 @@
 #include "parse-options.h"
 #include "pkt-line.h"
 #include "repository.h"
-#include "sideband.h"
 
 static void create_output_file(const char *output_file)
 {
index 35938b05fd1c0b51e64a01e58294f267afc4d758..032beaa635339a81d55bbcf8ce4345438d79f4c9 100644 (file)
@@ -7,7 +7,6 @@
 #include "parse-options.h"
 #include "bisect.h"
 #include "refs.h"
-#include "dir.h"
 #include "strvec.h"
 #include "run-command.h"
 #include "oid-array.h"
@@ -233,11 +232,10 @@ static int bisect_reset(const char *commit)
        struct strbuf branch = STRBUF_INIT;
 
        if (!commit) {
-               if (strbuf_read_file(&branch, git_path_bisect_start(), 0) < 1) {
+               if (!strbuf_read_file(&branch, git_path_bisect_start(), 0))
                        printf(_("We are not bisecting.\n"));
-                       return 0;
-               }
-               strbuf_rtrim(&branch);
+               else
+                       strbuf_rtrim(&branch);
        } else {
                struct object_id oid;
 
@@ -246,7 +244,7 @@ static int bisect_reset(const char *commit)
                strbuf_addstr(&branch, commit);
        }
 
-       if (!ref_exists("BISECT_HEAD")) {
+       if (branch.len && !ref_exists("BISECT_HEAD")) {
                struct child_process cmd = CHILD_PROCESS_INIT;
 
                cmd.git_cmd = 1;
index 9c987d656756e8f436e3b1cb818306097e402e4c..db1f56de61a434c3028869a2f4105c319ac6fd33 100644 (file)
@@ -25,7 +25,6 @@
 #include "userdiff.h"
 #include "line-range.h"
 #include "line-log.h"
-#include "dir.h"
 #include "progress.h"
 #include "object-name.h"
 #include "object-store-ll.h"
@@ -748,6 +747,8 @@ static int git_blame_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "blame.coloring")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (!strcmp(value, "repeatedLines")) {
                        coloring_mode |= OUTPUT_COLOR_LINE;
                } else if (!strcmp(value, "highlightRecent")) {
index e7ee9bd0f15028532087132cdc6062e8632568c2..6e30d5eac53d66199425f360801d5a90780050c8 100644 (file)
 #include "remote.h"
 #include "parse-options.h"
 #include "branch.h"
-#include "diff.h"
 #include "path.h"
-#include "revision.h"
 #include "string-list.h"
 #include "column.h"
 #include "utf8.h"
-#include "wt-status.h"
 #include "ref-filter.h"
 #include "worktree.h"
 #include "help.h"
index ea8ad601ecc0b7ee2d7eb9c3da2bb70bcfc55cf8..7d4899348a387b1a07377c2d968d7574a74d219d 100644 (file)
@@ -15,7 +15,6 @@
 #include "parse-options.h"
 #include "userdiff.h"
 #include "streaming.h"
-#include "tree-walk.h"
 #include "oid-array.h"
 #include "packfile.h"
 #include "object-file.h"
index 3b68b47615302473cf3e2c5c70f9ebf1c707c3af..2e086a204dc7b19271cdeb2733c62a64066ab304 100644 (file)
@@ -7,7 +7,6 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
 #include "config.h"
-#include "dir.h"
 #include "gettext.h"
 #include "lockfile.h"
 #include "quote.h"
index f02434bc155ba1769a248350afa686322e6110bb..3a7bfde158801653932f4769927dd4ce717d9457 100644 (file)
@@ -1,7 +1,6 @@
 #define USE_THE_INDEX_VARIABLE
 #include "builtin.h"
 #include "advice.h"
-#include "blob.h"
 #include "branch.h"
 #include "cache-tree.h"
 #include "checkout.h"
 #include "remote.h"
 #include "resolve-undo.h"
 #include "revision.h"
-#include "run-command.h"
 #include "setup.h"
 #include "submodule.h"
-#include "submodule-config.h"
 #include "symlinks.h"
 #include "trace2.h"
 #include "tree.h"
@@ -1202,6 +1199,8 @@ static int git_checkout_config(const char *var, const char *value,
        struct checkout_opts *opts = cb;
 
        if (!strcmp(var, "diff.ignoresubmodules")) {
+               if (!value)
+                       return config_error_nonbool(var);
                handle_ignore_submodules_arg(&opts->diff_options, value);
                return 0;
        }
@@ -1627,7 +1626,7 @@ static struct option *add_common_switch_branch_options(
                        parse_opt_tracking_mode),
                OPT__FORCE(&opts->force, N_("force checkout (throw away local modifications)"),
                           PARSE_OPT_NOCOMPLETE),
-               OPT_STRING(0, "orphan", &opts->new_orphan_branch, N_("new-branch"), N_("new unparented branch")),
+               OPT_STRING(0, "orphan", &opts->new_orphan_branch, N_("new-branch"), N_("new unborn branch")),
                OPT_BOOL_F(0, "overwrite-ignore", &opts->overwrite_ignore,
                           N_("update ignored files (default)"),
                           PARSE_OPT_NOCOMPLETE),
index 49c224e626d61819a633252572d3e7f3b32ffd62..d90766cad3a0ba13c41dd0b90c03254ba5eb83ee 100644 (file)
@@ -971,7 +971,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
        dir.flags |= DIR_SHOW_OTHER_DIRECTORIES;
 
        if (ignored && ignored_only)
-               die(_("-x and -X cannot be used together"));
+               die(_("options '%s' and '%s' cannot be used together"), "-x", "-X");
        if (!ignored)
                setup_standard_excludes(&dir);
        if (ignored_only)
index c6357af949895a688639c83984598931906b2690..315befa13356029f918dbcb99248c474a6677eeb 100644 (file)
@@ -19,7 +19,6 @@
 #include "hex.h"
 #include "lockfile.h"
 #include "parse-options.h"
-#include "fetch-pack.h"
 #include "refs.h"
 #include "refspec.h"
 #include "object-file.h"
@@ -791,6 +790,8 @@ static int git_clone_config(const char *k, const char *v,
                            const struct config_context *ctx, void *cb)
 {
        if (!strcmp(k, "clone.defaultremotename")) {
+               if (!v)
+                       return config_error_nonbool(k);
                free(remote_name);
                remote_name = xstrdup(v);
        }
@@ -965,7 +966,9 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
        }
 
        if (bundle_uri && deepen)
-               die(_("--bundle-uri is incompatible with --depth, --shallow-since, and --shallow-exclude"));
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--bundle-uri",
+                   "--depth/--shallow-since/--shallow-exclude");
 
        repo_name = argv[0];
 
index a83be8bc991a8c9dfca5b64f886d33f952890236..e80218f81f94b5fc7a3e4605527556da336bb6ff 100644 (file)
@@ -56,5 +56,7 @@ int cmd_column(int argc, const char **argv, const char *prefix)
                string_list_append(&list, sb.buf);
 
        print_columns(&list, colopts, &copts);
+       strbuf_release(&sb);
+       string_list_clear(&list, 0);
        return 0;
 }
index 45d035af6007a2a64833015dbe58300493a55f80..666ad574a46b1218def7201e581e969f90e57d48 100644 (file)
@@ -1,17 +1,16 @@
 #include "builtin.h"
 #include "commit.h"
 #include "config.h"
-#include "dir.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
-#include "lockfile.h"
 #include "parse-options.h"
 #include "repository.h"
 #include "commit-graph.h"
 #include "object-store-ll.h"
 #include "progress.h"
 #include "replace-object.h"
+#include "strbuf.h"
 #include "tag.h"
 #include "trace2.h"
 
index 02625e71761dbf8d25f063b5ff4835e5eb4bf477..1bb78198392e9e13db117e87a4d421e17d10b26a 100644 (file)
@@ -11,9 +11,6 @@
 #include "object-store-ll.h"
 #include "repository.h"
 #include "commit.h"
-#include "tree.h"
-#include "utf8.h"
-#include "gpg-interface.h"
 #include "parse-options.h"
 
 static const char * const commit_tree_usage[] = {
index 781af2e206c1060213f16dd7cacb5ca68884f6b8..65196a28278bd5afb1bbc1e68864376225868abe 100644 (file)
 #include "editor.h"
 #include "environment.h"
 #include "diff.h"
-#include "diffcore.h"
 #include "commit.h"
 #include "gettext.h"
 #include "revision.h"
 #include "wt-status.h"
 #include "run-command.h"
-#include "hook.h"
-#include "refs.h"
-#include "log-tree.h"
 #include "strbuf.h"
-#include "utf8.h"
 #include "object-name.h"
 #include "parse-options.h"
 #include "path.h"
@@ -35,9 +30,6 @@
 #include "string-list.h"
 #include "rerere.h"
 #include "unpack-trees.h"
-#include "quote.h"
-#include "submodule.h"
-#include "gpg-interface.h"
 #include "column.h"
 #include "sequencer.h"
 #include "sparse-index.h"
@@ -900,7 +892,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
                strbuf_stripspace(&sb, '\0');
 
        if (signoff)
-               append_signoff(&sb, ignore_non_trailer(sb.buf, sb.len), 0);
+               append_signoff(&sb, ignored_log_message_bytes(sb.buf, sb.len), 0);
 
        if (fwrite(sb.buf, 1, sb.len, s->fp) < sb.len)
                die_errno(_("could not write commit template"));
index 43b9d0e5b16ba5da555a3b16ce53b88dff5dbb4c..bba96d4ffd6f198adb186aaba0c853e34a93dd11 100644 (file)
@@ -7,8 +7,6 @@
 
 #ifndef NO_UNIX_SOCKETS
 
-#include "credential.h"
-#include "string-list.h"
 #include "unix-socket.h"
 #include "run-command.h"
 
index fb6b0508f3212db5d41bc33cfe76de441534ca7c..d6c77a714f46194faca18739d0118294bc233f81 100644 (file)
@@ -7,9 +7,7 @@
 #include "lockfile.h"
 #include "commit.h"
 #include "tag.h"
-#include "blob.h"
 #include "refs.h"
-#include "exec-cmd.h"
 #include "object-name.h"
 #include "parse-options.h"
 #include "read-cache-ll.h"
index f38912cd407bf4e5098d84a928affd849f4123d8..018011f29ea26be24b567e9af380699dd7d893a3 100644 (file)
@@ -11,7 +11,6 @@
 #include "preload-index.h"
 #include "repository.h"
 #include "revision.h"
-#include "submodule.h"
 
 static const char diff_files_usage[] =
 "git diff-files [-q] [-0 | -1 | -2 | -3 | -c | --cc] [<common-diff-options>] [<path>...]"
index 220f341ffa2a138f70d6aa0d343594e6e60d2ebb..3e05260ac0e0401188163aeaf4c4d1aea0ba56d1 100644 (file)
@@ -7,8 +7,6 @@
 #include "repository.h"
 #include "revision.h"
 #include "setup.h"
-#include "sparse-index.h"
-#include "submodule.h"
 
 static const char diff_cache_usage[] =
 "git diff-index [-m] [--cached] [--merge-base] "
index 86be6342861be40da9edbf2f1a2002fa4abc0cda..a8e68ce8ef6275a99e2a4f62545d0e7d962dcf45 100644 (file)
@@ -6,7 +6,6 @@
 #include "gettext.h"
 #include "hex.h"
 #include "log-tree.h"
-#include "submodule.h"
 #include "read-cache-ll.h"
 #include "repository.h"
 #include "revision.h"
index 55e7d21755a09c9754d45fea8689cbcbd32939dd..6e196e0c7d2d055df1557ffd256d87a737053324 100644 (file)
@@ -10,7 +10,6 @@
 #include "lockfile.h"
 #include "color.h"
 #include "commit.h"
-#include "blob.h"
 #include "gettext.h"
 #include "tag.h"
 #include "diff.h"
@@ -21,7 +20,6 @@
 #include "revision.h"
 #include "log-tree.h"
 #include "setup.h"
-#include "submodule.h"
 #include "oid-array.h"
 #include "tree.h"
 
index 0f5eae9cd41b3219b06964011089bb8d389975b4..a3c72b8258e7cb34e6e87e679e6a996d6086ecb0 100644 (file)
@@ -18,7 +18,6 @@
 #include "copy.h"
 #include "run-command.h"
 #include "environment.h"
-#include "exec-cmd.h"
 #include "gettext.h"
 #include "hex.h"
 #include "parse-options.h"
index 70aff515acbe97b20db80cc8b746e28f0149b56f..f18f0809f9c7f78874eaddfd869c5fc5d11831e0 100644 (file)
@@ -25,7 +25,6 @@
 #include "quote.h"
 #include "remote.h"
 #include "blob.h"
-#include "commit-slab.h"
 
 static const char *fast_export_usage[] = {
        N_("git fast-export [<rev-list-opts>]"),
index 444f41cf8ca8e6ba523f54169a3534d384094196..92eda20683ca2d07c24a03f5903d1e604ce54763 100644 (file)
@@ -2809,8 +2809,7 @@ static void parse_new_tag(const char *arg)
        enum object_type type;
        const char *v;
 
-       t = mem_pool_alloc(&fi_mem_pool, sizeof(struct tag));
-       memset(t, 0, sizeof(struct tag));
+       t = mem_pool_calloc(&fi_mem_pool, 1, sizeof(struct tag));
        t->name = mem_pool_strdup(&fi_mem_pool, arg);
        if (last_tag)
                last_tag->next_tag = t;
index fd134ba74d9086cfa44ba1c1b5a5a2597d182bee..119f1a72ac6605b65937af3b7cbc651b4c695c0d 100644 (file)
@@ -26,7 +26,6 @@
 #include "connected.h"
 #include "strvec.h"
 #include "utf8.h"
-#include "packfile.h"
 #include "pager.h"
 #include "path.h"
 #include "pkt-line.h"
@@ -38,7 +37,6 @@
 #include "shallow.h"
 #include "trace.h"
 #include "trace2.h"
-#include "worktree.h"
 #include "bundle-uri.h"
 
 #define FORCED_UPDATES_DELAY_WARNING_IN_MS (10 * 1000)
@@ -1651,7 +1649,7 @@ static int do_fetch(struct transport *transport,
        if (atomic_fetch) {
                transaction = ref_transaction_begin(&err);
                if (!transaction) {
-                       retcode = error("%s", err.buf);
+                       retcode = -1;
                        goto cleanup;
                }
        }
@@ -1711,7 +1709,6 @@ static int do_fetch(struct transport *transport,
 
                retcode = ref_transaction_commit(transaction, &err);
                if (retcode) {
-                       error("%s", err.buf);
                        ref_transaction_free(transaction);
                        transaction = NULL;
                        goto cleanup;
@@ -1775,9 +1772,14 @@ static int do_fetch(struct transport *transport,
        }
 
 cleanup:
-       if (retcode && transaction) {
-               ref_transaction_abort(transaction, &err);
-               error("%s", err.buf);
+       if (retcode) {
+               if (err.len) {
+                       error("%s", err.buf);
+                       strbuf_reset(&err);
+               }
+               if (transaction && ref_transaction_abort(transaction, &err) &&
+                   err.len)
+                       error("%s", err.buf);
        }
 
        display_state_release(&display_state);
index 350bfa6e811b8c53d94ba33083a03bf9d93437dc..b5bc700d13ce78e6cf47c3e6a499e8129c830241 100644 (file)
@@ -1,13 +1,12 @@
 #include "builtin.h"
+#include "commit.h"
 #include "config.h"
 #include "gettext.h"
-#include "refs.h"
 #include "object.h"
 #include "parse-options.h"
 #include "ref-filter.h"
 #include "strbuf.h"
 #include "strvec.h"
-#include "commit-reach.h"
 
 static char const * const for_each_ref_usage[] = {
        N_("git for-each-ref [<options>] [<pattern>]"),
index 611925905e4fd1d972565806156059016d2eb1a6..a7cf94f67edf3aaace9fdbbca29778d6857d28af 100644 (file)
 #include "refs.h"
 #include "pack.h"
 #include "cache-tree.h"
-#include "tree-walk.h"
 #include "fsck.h"
 #include "parse-options.h"
-#include "dir.h"
 #include "progress.h"
 #include "streaming.h"
-#include "decorate.h"
 #include "packfile.h"
 #include "object-file.h"
 #include "object-name.h"
index 5d01db5c029e2bf967ab96795bf0b3aef5b6102e..1593713f4cb29fe8e608f4c3c7502fa5a624d1f9 100644 (file)
@@ -1,19 +1,20 @@
 #include "builtin.h"
 #include "abspath.h"
 #include "config.h"
+#include "dir.h"
 #include "environment.h"
 #include "gettext.h"
 #include "parse-options.h"
 #include "fsmonitor-ll.h"
 #include "fsmonitor-ipc.h"
-#include "fsmonitor-path-utils.h"
 #include "fsmonitor-settings.h"
 #include "compat/fsmonitor/fsm-health.h"
 #include "compat/fsmonitor/fsm-listen.h"
 #include "fsmonitor--daemon.h"
+#include "repository.h"
 #include "simple-ipc.h"
 #include "khash.h"
-#include "pkt-line.h"
+#include "run-command.h"
 #include "trace.h"
 #include "trace2.h"
 
index 20d0dfe9cf1dfefe6ffacb23bd500701cca71a09..66a7389f9f4a21df975ef12a00d93fd7d8eee46f 100644 (file)
@@ -4,7 +4,6 @@
 #include "builtin.h"
 #include "commit.h"
 #include "tar.h"
-#include "quote.h"
 
 static const char builtin_get_tar_commit_id_usage[] =
 "git get-tar-commit-id";
index fe78d4c98b13b578a09de344d6a56d2316a8cb00..c8e33f977552081fcde8afc12d0aa92bfc4b5e62 100644 (file)
@@ -9,15 +9,11 @@
 #include "hex.h"
 #include "repository.h"
 #include "config.h"
-#include "blob.h"
-#include "tree.h"
-#include "commit.h"
 #include "tag.h"
 #include "tree-walk.h"
 #include "parse-options.h"
 #include "string-list.h"
 #include "run-command.h"
-#include "userdiff.h"
 #include "grep.h"
 #include "quote.h"
 #include "dir.h"
index 5ffec99dceaf5c95d9b57c1f0c6c90358b80507d..82ca6d2bfdc7797a13646ff01271ceb803b0a973 100644 (file)
@@ -14,7 +14,6 @@
 #include "blob.h"
 #include "quote.h"
 #include "parse-options.h"
-#include "exec-cmd.h"
 #include "setup.h"
 #include "strbuf.h"
 #include "write-or-die.h"
index 09b51a6487c3928bc099567109193c32fe82fe30..5234693a94b40e2a6dd7aa4a8d724f0ac7b06a3b 100644 (file)
@@ -3,7 +3,6 @@
 #include "gettext.h"
 #include "hook.h"
 #include "parse-options.h"
-#include "strbuf.h"
 #include "strvec.h"
 
 #define BUILTIN_HOOK_RUN_USAGE \
index dda94a9f46d9a9401c298ee304f57e55db25f217..1ea87e01f2905ed70e3a17a847278ec2b7b68ec3 100644 (file)
@@ -8,11 +8,9 @@
 #include "csum-file.h"
 #include "blob.h"
 #include "commit.h"
-#include "tag.h"
 #include "tree.h"
 #include "progress.h"
 #include "fsck.h"
-#include "exec-cmd.h"
 #include "strbuf.h"
 #include "streaming.h"
 #include "thread-utils.h"
@@ -1257,6 +1255,7 @@ static void resolve_deltas(void)
        base_cache_limit = delta_base_cache_limit * nr_threads;
        if (nr_threads > 1 || getenv("GIT_FORCE_THREADS")) {
                init_thread();
+               work_lock();
                for (i = 0; i < nr_threads; i++) {
                        int ret = pthread_create(&thread_data[i].thread, NULL,
                                                 threaded_second_pass, thread_data + i);
@@ -1264,6 +1263,7 @@ static void resolve_deltas(void)
                                die(_("unable to create thread: %s"),
                                    strerror(ret));
                }
+               work_unlock();
                for (i = 0; i < nr_threads; i++)
                        pthread_join(thread_data[i].thread, NULL);
                cleanup_thread();
index cb727c826f5653ab2827ccfbd575e6d305fad75a..b89814a6f87da30fc1721ecef02637f61600cd32 100644 (file)
@@ -5,7 +5,6 @@
  */
 #include "builtin.h"
 #include "abspath.h"
-#include "config.h"
 #include "environment.h"
 #include "gettext.h"
 #include "object-file.h"
index ba775d7b5cf886374bd94c9f2e54d5695a3dbaff..af6403cb71a6b87af1b95399b809720c4e38a367 100644 (file)
@@ -26,7 +26,6 @@
 #include "tag.h"
 #include "reflog-walk.h"
 #include "patch-ids.h"
-#include "run-command.h"
 #include "shortlog.h"
 #include "remote.h"
 #include "string-list.h"
@@ -36,7 +35,6 @@
 #include "streaming.h"
 #include "version.h"
 #include "mailmap.h"
-#include "gpg-interface.h"
 #include "progress.h"
 #include "commit-slab.h"
 #include "repository.h"
@@ -594,8 +592,11 @@ static int git_log_config(const char *var, const char *value,
                        decoration_style = 0; /* maybe warn? */
                return 0;
        }
-       if (!strcmp(var, "log.diffmerges"))
+       if (!strcmp(var, "log.diffmerges")) {
+               if (!value)
+                       return config_error_nonbool(var);
                return diff_merges_config(value);
+       }
        if (!strcmp(var, "log.showroot")) {
                default_show_root = git_config_bool(var, value);
                return 0;
index a0229c3277874accc9edf0a4a5ac4e8186217903..92f94e65bf065e900e59b9fcf2bc18f5af045975 100644 (file)
 #include "gettext.h"
 #include "object-name.h"
 #include "strbuf.h"
-#include "tree.h"
-#include "cache-tree.h"
 #include "parse-options.h"
 #include "resolve-undo.h"
 #include "string-list.h"
 #include "path.h"
 #include "pathspec.h"
 #include "read-cache.h"
-#include "run-command.h"
 #include "setup.h"
 #include "sparse-index.h"
 #include "submodule.h"
-#include "submodule-config.h"
 #include "object-store.h"
 #include "hex.h"
 
index fc765754305ed7a3f8a2efdcd604dd29c8b3b502..2975ea4082f8830fd94f0493841ed4ca3bff906d 100644 (file)
@@ -5,7 +5,6 @@
 #include "pkt-line.h"
 #include "ref-filter.h"
 #include "remote.h"
-#include "refs.h"
 #include "parse-options.h"
 #include "wildmatch.h"
 
index 209d2dc0d59af3d0c8860ef4eb397edb34e8b429..e4a891337c3c619112af77bac014139b520e463f 100644 (file)
@@ -9,9 +9,7 @@
 #include "hex.h"
 #include "object-name.h"
 #include "object-store-ll.h"
-#include "blob.h"
 #include "tree.h"
-#include "commit.h"
 #include "path.h"
 #include "quote.h"
 #include "parse-options.h"
index 53b55dd71c0537b149860c4b9c0d505ea305fe57..53a22645da58b8c18bb825ca9012e2f072cbf3a3 100644 (file)
@@ -6,7 +6,6 @@
 #include "abspath.h"
 #include "environment.h"
 #include "gettext.h"
-#include "utf8.h"
 #include "strbuf.h"
 #include "mailinfo.h"
 #include "parse-options.h"
index e68b7fe45d77a9b032dd6031864b876eeeca5e5c..d26e8fbf6f75d9971762afdc0ea5c04e209db387 100644 (file)
@@ -3,9 +3,6 @@
 #include "commit.h"
 #include "gettext.h"
 #include "hex.h"
-#include "refs.h"
-#include "diff.h"
-#include "revision.h"
 #include "object-name.h"
 #include "parse-options.h"
 #include "repository.h"
index 3366699657c9c390f850dfcba11be08327834f50..c2ce044a201366d7eea11ab3d2eeed2c15113af4 100644 (file)
@@ -1,13 +1,10 @@
 #include "builtin.h"
 #include "advice.h"
-#include "commit.h"
 #include "gettext.h"
 #include "hash.h"
-#include "tag.h"
 #include "merge-recursive.h"
 #include "object-name.h"
 #include "repository.h"
-#include "xdiff-interface.h"
 
 static const char builtin_merge_recursive_usage[] =
        "git %s <base>... -- <head> <remote> ...";
index a35e0452d6672594da29623e8934256f37784549..3bdec53fbe58bb5edef6e4d425829a58ce87bffe 100644 (file)
@@ -13,7 +13,6 @@
 #include "parse-options.h"
 #include "repository.h"
 #include "blob.h"
-#include "exec-cmd.h"
 #include "merge-blobs.h"
 #include "quote.h"
 #include "tree.h"
@@ -577,7 +576,8 @@ int cmd_merge_tree(int argc, const char **argv, const char *prefix)
                if (o.mode == MODE_TRIVIAL)
                        die(_("--trivial-merge is incompatible with all other options"));
                if (merge_base)
-                       die(_("--merge-base is incompatible with --stdin"));
+                       die(_("options '%s' and '%s' cannot be used together"),
+                           "--merge-base", "--stdin");
                line_termination = '\0';
                while (strbuf_getline_lf(&buf, stdin) != EOF) {
                        struct strbuf **split;
index d748d46e13517afd6908b1f7297bf448557b1a86..ebbe05033e98bc796ceeb6c70e6259b8c76c18f2 100644 (file)
@@ -31,8 +31,6 @@
 #include "unpack-trees.h"
 #include "cache-tree.h"
 #include "dir.h"
-#include "utf8.h"
-#include "log-tree.h"
 #include "color.h"
 #include "rerere.h"
 #include "help.h"
 #include "resolve-undo.h"
 #include "remote.h"
 #include "fmt-merge-msg.h"
-#include "gpg-interface.h"
 #include "sequencer.h"
 #include "string-list.h"
-#include "packfile.h"
 #include "tag.h"
 #include "alias.h"
 #include "branch.h"
@@ -869,7 +865,7 @@ static void prepare_to_commit(struct commit_list *remoteheads)
                                _(no_scissors_editor_comment), comment_line_char);
        }
        if (signoff)
-               append_signoff(&msg, ignore_non_trailer(msg.buf, msg.len), 0);
+               append_signoff(&msg, ignored_log_message_bytes(msg.buf, msg.len), 0);
        write_merge_heads(remoteheads);
        write_file_buf(git_path_merge_msg(the_repository), msg.buf, msg.len);
        if (run_commit_hook(0 < option_edit, get_index_file(), NULL,
index d8e0b5afc079d2f71383eed6881b733fea251312..4767f1a97e6df25ca09eba0846feaf404e08fe46 100644 (file)
@@ -3,7 +3,6 @@
 #include "hex.h"
 #include "parse-options.h"
 #include "strbuf.h"
-#include "tag.h"
 #include "replace-object.h"
 #include "object-file.h"
 #include "object-store-ll.h"
index c596515ad0536f4b13ce2fdc2a797f6aaa9df70a..22e64fc2900ec8e654aafa6cfaf8a10cdb5d58a7 100644 (file)
@@ -15,7 +15,6 @@
 #include "pathspec.h"
 #include "lockfile.h"
 #include "dir.h"
-#include "cache-tree.h"
 #include "string-list.h"
 #include "parse-options.h"
 #include "read-cache-ll.h"
index 9f38863dd507ff680cf8a006b81a413d75550b1b..e65cae0bcf702bf939dcd3ddfb2af5793e73fda0 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "builtin.h"
 #include "config.h"
-#include "alloc.h"
 #include "editor.h"
 #include "environment.h"
 #include "gettext.h"
@@ -19,7 +18,6 @@
 #include "object-store-ll.h"
 #include "path.h"
 #include "repository.h"
-#include "blob.h"
 #include "pretty.h"
 #include "refs.h"
 #include "exec-cmd.h"
index 89a8b5a9768e42da3edaaddb63a663936ef70576..5c8bfe1035feca3518d2ab6b2515c03adf9d75eb 100644 (file)
@@ -6,10 +6,8 @@
 #include "config.h"
 #include "attr.h"
 #include "object.h"
-#include "blob.h"
 #include "commit.h"
 #include "tag.h"
-#include "tree.h"
 #include "delta.h"
 #include "pack.h"
 #include "pack-revindex.h"
@@ -18,7 +16,6 @@
 #include "diff.h"
 #include "revision.h"
 #include "list-objects.h"
-#include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "pack-objects.h"
 #include "progress.h"
@@ -3204,7 +3201,7 @@ static int git_pack_config(const char *k, const char *v,
                return 0;
        }
        if (!strcmp(k, "uploadpack.blobpackfileuri")) {
-               struct configured_exclusion *ex = xmalloc(sizeof(*ex));
+               struct configured_exclusion *ex;
                const char *oid_end, *pack_end;
                /*
                 * Stores the pack hash. This is not a true object ID, but is
@@ -3212,6 +3209,10 @@ static int git_pack_config(const char *k, const char *v,
                 */
                struct object_id pack_hash;
 
+               if (!v)
+                       return config_error_nonbool(k);
+
+               ex = xmalloc(sizeof(*ex));
                if (parse_oid_hex(v, &ex->e.oid, &oid_end) ||
                    *oid_end != ' ' ||
                    parse_oid_hex(oid_end + 1, &pack_hash, &pack_end) ||
index be2b2c9ebc97b2a1620b93e1766e0ccfa6c7843a..73a68b75b0672487013299f992d382d1957a02a4 100644 (file)
@@ -14,7 +14,6 @@
 #include "merge.h"
 #include "object-name.h"
 #include "parse-options.h"
-#include "exec-cmd.h"
 #include "run-command.h"
 #include "oid-array.h"
 #include "remote.h"
 #include "rebase.h"
 #include "refs.h"
 #include "refspec.h"
-#include "revision.h"
 #include "submodule.h"
 #include "submodule-config.h"
-#include "tempfile.h"
-#include "lockfile.h"
 #include "wt-status.h"
 #include "commit-reach.h"
 #include "sequencer.h"
-#include "packfile.h"
 
 /**
  * Parses the value of --rebase. If value is a false value, returns
index 2e708383c24ba86e07fc14b0139afb28d489c014..2fbb31c3ad8eb9b7a15ffac4e5d9aa65367d298f 100644 (file)
@@ -7,7 +7,6 @@
 #include "config.h"
 #include "environment.h"
 #include "gettext.h"
-#include "refs.h"
 #include "refspec.h"
 #include "run-command.h"
 #include "remote.h"
@@ -392,7 +391,7 @@ static int push_with_options(struct transport *transport, struct refspec *rs,
        if (!is_empty_cas(&cas)) {
                if (!transport->smart_options)
                        die("underlying transport does not support --%s option",
-                           CAS_OPT_NAME);
+                           "force-with-lease");
                transport->smart_options->cas = &cas;
        }
 
@@ -526,26 +525,21 @@ static int git_push_config(const char *k, const char *v,
                        *flags |= TRANSPORT_PUSH_AUTO_UPSTREAM;
                return 0;
        } else if (!strcmp(k, "push.gpgsign")) {
-               const char *value;
-               if (!git_config_get_value("push.gpgsign", &value)) {
-                       switch (git_parse_maybe_bool(value)) {
-                       case 0:
-                               set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_NEVER);
-                               break;
-                       case 1:
-                               set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_ALWAYS);
-                               break;
-                       default:
-                               if (value && !strcasecmp(value, "if-asked"))
-                                       set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_IF_ASKED);
-                               else
-                                       return error(_("invalid value for '%s'"), k);
-                       }
+               switch (git_parse_maybe_bool(v)) {
+               case 0:
+                       set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_NEVER);
+                       break;
+               case 1:
+                       set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_ALWAYS);
+                       break;
+               default:
+                       if (!strcasecmp(v, "if-asked"))
+                               set_push_cert_flags(flags, SEND_PACK_PUSH_CERT_IF_ASKED);
+                       else
+                               return error(_("invalid value for '%s'"), k);
                }
        } else if (!strcmp(k, "push.recursesubmodules")) {
-               const char *value;
-               if (!git_config_get_value("push.recursesubmodules", &value))
-                       recurse_submodules = parse_push_recurse_submodules_arg(k, value);
+               recurse_submodules = parse_push_recurse_submodules_arg(k, v);
        } else if (!strcmp(k, "submodule.recurse")) {
                int val = git_config_bool(k, v) ?
                        RECURSE_SUBMODULES_ON_DEMAND : RECURSE_SUBMODULES_OFF;
@@ -604,7 +598,7 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                OPT_BIT('n' , "dry-run", &flags, N_("dry run"), TRANSPORT_PUSH_DRY_RUN),
                OPT_BIT( 0,  "porcelain", &flags, N_("machine-readable output"), TRANSPORT_PUSH_PORCELAIN),
                OPT_BIT('f', "force", &flags, N_("force updates"), TRANSPORT_PUSH_FORCE),
-               OPT_CALLBACK_F(0, CAS_OPT_NAME, &cas, N_("<refname>:<expect>"),
+               OPT_CALLBACK_F(0, "force-with-lease", &cas, N_("<refname>:<expect>"),
                               N_("require old value of ref to be at this value"),
                               PARSE_OPT_OPTARG | PARSE_OPT_LITERAL_ARGHELP, parseopt_push_cas_option),
                OPT_BIT(0, TRANS_OPT_FORCE_IF_INCLUDES, &flags,
@@ -639,8 +633,10 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                : &push_options_config);
        set_push_cert_flags(&flags, push_cert);
 
-       if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))
-               die(_("options '%s' and '%s' cannot be used together"), "--delete", "--all/--branches/--mirror/--tags");
+       die_for_incompatible_opt4(deleterefs, "--delete",
+                                 tags, "--tags",
+                                 flags & TRANSPORT_PUSH_ALL, "--all/--branches",
+                                 flags & TRANSPORT_PUSH_MIRROR, "--mirror");
        if (deleterefs && argc < 2)
                die(_("--delete doesn't make sense without any refs"));
 
@@ -677,19 +673,13 @@ int cmd_push(int argc, const char **argv, const char *prefix)
                flags |= (TRANSPORT_PUSH_MIRROR|TRANSPORT_PUSH_FORCE);
 
        if (flags & TRANSPORT_PUSH_ALL) {
-               if (tags)
-                       die(_("options '%s' and '%s' cannot be used together"), "--all", "--tags");
                if (argc >= 2)
                        die(_("--all can't be combined with refspecs"));
        }
        if (flags & TRANSPORT_PUSH_MIRROR) {
-               if (tags)
-                       die(_("options '%s' and '%s' cannot be used together"), "--mirror", "--tags");
                if (argc >= 2)
                        die(_("--mirror can't be combined with refspecs"));
        }
-       if ((flags & TRANSPORT_PUSH_ALL) && (flags & TRANSPORT_PUSH_MIRROR))
-               die(_("options '%s' and '%s' cannot be used together"), "--all", "--mirror");
 
        if (!is_empty_cas(&cas) && (flags & TRANSPORT_PUSH_FORCE_IF_INCLUDES))
                cas.use_force_if_includes = 1;
index e455a4795cc8101576a806ee68df71a56c7661ce..f02cbac087db403cedae2e4b5269e5258059677f 100644 (file)
@@ -5,7 +5,6 @@
 #include "range-diff.h"
 #include "config.h"
 #include "repository.h"
-#include "revision.h"
 
 static const char * const builtin_range_diff_usage[] = {
 N_("git range-diff [<options>] <old-base>..<old-tip> <new-base>..<new-tip>"),
index 8196ca9dd85828890cf5e7088d19e51990a00c66..20e7db19737d5a5070068a131797042d37a936a5 100644 (file)
 #include "tree-walk.h"
 #include "cache-tree.h"
 #include "unpack-trees.h"
-#include "dir.h"
 #include "parse-options.h"
 #include "repository.h"
 #include "resolve-undo.h"
 #include "setup.h"
 #include "sparse-index.h"
 #include "submodule.h"
-#include "submodule-config.h"
 
 static int nr_trees;
 static int read_empty;
index 043c65dccd9f19667a1eb6af993dfb9c1f4d8669..4084a6abb8bf2d7eb87b64f3af792d8a7892292d 100644 (file)
 #include "gettext.h"
 #include "hex.h"
 #include "run-command.h"
-#include "exec-cmd.h"
 #include "strvec.h"
 #include "dir.h"
-#include "packfile.h"
 #include "refs.h"
-#include "quote.h"
 #include "config.h"
-#include "cache-tree.h"
 #include "unpack-trees.h"
 #include "lockfile.h"
 #include "object-file.h"
@@ -583,7 +579,6 @@ static int run_am(struct rebase_options *opts)
 {
        struct child_process am = CHILD_PROCESS_INIT;
        struct child_process format_patch = CHILD_PROCESS_INIT;
-       struct strbuf revisions = STRBUF_INIT;
        int status;
        char *rebased_patches;
 
@@ -616,13 +611,6 @@ static int run_am(struct rebase_options *opts)
                return run_command(&am);
        }
 
-       strbuf_addf(&revisions, "%s...%s",
-                   oid_to_hex(opts->root ?
-                              /* this is now equivalent to !opts->upstream */
-                              &opts->onto->object.oid :
-                              &opts->upstream->object.oid),
-                   oid_to_hex(&opts->orig_head->object.oid));
-
        rebased_patches = xstrdup(git_path("rebased-patches"));
        format_patch.out = open(rebased_patches,
                                O_WRONLY | O_CREAT | O_TRUNC, 0666);
@@ -643,7 +631,12 @@ static int run_am(struct rebase_options *opts)
        if (opts->git_format_patch_opt.len)
                strvec_split(&format_patch.args,
                             opts->git_format_patch_opt.buf);
-       strvec_push(&format_patch.args, revisions.buf);
+       strvec_pushf(&format_patch.args, "%s...%s",
+                    oid_to_hex(opts->root ?
+                               /* this is now equivalent to !opts->upstream */
+                               &opts->onto->object.oid :
+                               &opts->upstream->object.oid),
+                    oid_to_hex(&opts->orig_head->object.oid));
        if (opts->restrict_revision)
                strvec_pushf(&format_patch.args, "^%s",
                             oid_to_hex(&opts->restrict_revision->object.oid));
@@ -666,10 +659,8 @@ static int run_am(struct rebase_options *opts)
                        "As a result, git cannot rebase them."),
                      opts->revisions);
 
-               strbuf_release(&revisions);
                return status;
        }
-       strbuf_release(&revisions);
 
        am.in = open(rebased_patches, O_RDONLY);
        if (am.in < 0) {
index 8c4f0cb90a936b2b24b8b7b9e8b1b789c33bff51..e36b1d619f5c075fc26617fb26972dc21d561e75 100644 (file)
@@ -22,7 +22,6 @@
 #include "connected.h"
 #include "strvec.h"
 #include "version.h"
-#include "tag.h"
 #include "gpg-interface.h"
 #include "sigchain.h"
 #include "fsck.h"
@@ -142,6 +141,7 @@ static enum deny_action parse_deny_action(const char *var, const char *value)
 static int receive_pack_config(const char *var, const char *value,
                               const struct config_context *ctx, void *cb)
 {
+       const char *msg_id;
        int status = parse_hide_refs_config(var, value, "receive", &hidden_refs);
 
        if (status)
@@ -178,12 +178,14 @@ static int receive_pack_config(const char *var, const char *value,
                return 0;
        }
 
-       if (skip_prefix(var, "receive.fsck.", &var)) {
-               if (is_valid_msg_type(var, value))
+       if (skip_prefix(var, "receive.fsck.", &msg_id)) {
+               if (!value)
+                       return config_error_nonbool(var);
+               if (is_valid_msg_type(msg_id, value))
                        strbuf_addf(&fsck_msg_types, "%c%s=%s",
-                               fsck_msg_types.len ? ',' : '=', var, value);
+                               fsck_msg_types.len ? ',' : '=', msg_id, value);
                else
-                       warning("skipping unknown msg id '%s'", var);
+                       warning("skipping unknown msg id '%s'", msg_id);
                return 0;
        }
 
index 6e490f83d543bb2e38af7f737dc7966ef009c35b..a5a4099f61a5f825d6e622572c9ee85ae563de7b 100644 (file)
@@ -248,7 +248,7 @@ static int cmd_reflog_expire(int argc, const char **argv, const char *prefix)
        int verbose = 0;
        reflog_expiry_should_prune_fn *should_prune_fn = should_expire_reflog_ent;
        const struct option options[] = {
-               OPT_BIT(0, "dry-run", &flags, N_("do not actually prune any entries"),
+               OPT_BIT('n', "dry-run", &flags, N_("do not actually prune any entries"),
                        EXPIRE_REFLOGS_DRY_RUN),
                OPT_BIT(0, "rewrite", &flags,
                        N_("rewrite the old SHA1 with the new SHA1 of the entry that now precedes it"),
@@ -368,7 +368,7 @@ static int cmd_reflog_delete(int argc, const char **argv, const char *prefix)
        int verbose = 0;
 
        const struct option options[] = {
-               OPT_BIT(0, "dry-run", &flags, N_("do not actually prune any entries"),
+               OPT_BIT('n', "dry-run", &flags, N_("do not actually prune any entries"),
                        EXPIRE_REFLOGS_DRY_RUN),
                OPT_BIT(0, "rewrite", &flags,
                        N_("rewrite the old SHA1 with the new SHA1 of the entry that now precedes it"),
index edaee4dbec7b01624b5d272a7c402c49f46dba5d..ede36328a3cab9170bc59cb98dda097ea6eb24f7 100644 (file)
@@ -8,7 +8,6 @@
 #include "path.h"
 #include "run-command.h"
 #include "server-info.h"
-#include "sigchain.h"
 #include "strbuf.h"
 #include "string-list.h"
 #include "strvec.h"
@@ -1203,19 +1202,13 @@ int cmd_repack(int argc, const char **argv, const char *prefix)
        if (delete_redundant && repository_format_precious_objects)
                die(_("cannot delete packs in a precious-objects repo"));
 
-       if (keep_unreachable &&
-           (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE)))
-               die(_("options '%s' and '%s' cannot be used together"), "--keep-unreachable", "-A");
+       die_for_incompatible_opt3(unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE), "-A",
+                                 keep_unreachable, "-k/--keep-unreachable",
+                                 pack_everything & PACK_CRUFT, "--cruft");
 
-       if (pack_everything & PACK_CRUFT) {
+       if (pack_everything & PACK_CRUFT)
                pack_everything |= ALL_INTO_ONE;
 
-               if (unpack_unreachable || (pack_everything & LOOSEN_UNREACHABLE))
-                       die(_("options '%s' and '%s' cannot be used together"), "--cruft", "-A");
-               if (keep_unreachable)
-                       die(_("options '%s' and '%s' cannot be used together"), "--cruft", "-k");
-       }
-
        if (write_bitmaps < 0) {
                if (!write_midx &&
                    (!(pack_everything & ALL_INTO_ONE) || !is_bare_repository()))
index 07a9d37275cbbc52cc8cddbae4a6143df2e49a82..b2efc6f640e18a2f956cdc985ecc2c793120a267 100644 (file)
@@ -1,6 +1,5 @@
 #include "builtin.h"
 #include "config.h"
-#include "dir.h"
 #include "gettext.h"
 #include "parse-options.h"
 #include "repository.h"
index 4b018d20e3b2200e44a04f1f759837a571e4bc4f..8390bfe4c487b0c3170045f0601234c1e8278122 100644 (file)
 #include "hash.h"
 #include "hex.h"
 #include "lockfile.h"
-#include "tag.h"
 #include "object.h"
 #include "pretty.h"
-#include "run-command.h"
 #include "refs.h"
 #include "diff.h"
 #include "diffcore.h"
@@ -33,7 +31,6 @@
 #include "setup.h"
 #include "sparse-index.h"
 #include "submodule.h"
-#include "submodule-config.h"
 #include "trace.h"
 #include "trace2.h"
 #include "dir.h"
index 181353dcf51ba8af7620b8926084a1cbea3163b2..b3f47838580c9dd0ed233a3ac34c19aac6b7fa0f 100644 (file)
@@ -7,13 +7,11 @@
 #include "hex.h"
 #include "revision.h"
 #include "list-objects.h"
-#include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "object.h"
 #include "object-name.h"
 #include "object-file.h"
 #include "object-store-ll.h"
-#include "pack.h"
 #include "pack-bitmap.h"
 #include "log-tree.h"
 #include "graph.h"
index fde8861ca4e07990078258843890aef6334dd4c9..917f12244059a67b74b43c80ec59b8503b61700f 100644 (file)
@@ -893,13 +893,15 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                        }
                        if (opt_with_value(arg, "--branches", &arg)) {
                                if (ref_excludes.hidden_refs_configured)
-                                       return error(_("--exclude-hidden cannot be used together with --branches"));
+                                       return error(_("options '%s' and '%s' cannot be used together"),
+                                                    "--exclude-hidden", "--branches");
                                handle_ref_opt(arg, "refs/heads/");
                                continue;
                        }
                        if (opt_with_value(arg, "--tags", &arg)) {
                                if (ref_excludes.hidden_refs_configured)
-                                       return error(_("--exclude-hidden cannot be used together with --tags"));
+                                       return error(_("options '%s' and '%s' cannot be used together"),
+                                                    "--exclude-hidden", "--tags");
                                handle_ref_opt(arg, "refs/tags/");
                                continue;
                        }
@@ -909,7 +911,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
                        }
                        if (opt_with_value(arg, "--remotes", &arg)) {
                                if (ref_excludes.hidden_refs_configured)
-                                       return error(_("--exclude-hidden cannot be used together with --remotes"));
+                                       return error(_("options '%s' and '%s' cannot be used together"),
+                                                    "--exclude-hidden", "--remotes");
                                handle_ref_opt(arg, "refs/remotes/");
                                continue;
                        }
index e6f9a1ad26721c450258849cb8e415156052e442..89821bab95745a5fca294d00811804799ecd323d 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "config.h"
 #include "builtin.h"
 #include "parse-options.h"
 #include "diff.h"
@@ -7,7 +6,6 @@
 #include "repository.h"
 #include "revision.h"
 #include "rerere.h"
-#include "dir.h"
 #include "sequencer.h"
 #include "branch.h"
 
index dff819ae5098ff2ee0c72bae00b35da39bf4979d..fd130cea2d2592829e3abd991ca6caae4a119897 100644 (file)
@@ -9,7 +9,6 @@
 #include "config.h"
 #include "lockfile.h"
 #include "dir.h"
-#include "cache-tree.h"
 #include "gettext.h"
 #include "hash.h"
 #include "tree-walk.h"
index cd6d9e41129a21d7f9c21cebae0a322812ebcbcd..b7183be9709fd40a54162685825166945935e522 100644 (file)
@@ -1,19 +1,14 @@
 #include "builtin.h"
 #include "config.h"
-#include "commit.h"
 #include "hex.h"
-#include "refs.h"
 #include "pkt-line.h"
-#include "sideband.h"
 #include "run-command.h"
 #include "remote.h"
 #include "connect.h"
 #include "send-pack.h"
 #include "quote.h"
 #include "transport.h"
-#include "version.h"
 #include "oid-array.h"
-#include "gpg-interface.h"
 #include "gettext.h"
 #include "protocol.h"
 #include "parse-options.h"
@@ -135,21 +130,18 @@ static int send_pack_config(const char *k, const char *v,
                            const struct config_context *ctx, void *cb)
 {
        if (!strcmp(k, "push.gpgsign")) {
-               const char *value;
-               if (!git_config_get_value("push.gpgsign", &value)) {
-                       switch (git_parse_maybe_bool(value)) {
-                       case 0:
-                               args.push_cert = SEND_PACK_PUSH_CERT_NEVER;
-                               break;
-                       case 1:
-                               args.push_cert = SEND_PACK_PUSH_CERT_ALWAYS;
-                               break;
-                       default:
-                               if (value && !strcasecmp(value, "if-asked"))
-                                       args.push_cert = SEND_PACK_PUSH_CERT_IF_ASKED;
-                               else
-                                       return error(_("invalid value for '%s'"), k);
-                       }
+               switch (git_parse_maybe_bool(v)) {
+               case 0:
+                       args.push_cert = SEND_PACK_PUSH_CERT_NEVER;
+                       break;
+               case 1:
+                       args.push_cert = SEND_PACK_PUSH_CERT_ALWAYS;
+                       break;
+               default:
+                       if (!strcasecmp(v, "if-asked"))
+                               args.push_cert = SEND_PACK_PUSH_CERT_IF_ASKED;
+                       else
+                               return error(_("invalid value for '%s'"), k);
                }
        }
        return git_default_config(k, v, ctx, cb);
@@ -208,7 +200,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
                OPT_BOOL(0, "stateless-rpc", &stateless_rpc, N_("use stateless RPC protocol")),
                OPT_BOOL(0, "stdin", &from_stdin, N_("read refs from stdin")),
                OPT_BOOL(0, "helper-status", &helper_status, N_("print status from remote helper")),
-               OPT_CALLBACK_F(0, CAS_OPT_NAME, &cas, N_("<refname>:<expect>"),
+               OPT_CALLBACK_F(0, "force-with-lease", &cas, N_("<refname>:<expect>"),
                  N_("require old value of ref to be at this value"),
                  PARSE_OPT_OPTARG, parseopt_push_cas_option),
                OPT_BOOL(0, TRANS_OPT_FORCE_IF_INCLUDES, &force_if_includes,
index 7aac525a878b3b3ae4959a831de4747d379e140f..79955c2856eacea0398a7fd9e90f34c790bbd8cd 100644 (file)
@@ -6,7 +6,6 @@
 #include "object-name.h"
 #include "object-store-ll.h"
 #include "object.h"
-#include "tag.h"
 #include "string-list.h"
 #include "parse-options.h"
 
@@ -239,7 +238,7 @@ static int cmd_show_ref__exists(const char **refs)
        if (refs_read_raw_ref(get_main_ref_store(the_repository), ref,
                              &unused_oid, &unused_referent, &unused_type,
                              &failure_errno)) {
-               if (failure_errno == ENOENT) {
+               if (failure_errno == ENOENT || failure_errno == EISDIR) {
                        error(_("reference does not exist"));
                        ret = 2;
                } else {
@@ -315,9 +314,9 @@ int cmd_show_ref(int argc, const char **argv, const char *prefix)
        argc = parse_options(argc, argv, prefix, show_ref_options,
                             show_ref_usage, 0);
 
-       if ((!!exclude_existing_opts.enabled + !!verify + !!exists) > 1)
-               die(_("only one of '%s', '%s' or '%s' can be given"),
-                   "--exclude-existing", "--verify", "--exists");
+       die_for_incompatible_opt3(exclude_existing_opts.enabled, "--exclude-existing",
+                                 verify, "--verify",
+                                 exists, "--exists");
 
        if (exclude_existing_opts.enabled)
                return cmd_show_ref__exclude_existing(&exclude_existing_opts);
index 5c8ffb1f7598b056fadcdd8fb98182d34928e6f3..288a832c8da7aa2c5da4f57967ec9d0f2cea4ca4 100644 (file)
@@ -8,14 +8,10 @@
 #include "parse-options.h"
 #include "pathspec.h"
 #include "repository.h"
-#include "run-command.h"
 #include "strbuf.h"
 #include "string-list.h"
-#include "cache-tree.h"
 #include "lockfile.h"
-#include "resolve-undo.h"
 #include "unpack-trees.h"
-#include "wt-status.h"
 #include "quote.h"
 #include "setup.h"
 #include "sparse-index.h"
@@ -835,7 +831,7 @@ static int sparse_checkout_set(int argc, const char **argv, const char *prefix)
         * non-cone mode, if nothing is specified, manually select just the
         * top-level directory (much as 'init' would do).
         */
-       if (!core_sparse_checkout_cone && argc == 0) {
+       if (!core_sparse_checkout_cone && !set_opts.use_stdin && argc == 0) {
                argv = default_patterns;
                argc = default_patterns_nr;
        } else {
index 4a6771c9f4c493a5dd41df2bf285f40784fa8cff..7fb355bff0a628d1d7a1a08646175ac33d8fe9d7 100644 (file)
@@ -26,7 +26,6 @@
 #include "sparse-index.h"
 #include "log-tree.h"
 #include "diffcore.h"
-#include "exec-cmd.h"
 #include "reflog.h"
 #include "add-interactive.h"
 
@@ -521,7 +520,7 @@ static void unstage_changes_unless_new(struct object_id *orig_tree)
        repo_hold_locked_index(the_repository, &lock, LOCK_DIE_ON_ERROR);
        if (write_locked_index(&the_index, &lock,
                               COMMIT_LOCK | SKIP_IF_UNCHANGED))
-               die(_("Unable to write index."));
+               die(_("could not write index"));
 }
 
 static int do_apply_stash(const char *prefix, struct stash_info *info,
@@ -538,7 +537,7 @@ static int do_apply_stash(const char *prefix, struct stash_info *info,
        repo_read_index_preload(the_repository, NULL, 0);
        if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
                                         NULL, NULL, NULL))
-               return -1;
+               return error(_("could not write index"));
 
        if (write_index_as_tree(&c_tree, &the_index, get_index_file(), 0,
                                NULL))
@@ -1365,7 +1364,7 @@ static int do_create_stash(const struct pathspec *ps, struct strbuf *stash_msg_b
        repo_read_index_preload(the_repository, NULL, 0);
        if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
                                         NULL, NULL, NULL) < 0) {
-               ret = -1;
+               ret = error(_("could not write index"));
                goto done;
        }
 
@@ -1556,7 +1555,7 @@ static int do_push_stash(const struct pathspec *ps, const char *stash_msg, int q
 
        if (repo_refresh_and_write_index(the_repository, REFRESH_QUIET, 0, 0,
                                         NULL, NULL, NULL)) {
-               ret = -1;
+               ret = error(_("could not write index"));
                goto done;
        }
 
index cce46450abe95ea6a24d28026a1686cb930cb75a..fda50f2af1e33277161f819f560b4d8164d284a0 100644 (file)
@@ -22,7 +22,6 @@
 #include "remote.h"
 #include "refs.h"
 #include "refspec.h"
-#include "connect.h"
 #include "revision.h"
 #include "diffcore.h"
 #include "diff.h"
index 3918eacbb57bd9e0d2b90ecbbf6cc07c16fad73b..79ca53c149c1360cc7e7a8ab903c7bf1c3e92ca8 100644 (file)
@@ -18,7 +18,6 @@
 #include "object-store-ll.h"
 #include "path.h"
 #include "tag.h"
-#include "run-command.h"
 #include "parse-options.h"
 #include "diff.h"
 #include "revision.h"
@@ -176,7 +175,7 @@ static int verify_tag(const char *name, const char *ref UNUSED,
 
 static int do_sign(struct strbuf *buffer)
 {
-       return sign_buffer(buffer, buffer, get_signing_key());
+       return sign_buffer(buffer, buffer, get_signing_key()) ? -1 : 0;
 }
 
 static const char tag_template[] =
index fef7423448804006a04286ce18adedbaaf950229..e0a701f2b383bbbd95fc1e7fef3fec30c3783c37 100644 (file)
 #include "delta.h"
 #include "pack.h"
 #include "blob.h"
-#include "commit.h"
 #include "replace-object.h"
 #include "strbuf.h"
-#include "tag.h"
-#include "tree.h"
-#include "tree-walk.h"
 #include "progress.h"
 #include "decorate.h"
 #include "fsck.h"
index c0c4e65e6fb1986fadf2e98f0d19449e95905fe6..61338a01ecfc0ee4f029215149651bb9ac03da1e 100644 (file)
@@ -7,7 +7,6 @@
 #include "parse-options.h"
 #include "quote.h"
 #include "repository.h"
-#include "strvec.h"
 
 static const char * const git_update_ref_usage[] = {
        N_("git update-ref [<options>] -d <refname> [<old-val>]"),
index 9680b5870130615b7b4432a5ce456279db750aa4..0d2b9aea2aedca39b18d15bc7a8719669d63f1d3 100644 (file)
@@ -9,10 +9,8 @@
 #include "config.h"
 #include "gettext.h"
 #include "object-name.h"
-#include "object-store-ll.h"
 #include "repository.h"
 #include "commit.h"
-#include "run-command.h"
 #include "parse-options.h"
 #include "gpg-interface.h"
 
index d8753270ebee4df6eed4b2dd5037f3fee97eb2c6..c731e2f87b4ee35e4910e3a8c11e18b8e68e58c1 100644 (file)
@@ -9,7 +9,6 @@
 #include "config.h"
 #include "gettext.h"
 #include "tag.h"
-#include "run-command.h"
 #include "object-name.h"
 #include "parse-options.h"
 #include "gpg-interface.h"
index 62b7e26f4bdb17f524914ab6e60143915d8f2565..e1033c294f930ea8a1dbea23de6c92a0f3687bb7 100644 (file)
        _("No possible source branch, inferring '--orphan'")
 
 #define WORKTREE_ADD_ORPHAN_WITH_DASH_B_HINT_TEXT \
-       _("If you meant to create a worktree containing a new orphan branch\n" \
+       _("If you meant to create a worktree containing a new unborn branch\n" \
        "(branch with no commits) for this repository, you can do so\n" \
        "using the --orphan flag:\n" \
        "\n" \
        "    git worktree add --orphan -b %s %s\n")
 
 #define WORKTREE_ADD_ORPHAN_NO_DASH_B_HINT_TEXT \
-       _("If you meant to create a worktree containing a new orphan branch\n" \
+       _("If you meant to create a worktree containing a new unborn branch\n" \
        "(branch with no commits) for this repository, you can do so\n" \
        "using the --orphan flag:\n" \
        "\n" \
@@ -730,11 +730,11 @@ static int dwim_orphan(const struct add_opts *opts, int opt_track, int remote)
        }
 
        if (opt_track) {
-               die(_("'%s' and '%s' cannot be used together"), "--orphan",
-                   "--track");
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--orphan", "--track");
        } else if (!opts->checkout) {
-               die(_("'%s' and '%s' cannot be used together"), "--orphan",
-                   "--no-checkout");
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--orphan", "--no-checkout");
        }
        return 1;
 }
@@ -784,7 +784,7 @@ static int add(int ac, const char **av, const char *prefix)
                           N_("create a new branch")),
                OPT_STRING('B', NULL, &new_branch_force, N_("branch"),
                           N_("create or reset a branch")),
-               OPT_BOOL(0, "orphan", &opts.orphan, N_("create unborn/orphaned branch")),
+               OPT_BOOL(0, "orphan", &opts.orphan, N_("create unborn branch")),
                OPT_BOOL('d', "detach", &opts.detach, N_("detach HEAD at named commit")),
                OPT_BOOL(0, "checkout", &opts.checkout, N_("populate the new working tree")),
                OPT_BOOL(0, "lock", &keep_locked, N_("keep the new working tree locked")),
@@ -806,16 +806,17 @@ static int add(int ac, const char **av, const char *prefix)
        if (!!opts.detach + !!new_branch + !!new_branch_force > 1)
                die(_("options '%s', '%s', and '%s' cannot be used together"), "-b", "-B", "--detach");
        if (opts.detach && opts.orphan)
-               die(_("options '%s', and '%s' cannot be used together"),
+               die(_("options '%s' and '%s' cannot be used together"),
                    "--orphan", "--detach");
        if (opts.orphan && opt_track)
-               die(_("'%s' and '%s' cannot be used together"), "--orphan", "--track");
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--orphan", "--track");
        if (opts.orphan && !opts.checkout)
-               die(_("'%s' and '%s' cannot be used together"), "--orphan",
-                   "--no-checkout");
+               die(_("options '%s' and '%s' cannot be used together"),
+                   "--orphan", "--no-checkout");
        if (opts.orphan && ac == 2)
-               die(_("'%s' and '%s' cannot be used together"), "--orphan",
-                   _("<commit-ish>"));
+               die(_("option '%s' and commit-ish cannot be used together"),
+                   "--orphan");
        if (lock_reason && !keep_locked)
                die(_("the option '%s' requires '%s'"), "--reason", "--lock");
        if (lock_reason)
@@ -850,21 +851,21 @@ static int add(int ac, const char **av, const char *prefix)
                const char *s = worktree_basename(path, &n);
                new_branch = xstrndup(s, n);
        } else if (opts.orphan) {
-               // No-op
+               ; /* no-op */
        } else if (opts.detach) {
-               // Check HEAD
+               /* Check HEAD */
                if (!strcmp(branch, "HEAD"))
                        can_use_local_refs(&opts);
        } else if (ac < 2 && new_branch) {
-               // DWIM: Infer --orphan when repo has no refs.
+               /* DWIM: Infer --orphan when repo has no refs. */
                opts.orphan = dwim_orphan(&opts, !!opt_track, 0);
        } else if (ac < 2) {
-               // DWIM: Guess branch name from path.
+               /* DWIM: Guess branch name from path. */
                const char *s = dwim_branch(path, &new_branch);
                if (s)
                        branch = s;
 
-               // DWIM: Infer --orphan when repo has no refs.
+               /* DWIM: Infer --orphan when repo has no refs. */
                opts.orphan = (!s) && dwim_orphan(&opts, !!opt_track, 1);
        } else if (ac == 2) {
                struct object_id oid;
index 6ce62999e58523e20a686801446daaf0d924e9be..eb46b8863793e25b82ca6df27eb435476c4807a5 100644 (file)
@@ -11,7 +11,6 @@
 #include "csum-file.h"
 #include "pack.h"
 #include "strbuf.h"
-#include "string-list.h"
 #include "tmp-objdir.h"
 #include "packfile.h"
 #include "object-file.h"
index 8492fffd2f759f97e750063c4de0eefdc0763d99..ca32050a78fd7570adea76db264c5600339caf82 100644 (file)
@@ -4,7 +4,6 @@
 #include "copy.h"
 #include "environment.h"
 #include "gettext.h"
-#include "object-store-ll.h"
 #include "refs.h"
 #include "run-command.h"
 #include "hashmap.h"
index 641427ed410af39be80be22460a103dbad2d3d35..64678fe19930402b8400cb05d3ccaad5bb5b00a6 100644 (file)
@@ -11,7 +11,6 @@
 #include "read-cache-ll.h"
 #include "replace-object.h"
 #include "promisor-remote.h"
-#include "sparse-index.h"
 #include "trace.h"
 #include "trace2.h"
 
index 78b7e326da6d8b6b3d1923007d3f22dea9814b8d..48c43f0f90774e65fcc8b388c6a52444fde50506 100755 (executable)
@@ -3,6 +3,10 @@
 # Install dependencies required to build and test Git inside container
 #
 
+. ${0%/*}/lib.sh
+
+begin_group "Install dependencies"
+
 case "$jobname" in
 linux32)
        linux32 --32bit i386 sh -c '
@@ -12,11 +16,26 @@ linux32)
        '
        ;;
 linux-musl)
-       apk add --update build-base curl-dev openssl-dev expat-dev gettext \
-               pcre2-dev python3 musl-libintl perl-utils ncurses >/dev/null
+       apk add --update shadow sudo build-base curl-dev openssl-dev expat-dev gettext \
+               pcre2-dev python3 musl-libintl perl-utils ncurses \
+               apache2 apache2-http2 apache2-proxy apache2-ssl apache2-webdav apr-util-dbd_sqlite3 \
+               bash cvs gnupg perl-cgi perl-dbd-sqlite >/dev/null
+       ;;
+linux-*)
+       # Required so that apt doesn't wait for user input on certain packages.
+       export DEBIAN_FRONTEND=noninteractive
+
+       apt update -q &&
+       apt install -q -y sudo git make language-pack-is libsvn-perl apache2 libssl-dev \
+               libcurl4-openssl-dev libexpat-dev tcl tk gettext zlib1g-dev \
+               perl-modules liberror-perl libauthen-sasl-perl libemail-valid-perl \
+               libdbd-sqlite3-perl libio-socket-ssl-perl libnet-smtp-ssl-perl ${CC_PACKAGE:-${CC:-gcc}} \
+               apache2 cvs cvsps gnupg libcgi-pm-perl subversion
        ;;
 pedantic)
        dnf -yq update >/dev/null &&
        dnf -yq install make gcc findutils diffutils perl python3 gettext zlib-devel expat-devel openssl-devel curl-devel pcre2-devel >/dev/null
        ;;
 esac
+
+end_group "Install dependencies"
index bc0b23099df29e252aefa1c740f83922658e2cbf..c749b21366b95092b144611dd9182b30bf3cb4a8 100755 (executable)
--- a/ci/lib.sh
+++ b/ci/lib.sh
@@ -1,16 +1,7 @@
 # Library of functions shared by all CI scripts
 
-if test true != "$GITHUB_ACTIONS"
+if test true = "$GITHUB_ACTIONS"
 then
-       begin_group () { :; }
-       end_group () { :; }
-
-       group () {
-               shift
-               "$@"
-       }
-       set -x
-else
        begin_group () {
                need_to_end_group=t
                echo "::group::$1" >&2
@@ -23,27 +14,50 @@ else
                need_to_end_group=
                echo '::endgroup::' >&2
        }
-       trap end_group EXIT
+elif test true = "$GITLAB_CI"
+then
+       begin_group () {
+               need_to_end_group=t
+               printf "\e[0Ksection_start:$(date +%s):$(echo "$1" | tr ' ' _)\r\e[0K$1\n"
+               trap "end_group '$1'" EXIT
+               set -x
+       }
 
-       group () {
+       end_group () {
+               test -n "$need_to_end_group" || return 0
                set +x
-               begin_group "$1"
-               shift
-               # work around `dash` not supporting `set -o pipefail`
-               (
-                       "$@" 2>&1
-                       echo $? >exit.status
-               ) |
-               sed 's/^\(\([^ ]*\):\([0-9]*\):\([0-9]*:\) \)\(error\|warning\): /::\5 file=\2,line=\3::\1/'
-               res=$(cat exit.status)
-               rm exit.status
-               end_group
-               return $res
+               need_to_end_group=
+               printf "\e[0Ksection_end:$(date +%s):$(echo "$1" | tr ' ' _)\r\e[0K\n"
+               trap - EXIT
        }
+else
+       begin_group () { :; }
+       end_group () { :; }
 
-       begin_group "CI setup"
+       set -x
 fi
 
+group () {
+       group="$1"
+       shift
+       begin_group "$group"
+
+       # work around `dash` not supporting `set -o pipefail`
+       (
+               "$@" 2>&1
+               echo $? >exit.status
+       ) |
+       sed 's/^\(\([^ ]*\):\([0-9]*\):\([0-9]*:\) \)\(error\|warning\): /::\5 file=\2,line=\3::\1/'
+       res=$(cat exit.status)
+       rm exit.status
+
+       end_group "$group"
+       return $res
+}
+
+begin_group "CI setup"
+trap "end_group 'CI setup'" EXIT
+
 # Set 'exit on error' for all CI scripts to let the caller know that
 # something went wrong.
 #
@@ -71,10 +85,32 @@ skip_branch_tip_with_tag () {
        fi
 }
 
+# Check whether we can use the path passed via the first argument as Git
+# repository.
+is_usable_git_repository () {
+       # We require Git in our PATH, otherwise we cannot access repositories
+       # at all.
+       if ! command -v git >/dev/null
+       then
+               return 1
+       fi
+
+       # And the target directory needs to be a proper Git repository.
+       if ! git -C "$1" rev-parse 2>/dev/null
+       then
+               return 1
+       fi
+}
+
 # Save some info about the current commit's tree, so we can skip the build
 # job if we encounter the same tree again and can provide a useful info
 # message.
 save_good_tree () {
+       if ! is_usable_git_repository .
+       then
+               return
+       fi
+
        echo "$(git rev-parse $CI_COMMIT^{tree}) $CI_COMMIT $CI_JOB_NUMBER $CI_JOB_ID" >>"$good_trees_file"
        # limit the file size
        tail -1000 "$good_trees_file" >"$good_trees_file".tmp
@@ -90,6 +126,11 @@ skip_good_tree () {
                return
        fi
 
+       if ! is_usable_git_repository .
+       then
+               return
+       fi
+
        if ! good_tree_info="$(grep "^$(git rev-parse $CI_COMMIT^{tree}) " "$good_trees_file")"
        then
                # Haven't seen this tree yet, or no cached good trees file yet.
@@ -121,6 +162,11 @@ skip_good_tree () {
 }
 
 check_unignored_build_artifacts () {
+       if ! is_usable_git_repository .
+       then
+               return
+       fi
+
        ! git ls-files --other --exclude-standard --error-unmatch \
                -- ':/*' 2>/dev/null ||
        {
@@ -133,6 +179,26 @@ handle_failed_tests () {
        return 1
 }
 
+create_failed_test_artifacts () {
+       mkdir -p t/failed-test-artifacts
+
+       for test_exit in t/test-results/*.exit
+       do
+               test 0 != "$(cat "$test_exit")" || continue
+
+               test_name="${test_exit%.exit}"
+               test_name="${test_name##*/}"
+               printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
+               echo "The full logs are in the 'print test failures' step below."
+               echo "See also the 'failed-tests-*' artifacts attached to this run."
+               cat "t/test-results/$test_name.markup"
+
+               trash_dir="t/trash directory.$test_name"
+               cp "t/test-results/$test_name.out" t/failed-test-artifacts/
+               tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
+       done
+}
+
 # GitHub Action doesn't set TERM, which is required by tput
 export TERM=${TERM:-dumb}
 
@@ -156,11 +222,8 @@ then
        # among *all* phases)
        cache_dir="$HOME/test-cache/$SYSTEM_PHASENAME"
 
-       export GIT_PROVE_OPTS="--timer --jobs 10 --state=failed,slow,save"
-       export GIT_TEST_OPTS="--verbose-log -x --write-junit-xml"
-       MAKEFLAGS="$MAKEFLAGS --jobs=10"
-       test windows_nt != "$CI_OS_NAME" ||
-       GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
+       GIT_TEST_OPTS="--write-junit-xml"
+       JOBS=10
 elif test true = "$GITHUB_ACTIONS"
 then
        CI_TYPE=github-actions
@@ -173,40 +236,63 @@ then
        CC="${CC_PACKAGE:-${CC:-gcc}}"
        DONT_SKIP_TAGS=t
        handle_failed_tests () {
-               mkdir -p t/failed-test-artifacts
                echo "FAILED_TEST_ARTIFACTS=t/failed-test-artifacts" >>$GITHUB_ENV
+               create_failed_test_artifacts
+               return 1
+       }
 
-               for test_exit in t/test-results/*.exit
-               do
-                       test 0 != "$(cat "$test_exit")" || continue
-
-                       test_name="${test_exit%.exit}"
-                       test_name="${test_name##*/}"
-                       printf "\\e[33m\\e[1m=== Failed test: ${test_name} ===\\e[m\\n"
-                       echo "The full logs are in the 'print test failures' step below."
-                       echo "See also the 'failed-tests-*' artifacts attached to this run."
-                       cat "t/test-results/$test_name.markup"
-
-                       trash_dir="t/trash directory.$test_name"
-                       cp "t/test-results/$test_name.out" t/failed-test-artifacts/
-                       tar czf t/failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
-               done
+       cache_dir="$HOME/none"
+
+       GIT_TEST_OPTS="--github-workflow-markup"
+       JOBS=10
+elif test true = "$GITLAB_CI"
+then
+       CI_TYPE=gitlab-ci
+       CI_BRANCH="$CI_COMMIT_REF_NAME"
+       CI_COMMIT="$CI_COMMIT_SHA"
+       case "$CI_JOB_IMAGE" in
+       macos-*)
+               CI_OS_NAME=osx;;
+       alpine:*|fedora:*|ubuntu:*)
+               CI_OS_NAME=linux;;
+       *)
+               echo "Could not identify OS image" >&2
+               env >&2
+               exit 1
+               ;;
+       esac
+       CI_REPO_SLUG="$CI_PROJECT_PATH"
+       CI_JOB_ID="$CI_JOB_ID"
+       CC="${CC_PACKAGE:-${CC:-gcc}}"
+       DONT_SKIP_TAGS=t
+       handle_failed_tests () {
+               create_failed_test_artifacts
                return 1
        }
 
        cache_dir="$HOME/none"
 
-       export GIT_PROVE_OPTS="--timer --jobs 10"
-       export GIT_TEST_OPTS="--verbose-log -x --github-workflow-markup"
-       MAKEFLAGS="$MAKEFLAGS --jobs=10"
-       test windows != "$CI_OS_NAME" ||
-       GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
+       runs_on_pool=$(echo "$CI_JOB_IMAGE" | tr : -)
+       JOBS=$(nproc)
 else
        echo "Could not identify CI type" >&2
        env >&2
        exit 1
 fi
 
+MAKEFLAGS="$MAKEFLAGS --jobs=$JOBS"
+GIT_PROVE_OPTS="--timer --jobs $JOBS"
+
+GIT_TEST_OPTS="$GIT_TEST_OPTS --verbose-log -x"
+case "$CI_OS_NAME" in
+windows|windows_nt)
+       GIT_TEST_OPTS="$GIT_TEST_OPTS --no-chain-lint --no-bin-wrappers"
+       ;;
+esac
+
+export GIT_TEST_OPTS
+export GIT_PROVE_OPTS
+
 good_trees_file="$cache_dir/good-trees"
 
 mkdir -p "$cache_dir"
@@ -285,5 +371,5 @@ esac
 
 MAKEFLAGS="$MAKEFLAGS CC=${CC:-cc}"
 
-end_group
+end_group "CI setup"
 set -x
index 57277eefcd0c8b6117fd71e9adb3a526baa05ef1..c33ad4e3a2220a97f6e0708afe915010f4f44561 100755 (executable)
@@ -51,6 +51,12 @@ do
                        tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
                        continue
                        ;;
+               gitlab-ci)
+                       mkdir -p failed-test-artifacts
+                       cp "${TEST_EXIT%.exit}.out" failed-test-artifacts/
+                       tar czf failed-test-artifacts/"$test_name".trash.tar.gz "$trash_dir"
+                       continue
+                       ;;
                *)
                        echo "Unhandled CI type: $CI_TYPE" >&2
                        exit 1
index f90f442482932e618cc7399924c00ddde8c50eaf..db94581f72443c28fd47535db78e39b5ad021a86 100644 (file)
@@ -2,7 +2,6 @@
 #include "object-store-ll.h"
 #include "commit.h"
 #include "convert.h"
-#include "blob.h"
 #include "diff.h"
 #include "diffcore.h"
 #include "environment.h"
index ee66098e077d89f293b9527c7689865904f4a12f..37bd10eca8bb5619d8735756285c2a3b010e8fcb 100644 (file)
@@ -1,14 +1,13 @@
 #include "git-compat-util.h"
 #include "config.h"
+#include "csum-file.h"
 #include "gettext.h"
 #include "hex.h"
 #include "lockfile.h"
-#include "pack.h"
 #include "packfile.h"
 #include "commit.h"
 #include "object.h"
 #include "refs.h"
-#include "revision.h"
 #include "hash-lookup.h"
 #include "commit-graph.h"
 #include "object-file.h"
@@ -831,6 +830,9 @@ struct bloom_filter_settings *get_bloom_filter_settings(struct repository *r)
 
 void close_commit_graph(struct raw_object_store *o)
 {
+       if (!o->commit_graph)
+               return;
+
        clear_commit_graph_data_slab(&commit_graph_data_slab);
        free_commit_graph(o->commit_graph);
        o->commit_graph = NULL;
@@ -1029,7 +1031,7 @@ struct commit *lookup_commit_in_graph(struct repository *repo, const struct obje
        uint32_t pos;
 
        if (commit_graph_paranoia == -1)
-               commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 1);
+               commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0);
 
        if (!prepare_commit_graph(repo))
                return NULL;
index a868a575ea1cf8e7ccd331610b9d309a065ad135..ecc913fc99ba9e6b88df675462a2b8f912cbd0ce 100644 (file)
@@ -4,7 +4,6 @@
 #include "decorate.h"
 #include "hex.h"
 #include "prio-queue.h"
-#include "tree.h"
 #include "ref-filter.h"
 #include "revision.h"
 #include "tag.h"
index 8405d7c3fceab23c6eafd16e36d76c7172c44923..ef679a0b939046c4aac15567cdf3c0ae8c079d29 100644 (file)
--- a/commit.c
+++ b/commit.c
@@ -8,7 +8,6 @@
 #include "repository.h"
 #include "object-name.h"
 #include "object-store-ll.h"
-#include "pkt-line.h"
 #include "utf8.h"
 #include "diff.h"
 #include "revision.h"
@@ -23,7 +22,6 @@
 #include "advice.h"
 #include "refs.h"
 #include "commit-reach.h"
-#include "run-command.h"
 #include "setup.h"
 #include "shallow.h"
 #include "tree.h"
@@ -577,7 +575,7 @@ int repo_parse_commit_internal(struct repository *r,
                static int commit_graph_paranoia = -1;
 
                if (commit_graph_paranoia == -1)
-                       commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 1);
+                       commit_graph_paranoia = git_env_bool(GIT_COMMIT_GRAPH_PARANOIA, 0);
 
                if (commit_graph_paranoia && !has_object(r, &item->object.oid, 0)) {
                        unparse_commit(r, &item->object.oid);
@@ -1783,7 +1781,7 @@ const char *find_commit_header(const char *msg, const char *key, size_t *out_len
  * Returns the number of bytes from the tail to ignore, to be fed as
  * the second parameter to append_signoff().
  */
-size_t ignore_non_trailer(const char *buf, size_t len)
+size_t ignored_log_message_bytes(const char *buf, size_t len)
 {
        size_t boc = 0;
        size_t bol = 0;
index 28928833c544081f9c08971f7a4450e97154ebb3..1cc872f225f438be7dc03a9b4dc8f207da0deb5b 100644 (file)
--- a/commit.h
+++ b/commit.h
@@ -294,8 +294,8 @@ const char *find_header_mem(const char *msg, size_t len,
 const char *find_commit_header(const char *msg, const char *key,
                               size_t *out_len);
 
-/* Find the end of the log message, the right place for a new trailer. */
-size_t ignore_non_trailer(const char *buf, size_t len);
+/* Find the number of bytes to ignore from the end of a log message. */
+size_t ignored_log_message_bytes(const char *buf, size_t len);
 
 typedef int (*each_mergetag_fn)(struct commit *commit, struct commit_extra_header *extra,
                                void *cb_data);
index 2d4e245beb18b8f3573ea33526274d3f8f45b675..2aa8c219acee4def1711e5f84d45571e34be4e16 100644 (file)
@@ -4,6 +4,7 @@
 #include "fsm-health.h"
 #include "fsmonitor--daemon.h"
 #include "gettext.h"
+#include "simple-ipc.h"
 
 /*
  * Every minute wake up and test our health.
index 11b56d3ef12ffb52ef291e95e2b8e39823e77f0f..2fc67442eb5e87e0b006f997fd6b597f9a919b99 100644 (file)
@@ -29,6 +29,7 @@
 #include "fsmonitor--daemon.h"
 #include "fsmonitor-path-utils.h"
 #include "gettext.h"
+#include "simple-ipc.h"
 #include "string-list.h"
 #include "trace.h"
 
index 90a2412284414e0675bc7603e4d13850d640a695..5a21dade7b8659aa4d6e9e3c697a7e124ef31ccb 100644 (file)
@@ -4,6 +4,7 @@
 #include "fsm-listen.h"
 #include "fsmonitor--daemon.h"
 #include "gettext.h"
+#include "simple-ipc.h"
 #include "trace2.h"
 
 /*
index ec5280da160135170e2d778cfcb19cea1752c211..42053c1f656bd8b73696b751f30177ce9e544d59 100644 (file)
@@ -255,6 +255,8 @@ int mingw_core_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "core.unsetenvvars")) {
+               if (!value)
+                       return config_error_nonbool(var);
                free(unset_environment_variables);
                unset_environment_variables = xstrdup(value);
                return 0;
index e5e1dda8ccdb60320a05b064479595eb4eb4997c..cb176d966f287d98e44495db1797061c8c1102af 100644 (file)
@@ -1,8 +1,5 @@
 #include "git-compat-util.h"
 #include "simple-ipc.h"
-#include "strbuf.h"
-#include "pkt-line.h"
-#include "thread-utils.h"
 
 #ifndef SUPPORTS_SIMPLE_IPC
 /*
index b2f4f22ce44f51f6f8f18e0d7ca6a2ed22de183b..9b3f2cdf8c9608a5aae4dc3ebfd8fa208c5617de 100644 (file)
@@ -2,7 +2,6 @@
 #include "gettext.h"
 #include "simple-ipc.h"
 #include "strbuf.h"
-#include "pkt-line.h"
 #include "thread-utils.h"
 #include "trace2.h"
 #include "unix-socket.h"
index b330c7adb4a5efc3cac898391d4c722b019d95a1..9ff6ae1cb903a0690295a7d5bb452ef5f35c12e1 100644 (file)
--- a/config.c
+++ b/config.c
 #include "pager.h"
 #include "path.h"
 #include "utf8.h"
-#include "dir.h"
 #include "color.h"
-#include "replace-object.h"
 #include "refs.h"
 #include "setup.h"
 #include "strvec.h"
 #include "trace2.h"
 #include "wildmatch.h"
-#include "worktree.h"
 #include "ws.h"
 #include "write-or-die.h"
 
@@ -1386,10 +1383,15 @@ static int git_default_core_config(const char *var, const char *value,
                return 0;
        }
        if (!strcmp(var, "core.checkstat")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (!strcasecmp(value, "default"))
                        check_stat = 1;
                else if (!strcasecmp(value, "minimal"))
                        check_stat = 0;
+               else
+                       return error(_("invalid value for '%s': '%s'"),
+                                    var, value);
        }
 
        if (!strcmp(var, "core.quotepath")) {
@@ -1546,12 +1548,12 @@ static int git_default_core_config(const char *var, const char *value,
                return 0;
        }
 
-       if (!strcmp(var, "core.checkroundtripencoding")) {
-               check_roundtrip_encoding = xstrdup(value);
-               return 0;
-       }
+       if (!strcmp(var, "core.checkroundtripencoding"))
+               return git_config_string(&check_roundtrip_encoding, var, value);
 
        if (!strcmp(var, "core.notesref")) {
+               if (!value)
+                       return config_error_nonbool(var);
                notes_ref_name = xstrdup(value);
                return 0;
        }
@@ -1619,6 +1621,8 @@ static int git_default_core_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "core.createobject")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (!strcmp(value, "rename"))
                        object_creation_mode = OBJECT_CREATION_USES_RENAMES;
                else if (!strcmp(value, "link"))
index 13a39ebd2e73f9b34de743b797577a5e8e98cbae..e21a39b406fb2e262a5277807385e4c14d17063f 100644 (file)
@@ -122,6 +122,38 @@ __git ()
                ${__git_dir:+--git-dir="$__git_dir"} "$@" 2>/dev/null
 }
 
+# Helper function to read the first line of a file into a variable.
+# __git_eread requires 2 arguments, the file path and the name of the
+# variable, in that order.
+#
+# This is taken from git-prompt.sh.
+__git_eread ()
+{
+       test -r "$1" && IFS=$'\r\n' read -r "$2" <"$1"
+}
+
+# Runs git in $__git_repo_path to determine whether a pseudoref exists.
+# 1: The pseudo-ref to search
+__git_pseudoref_exists ()
+{
+       local ref=$1
+
+       # If the reftable is in use, we have to shell out to 'git rev-parse'
+       # to determine whether the ref exists instead of looking directly in
+       # the filesystem to determine whether the ref exists. Otherwise, use
+       # Bash builtins since executing Git commands are expensive on some
+       # platforms.
+       if __git_eread "$__git_repo_path/HEAD" head; then
+               b="${head#ref: }"
+               if [ "$b" == "refs/heads/.invalid" ]; then
+                       __git -C "$__git_repo_path" rev-parse --verify --quiet "$ref" 2>/dev/null
+                       return $?
+               fi
+       fi
+
+       [ -f "$__git_repo_path/$ref" ]
+}
+
 # Removes backslash escaping, single quotes and double quotes from a word,
 # stores the result in the variable $dequoted_word.
 # 1: The word to dequote.
@@ -1625,7 +1657,7 @@ __git_cherry_pick_inprogress_options=$__git_sequencer_inprogress_options
 _git_cherry_pick ()
 {
        __git_find_repo_path
-       if [ -f "$__git_repo_path"/CHERRY_PICK_HEAD ]; then
+       if __git_pseudoref_exists CHERRY_PICK_HEAD; then
                __gitcomp "$__git_cherry_pick_inprogress_options"
                return
        fi
@@ -2067,7 +2099,7 @@ _git_log ()
        __git_find_repo_path
 
        local merge=""
-       if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
+       if __git_pseudoref_exists MERGE_HEAD; then
                merge="--merge"
        fi
        case "$prev,$cur" in
@@ -2934,6 +2966,7 @@ _git_reset ()
 
 _git_restore ()
 {
+       __git_find_repo_path
        case "$prev" in
        -s)
                __git_complete_refs
@@ -2952,7 +2985,7 @@ _git_restore ()
                __gitcomp_builtin restore
                ;;
        *)
-               if __git rev-parse --verify --quiet HEAD >/dev/null; then
+               if __git_pseudoref_exists HEAD; then
                        __git_complete_index_file "--modified"
                fi
        esac
@@ -2963,7 +2996,7 @@ __git_revert_inprogress_options=$__git_sequencer_inprogress_options
 _git_revert ()
 {
        __git_find_repo_path
-       if [ -f "$__git_repo_path"/REVERT_HEAD ]; then
+       if __git_pseudoref_exists REVERT_HEAD; then
                __gitcomp "$__git_revert_inprogress_options"
                return
        fi
@@ -3592,7 +3625,7 @@ __gitk_main ()
        __git_find_repo_path
 
        local merge=""
-       if [ -f "$__git_repo_path/MERGE_HEAD" ]; then
+       if __git_pseudoref_exists MERGE_HEAD; then
                merge="--merge"
        fi
        case "$cur" in
index 376f577737591e26a118718a87945500ea621c95..636add6968067537a34e46b92957fbc35acd18e9 100644 (file)
@@ -1,6 +1,6 @@
 package DiffHighlight;
 
-use 5.008;
+use 5.008001;
 use warnings FATAL => 'all';
 use strict;
 
index 917d9e2d3222c12f2d0dc043a1434acae2b398ae..ff7811225ee67166d8e997ce99def0344971f904 100644 (file)
@@ -1,6 +1,6 @@
 package Git::Mediawiki;
 
-use 5.008;
+use 5.008001;
 use strict;
 use POSIX;
 use Git;
index d925589444b90a11058abe87286df3d5add592f8..ab8b4fa68d67ba3da1fc7900b616dc70a9967eba 100644 (file)
--- a/convert.h
+++ b/convert.h
@@ -92,7 +92,7 @@ void convert_attrs(struct index_state *istate,
                   struct conv_attrs *ca, const char *path);
 
 extern enum eol core_eol;
-extern char *check_roundtrip_encoding;
+extern const char *check_roundtrip_encoding;
 const char *get_cached_convert_stats_ascii(struct index_state *istate,
                                           const char *path);
 const char *get_wt_convert_stats_ascii(const char *path);
index 5de5759f3f13da13465ec6c9bfa6abeb44ceaee3..ee2318d45a1c7898b39999b1f5fc81be8ec49f00 100644 (file)
@@ -1,18 +1,13 @@
 #include "git-compat-util.h"
-#include "attr.h"
 #include "object.h"
-#include "blob.h"
 #include "commit.h"
 #include "gettext.h"
 #include "hex.h"
 #include "tag.h"
 #include "tree.h"
-#include "delta.h"
 #include "pack.h"
 #include "tree-walk.h"
 #include "diff.h"
-#include "revision.h"
-#include "list-objects.h"
 #include "progress.h"
 #include "refs.h"
 #include "khash.h"
index 0e9ec4f68afb01f23d9b9a0142d2ffb2cd1cc79b..8fde93d7cac78d9fee3f3326ae4fff2e36a6c009 100644 (file)
@@ -2,7 +2,6 @@
  * Copyright (C) 2005 Junio C Hamano
  */
 #include "git-compat-util.h"
-#include "quote.h"
 #include "commit.h"
 #include "diff.h"
 #include "diffcore.h"
index e7041b89e38887e04237a00f84366781dbabf739..3a8965672c5e90093c08a9fde12981b922ae8a76 100644 (file)
@@ -8,13 +8,10 @@
 #include "abspath.h"
 #include "color.h"
 #include "commit.h"
-#include "blob.h"
-#include "tag.h"
 #include "diff.h"
 #include "diffcore.h"
 #include "gettext.h"
 #include "revision.h"
-#include "log-tree.h"
 #include "parse-options.h"
 #include "string-list.h"
 #include "dir.h"
diff --git a/diff.c b/diff.c
index 2c602df10a372c7e99402ca5a2dc9cf7aa673c09..ccfa1fca0d05fa0148a53e05497efaf21cc4d916 100644 (file)
--- a/diff.c
+++ b/diff.c
 #include "hex.h"
 #include "xdiff-interface.h"
 #include "color.h"
-#include "attr.h"
 #include "run-command.h"
 #include "utf8.h"
 #include "object-store-ll.h"
 #include "userdiff.h"
-#include "submodule-config.h"
 #include "submodule.h"
 #include "hashmap.h"
 #include "mem-pool.h"
@@ -372,7 +370,10 @@ int git_diff_ui_config(const char *var, const char *value,
                return 0;
        }
        if (!strcmp(var, "diff.colormovedws")) {
-               unsigned cm = parse_color_moved_ws(value);
+               unsigned cm;
+               if (!value)
+                       return config_error_nonbool(var);
+               cm = parse_color_moved_ws(value);
                if (cm & COLOR_MOVED_WS_ERROR)
                        return -1;
                diff_color_moved_ws_default = cm;
@@ -426,10 +427,15 @@ int git_diff_ui_config(const char *var, const char *value,
        if (!strcmp(var, "diff.orderfile"))
                return git_config_pathname(&diff_order_file_cfg, var, value);
 
-       if (!strcmp(var, "diff.ignoresubmodules"))
+       if (!strcmp(var, "diff.ignoresubmodules")) {
+               if (!value)
+                       return config_error_nonbool(var);
                handle_ignore_submodules_arg(&default_diff_options, value);
+       }
 
        if (!strcmp(var, "diff.submodule")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (parse_submodule_params(&default_diff_options, value))
                        warning(_("Unknown value for 'diff.submodule' config variable: '%s'"),
                                value);
@@ -437,9 +443,12 @@ int git_diff_ui_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "diff.algorithm")) {
+               if (!value)
+                       return config_error_nonbool(var);
                diff_algorithm = parse_algorithm_value(value);
                if (diff_algorithm < 0)
-                       return -1;
+                       return error(_("unknown value for config '%s': %s"),
+                                    var, value);
                return 0;
        }
 
@@ -473,9 +482,13 @@ int git_diff_basic_config(const char *var, const char *value,
        }
 
        if (!strcmp(var, "diff.wserrorhighlight")) {
-               int val = parse_ws_error_highlight(value);
+               int val;
+               if (!value)
+                       return config_error_nonbool(var);
+               val = parse_ws_error_highlight(value);
                if (val < 0)
-                       return -1;
+                       return error(_("unknown value for config '%s': %s"),
+                                    var, value);
                ws_error_highlight_default = val;
                return 0;
        }
@@ -490,6 +503,8 @@ int git_diff_basic_config(const char *var, const char *value,
 
        if (!strcmp(var, "diff.dirstat")) {
                struct strbuf errmsg = STRBUF_INIT;
+               if (!value)
+                       return config_error_nonbool(var);
                default_diff_options.dirstat_permille = diff_dirstat_permille_default;
                if (parse_dirstat_params(&default_diff_options, value, &errmsg))
                        warning(_("Found errors in 'diff.dirstat' config variable:\n%s"),
@@ -4369,7 +4384,8 @@ static void run_external_diff(const char *pgm,
                add_external_diff_name(o->repo, &cmd.args, two);
                if (other) {
                        strvec_push(&cmd.args, other);
-                       strvec_push(&cmd.args, xfrm_msg);
+                       if (xfrm_msg)
+                               strvec_push(&cmd.args, xfrm_msg);
                }
        }
 
index f57ece2757d46ea6dee3af34a476c5fdd9908b0d..49ba38aa7c0a58433380e560f6d84e0cc084a67f 100644 (file)
@@ -2,7 +2,6 @@
  * Copyright (C) 2005 Junio C Hamano
  */
 #include "git-compat-util.h"
-#include "diff.h"
 #include "diffcore.h"
 #include "hash.h"
 #include "object.h"
index c30b56e983bda39e18eda24bb81608ae7a33942c..ba6cbee76ba0180db352d4baf0653af201304046 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "diff.h"
 #include "diffcore.h"
 
 /*
@@ -159,6 +158,10 @@ static struct spanhash_top *hash_chars(struct repository *r,
                n = 0;
                accum1 = accum2 = 0;
        }
+       if (n > 0) {
+               hashval = (accum1 + accum2 * 0x61) % HASHBASE;
+               hash = add_spanhash(hash, hashval, n);
+       }
        QSORT(hash->data, (size_t)1ul << hash->alloc_log2, spanhash_cmp);
        return hash;
 }
diff --git a/dir.c b/dir.c
index 16fdb03f2a51c9505b3cc9da2d9a908f3e4ae119..3e75c126edf3fbe6d18b719f68538c648189fbfb 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -16,7 +16,6 @@
 #include "object-file.h"
 #include "object-store-ll.h"
 #include "path.h"
-#include "attr.h"
 #include "refs.h"
 #include "wildmatch.h"
 #include "pathspec.h"
diff --git a/entry.c b/entry.c
index 076e97eb89ce15e312b6ff08eebd3c1389245997..f918a3a78e8154fb62de1fb2378d100f9c47e9ca 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "blob.h"
 #include "object-store-ll.h"
 #include "dir.h"
 #include "environment.h"
index 9e37bf58c0c6822f48152e5ab59c25a0cf39a874..90632a39bc995af8bf56166b4d89bba5d6dd5272 100644 (file)
@@ -64,7 +64,7 @@ const char *excludes_file;
 enum auto_crlf auto_crlf = AUTO_CRLF_FALSE;
 enum eol core_eol = EOL_UNSET;
 int global_conv_flags_eol = CONV_EOL_RNDTRP_WARN;
-char *check_roundtrip_encoding = "SHIFT-JIS";
+const char *check_roundtrip_encoding = "SHIFT-JIS";
 enum branch_track git_branch_track = BRANCH_TRACK_REMOTE;
 enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
 enum push_default_type push_default = PUSH_DEFAULT_UNSPECIFIED;
index 1d597e84ea7f4c3c8296cbf527bf0c5514037e99..909777f61f4fa3d9d8c51c25db96e8d1f30544ae 100644 (file)
@@ -4,7 +4,6 @@
 #include "exec-cmd.h"
 #include "gettext.h"
 #include "path.h"
-#include "quote.h"
 #include "run-command.h"
 #include "strvec.h"
 #include "trace.h"
index 26999e3b6591313a18df430170aaf935d2e24c14..5b8aa0adc77621504619b831bdd842b83f4867a1 100644 (file)
@@ -10,7 +10,6 @@
 #include "pkt-line.h"
 #include "commit.h"
 #include "tag.h"
-#include "exec-cmd.h"
 #include "pack.h"
 #include "sideband.h"
 #include "fetch-pack.h"
@@ -18,7 +17,6 @@
 #include "run-command.h"
 #include "connect.h"
 #include "trace2.h"
-#include "transport.h"
 #include "version.h"
 #include "oid-array.h"
 #include "oidset.h"
@@ -1862,6 +1860,8 @@ static struct ref *do_fetch_pack_v2(struct fetch_pack_args *args,
 static int fetch_pack_config_cb(const char *var, const char *value,
                                const struct config_context *ctx, void *cb)
 {
+       const char *msg_id;
+
        if (strcmp(var, "fetch.fsck.skiplist") == 0) {
                const char *path;
 
@@ -1873,12 +1873,14 @@ static int fetch_pack_config_cb(const char *var, const char *value,
                return 0;
        }
 
-       if (skip_prefix(var, "fetch.fsck.", &var)) {
-               if (is_valid_msg_type(var, value))
+       if (skip_prefix(var, "fetch.fsck.", &msg_id)) {
+               if (!value)
+                       return config_error_nonbool(var);
+               if (is_valid_msg_type(msg_id, value))
                        strbuf_addf(&fsck_msg_types, "%c%s=%s",
-                               fsck_msg_types.len ? ',' : '=', var, value);
+                               fsck_msg_types.len ? ',' : '=', msg_id, value);
                else
-                       warning("Skipping unknown msg id '%s'", var);
+                       warning("Skipping unknown msg id '%s'", msg_id);
                return 0;
        }
 
index 8c7752fc8212c7f911f9f462a2b306c48022bc2f..6775d265175748d2fccd2b9571c864a6ec091f20 100644 (file)
@@ -2,7 +2,6 @@
 #define FETCH_PACK_H
 
 #include "string-list.h"
-#include "run-command.h"
 #include "protocol.h"
 #include "list-objects-filter-options.h"
 #include "oidset.h"
diff --git a/fsck.c b/fsck.c
index 6a0bbc50877710ff22db33adec48f4a469143c37..1ad02fcdfabea74dc7f3d1c214400516d327a421 100644 (file)
--- a/fsck.c
+++ b/fsck.c
@@ -16,7 +16,6 @@
 #include "refs.h"
 #include "url.h"
 #include "utf8.h"
-#include "decorate.h"
 #include "oidset.h"
 #include "packfile.h"
 #include "submodule-config.h"
@@ -1403,6 +1402,8 @@ int git_fsck_config(const char *var, const char *value,
                    const struct config_context *ctx, void *cb)
 {
        struct fsck_options *options = cb;
+       const char *msg_id;
+
        if (strcmp(var, "fsck.skiplist") == 0) {
                const char *path;
                struct strbuf sb = STRBUF_INIT;
@@ -1416,8 +1417,10 @@ int git_fsck_config(const char *var, const char *value,
                return 0;
        }
 
-       if (skip_prefix(var, "fsck.", &var)) {
-               fsck_set_msg_type(options, var, value);
+       if (skip_prefix(var, "fsck.", &msg_id)) {
+               if (!value)
+                       return config_error_nonbool(var);
+               fsck_set_msg_type(options, msg_id, value);
                return 0;
        }
 
index 673f80d2aad0d4a2e0dff1f7f114f2fc7b5b653c..5cbbec8d940ba75a541dc0398a930f8f393562b6 100644 (file)
@@ -3,9 +3,7 @@
 
 #ifdef HAVE_FSMONITOR_DAEMON_BACKEND
 
-#include "dir.h"
-#include "run-command.h"
-#include "simple-ipc.h"
+#include "hashmap.h"
 #include "thread-utils.h"
 #include "fsmonitor-path-utils.h"
 
index 153918cf768c48f4b9cad799cd728c45a152a8ad..45471b5b741a19515b5d0caea2dd01dd3e9fce25 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "fsmonitor-ll.h"
 #include "gettext.h"
 #include "simple-ipc.h"
 #include "fsmonitor-ipc.h"
index f27e94407b4c2848eecfbd827ee85525ff8c04ed..57facbc21ec2545e5bdeb1e738445ad403f419b4 100644 (file)
--- a/gettext.c
+++ b/gettext.c
@@ -7,9 +7,7 @@
 #include "environment.h"
 #include "exec-cmd.h"
 #include "gettext.h"
-#include "strbuf.h"
 #include "utf8.h"
-#include "config.h"
 
 #ifndef NO_GETTEXT
 #      include <libintl.h>
index b7c173c345544d61a887cfbebb58703478a29d2d..f5a317b89961ce3bd6ec64afa96ae0e550b7e4d0 100755 (executable)
@@ -54,7 +54,7 @@ and can contain multiple, unrelated branches.
 
 =cut
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use Getopt::Std;
index 289d4bc684dc26256f497636ca5c080fc6589226..1e03ba94d1b27196c74636fc643781e2b25577a9 100755 (executable)
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use Getopt::Std;
index 7bf3c12d6789741fc33a9a9032c697bb89dc2fc0..211ec8459a0b84e95e84b0b67ff3c9a7742ad4be 100755 (executable)
@@ -13,7 +13,7 @@
 # The head revision is on branch "origin" by default.
 # You can change that with the '-o' option.
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use Getopt::Long;
@@ -329,7 +329,7 @@ sub conn {
                        # Use a HTTP Proxy. Only works for HTTP proxies that
                        # don't require user authentication
                        #
-                       # See: http://www.ietf.org/rfc/rfc2817.txt
+                       # See: https://www.ietf.org/rfc/rfc2817.txt
 
                        $s = IO::Socket::INET->new(PeerHost => $proxyhost, PeerPort => $proxyport);
                        die "Socket to $proxyhost: $!\n" unless defined $s;
index 7b757360e28c012eb26632889f831c7fef465e16..124f598bdc07058b139f8dcbf8245128c52d9176 100755 (executable)
@@ -15,7 +15,7 @@
 ####
 ####
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use bytes;
index 3e5907a4609b1510aef71ab54f56a82eeb36e071..507fb2b6826cf6ca264290f3a6eb907b8d525c11 100755 (executable)
@@ -24,7 +24,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
-along with this program; if not, see <http://www.gnu.org/licenses/>.}]
+along with this program; if not, see <https://www.gnu.org/licenses/>.}]
 
 ######################################################################
 ##
@@ -2367,7 +2367,7 @@ proc do_quit {{rc {1}}} {
        set ret_code $rc
 
        # Briefly enable send again, working around Tk bug
-       # http://sourceforge.net/tracker/?func=detail&atid=112997&aid=1821174&group_id=12997
+       # https://sourceforge.net/p/tktoolkit/bugs/2343/
        tk appname [appname]
 
        destroy .
@@ -3052,7 +3052,7 @@ if {$doc_path ne {}} {
 if {[file isfile $doc_path]} {
        set doc_url "file:$doc_path"
 } else {
-       set doc_url {http://www.kernel.org/pub/software/scm/git/docs/}
+       set doc_url {https://www.kernel.org/pub/software/scm/git/docs/}
 }
 
 proc start_browser {url} {
index 32668fc9c6debee6de9882719c305392c1e4791a..d2e0fa60c3ba3f770f525a8d01c66f17826aea75 100644 (file)
@@ -3,7 +3,7 @@
 # (Copied from gitk, commit fd8ccbec4f0161)
 
 # This list of encoding names and aliases is distilled from
-# http://www.iana.org/assignments/character-sets.
+# https://www.iana.org/assignments/character-sets.
 # Not all of them are supported by Tcl.
 set encoding_aliases {
     { ANSI_X3.4-1968 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII
index 2514bc22abf4aedfaa8d641976c96fbf222bb8a7..116233100d781a61303c1f63be153e50c52f90a1 100644 (file)
@@ -39,7 +39,7 @@ in your language?
 If you do not know what your language should be named, you need to find
 it.  This currently follows ISO 639-1 two letter codes:
 
-       http://www.loc.gov/standards/iso639-2/php/code_list.php
+       https://www.loc.gov/standards/iso639-2/php/code_list.php
 
 For example, if you are preparing a translation for Afrikaans, the
 language code is "af".  If there already is a translation for your
index c68f49454cd83f48ce3452df178766606effbad9..994431c887277410e50b8a592febf3a1e855469a 100755 (executable)
@@ -432,7 +432,7 @@ mongoose_conf() {
 # Mongoose web server configuration file.
 # Lines starting with '#' and empty lines are ignored.
 # For detailed description of every option, visit
-# http://code.google.com/p/mongoose/wiki/MongooseManual
+# https://code.google.com/p/mongoose/wiki/MongooseManual
 
 root           $root
 ports          $port
@@ -458,7 +458,7 @@ plackup_conf () {
 #!$PERL
 
 # gitweb - simple web interface to track changes in git repositories
-#          PSGI wrapper and server starter (see http://plackperl.org)
+#          PSGI wrapper and server starter (see https://plackperl.org)
 
 use strict;
 
index d24e981d611116aa2fabac09697a4532c8081c00..821b2b3a135ab6f4ab0085ac6acbea1d4eb1c320 100755 (executable)
@@ -16,7 +16,7 @@
 #    and second line is the subject of the message.
 #
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use Getopt::Long;
@@ -119,13 +119,16 @@ sub completion_helper {
 
        foreach my $key (keys %$original_opts) {
                unless (exists $not_for_completion{$key}) {
-                       $key =~ s/!$//;
+                       my $negatable = ($key =~ s/!$//);
 
                        if ($key =~ /[:=][si]$/) {
                                $key =~ s/[:=][si]$//;
                                push (@send_email_opts, "--$_=") foreach (split (/\|/, $key));
                        } else {
                                push (@send_email_opts, "--$_") foreach (split (/\|/, $key));
+                               if ($negatable) {
+                                       push (@send_email_opts, "--no-$_") foreach (split (/\|/, $key));
+                               }
                        }
                }
        }
@@ -228,7 +231,7 @@ sub system_or_msg {
        my @sprintf_args = ($cmd_name ? $cmd_name : $args->[0], $exit_code);
        if (defined $msg) {
                # Quiet the 'redundant' warning category, except we
-               # need to support down to Perl 5.8, so we can't do a
+               # need to support down to Perl 5.8.1, so we can't do a
                # "no warnings 'redundant'", since that category was
                # introduced in perl 5.22, and asking for it will die
                # on older perls.
@@ -491,7 +494,6 @@ my %options = (
                    "bcc=s" => \@getopt_bcc,
                    "no-bcc" => \$no_bcc,
                    "chain-reply-to!" => \$chain_reply_to,
-                   "no-chain-reply-to" => sub {$chain_reply_to = 0},
                    "sendmail-cmd=s" => \$sendmail_cmd,
                    "smtp-server=s" => \$smtp_server,
                    "smtp-server-option=s" => \@smtp_server_options,
@@ -506,36 +508,27 @@ my %options = (
                    "smtp-auth=s" => \$smtp_auth,
                    "no-smtp-auth" => sub {$smtp_auth = 'none'},
                    "annotate!" => \$annotate,
-                   "no-annotate" => sub {$annotate = 0},
                    "compose" => \$compose,
                    "quiet" => \$quiet,
                    "cc-cmd=s" => \$cc_cmd,
                    "header-cmd=s" => \$header_cmd,
                    "no-header-cmd" => \$no_header_cmd,
                    "suppress-from!" => \$suppress_from,
-                   "no-suppress-from" => sub {$suppress_from = 0},
                    "suppress-cc=s" => \@suppress_cc,
                    "signed-off-cc|signed-off-by-cc!" => \$signed_off_by_cc,
-                   "no-signed-off-cc|no-signed-off-by-cc" => sub {$signed_off_by_cc = 0},
-                   "cc-cover|cc-cover!" => \$cover_cc,
-                   "no-cc-cover" => sub {$cover_cc = 0},
-                   "to-cover|to-cover!" => \$cover_to,
-                   "no-to-cover" => sub {$cover_to = 0},
+                   "cc-cover!" => \$cover_cc,
+                   "to-cover!" => \$cover_to,
                    "confirm=s" => \$confirm,
                    "dry-run" => \$dry_run,
                    "envelope-sender=s" => \$envelope_sender,
                    "thread!" => \$thread,
-                   "no-thread" => sub {$thread = 0},
                    "validate!" => \$validate,
-                   "no-validate" => sub {$validate = 0},
                    "transfer-encoding=s" => \$target_xfer_encoding,
                    "format-patch!" => \$format_patch,
-                   "no-format-patch" => sub {$format_patch = 0},
                    "8bit-encoding=s" => \$auto_8bit_encoding,
                    "compose-encoding=s" => \$compose_encoding,
                    "force" => \$force,
                    "xmailer!" => \$use_xmailer,
-                   "no-xmailer" => sub {$use_xmailer = 0},
                    "batch-size=i" => \$batch_size,
                    "relogin-delay=i" => \$relogin_delay,
                    "git-completion-helper" => \$git_completion_helper,
index 4e8878f0357ce0d98ae0675b0cabf5c6efb098b2..b0d0a50984bcea740f9486deda974aa3e53cbe1c 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # Copyright (C) 2006, Eric Wong <normalperson@yhbt.net>
 # License: GPL v2 or later
-use 5.008;
+use 5.008001;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use strict;
 use vars qw/   $AUTHOR $VERSION
index df3ba2ea99b310c3cdcd5c7a8938eef498b3e92e..7a087f123d7563d27a88751f70ead6172441af20 100755 (executable)
@@ -11956,7 +11956,7 @@ proc formatdate {d} {
 }
 
 # This list of encoding names and aliases is distilled from
-# http://www.iana.org/assignments/character-sets.
+# https://www.iana.org/assignments/character-sets.
 # Not all of them are supported by Tcl.
 set encoding_aliases {
     { ANSI_X3.4-1968 iso-ir-6 ANSI_X3.4-1986 ISO_646.irv:1991 ASCII
@@ -12472,7 +12472,7 @@ if {[tk windowingsystem] eq "aqua"} {
 
 catch {
     # follow the XDG base directory specification by default. See
-    # http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
+    # https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
     if {[info exists env(XDG_CONFIG_HOME)] && $env(XDG_CONFIG_HOME) ne ""} {
         # XDG_CONFIG_HOME environment variable is set
         set config_file [file join $env(XDG_CONFIG_HOME) git gitk]
index a58e6b3c44b0ef6175df1417a3ed6f7775bd9953..5bfa4968c4a43193c009045dbd6a6f187a319c76 100644 (file)
@@ -29,7 +29,7 @@ Requirements
 ------------
 
  - Core git tools
- - Perl 5.8
+ - Perl 5.8.1
  - Perl modules: CGI, Encode, Fcntl, File::Find, File::Basename.
  - web server
 
@@ -203,7 +203,7 @@ You can specify the following configuration variables when building GIT:
    created.  [Default: /etc/gitweb.conf]
  * HIGHLIGHT_BIN
    Path to the highlight executable to use (must be the one from
-   http://www.andre-simon.de due to assumptions about parameters and output).
+   http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
    Useful if highlight is not installed on your webserver's PATH.
    [Default: highlight]
 
index e66eb3d9bad7cf627d5ed35e13e32dafb556d5cd..fc6d5dd522bf4f4c9869e4e14ea5a07409155784 100755 (executable)
@@ -7,7 +7,7 @@
 #
 # This program is licensed under the GPLv2
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 # handle ACL in file access tests
@@ -122,9 +122,9 @@ our $favicon = "++GITWEB_FAVICON++";
 our $javascript = "++GITWEB_JS++";
 
 # URI and label (title) of GIT logo link
-#our $logo_url = "http://www.kernel.org/pub/software/scm/git/docs/";
+#our $logo_url = "https://www.kernel.org/pub/software/scm/git/docs/";
 #our $logo_label = "git documentation";
-our $logo_url = "http://git-scm.com/";
+our $logo_url = "https://git-scm.com/";
 our $logo_label = "git homepage";
 
 # source of projects list
@@ -197,7 +197,7 @@ our @diff_opts = ('-M'); # taken from git_commit
 our $prevent_xss = 0;
 
 # Path to the highlight executable to use (must be the one from
-# http://www.andre-simon.de due to assumptions about parameters and output).
+# http://andre-simon.de/zip/download.php due to assumptions about parameters and output).
 # Useful if highlight is not installed on your webserver's PATH.
 # [Default: highlight]
 our $highlight_bin = "++HIGHLIGHT_BIN++";
@@ -269,7 +269,7 @@ our %avatar_size = (
 # Leave it undefined (or set to 'undef') to turn off load checking.
 our $maxload = 300;
 
-# configuration for 'highlight' (http://www.andre-simon.de/)
+# configuration for 'highlight' (http://andre-simon.de/doku/highlight/en/highlight.php)
 # match by basename
 our %highlight_basename = (
        #'Program' => 'py',
@@ -8193,7 +8193,7 @@ sub git_feed {
        my $have_blame = gitweb_check_feature('blame');
 
        # Atom: http://www.atomenabled.org/developers/syndication/
-       # RSS:  http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
+       # RSS:  https://web.archive.org/web/20030729001534/http://www.notestips.com/80256B3A007F2692/1/NAMO5P9UPQ
        if ($format ne 'rss' && $format ne 'atom') {
                die_error(400, "Unknown web feed format");
        }
index 3212601032622fef063f06066bd7131061de36d9..48d2e5101542ad96dcac78aace13d3bbee40d303 100644 (file)
@@ -667,7 +667,7 @@ div.remote {
 }
 
 
-/* Style definition generated by highlight 2.4.5, http://www.andre-simon.de/ */
+/* Style definition generated by highlight 2.4.5, http://andre-simon.de/doku/highlight/en/highlight.php */
 
 /* Highlighting theme definition: */
 
index 018bbb7d4cb72eeb786c3309ba318e7789a02b37..99e3eb8c3d97ae8705ff8e656512479d9f84a90e 100644 (file)
@@ -123,8 +123,8 @@ function addCssRule(selector, style) {
  * NOTE that there are limits and differences compared to native
  * getElementsByClassName as defined by e.g.:
  *   https://developer.mozilla.org/en/DOM/document.getElementsByClassName
- *   http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-getelementsbyclassname
- *   http://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-getelementsbyclassname
+ *   https://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-getelementsbyclassname
+ *   https://www.whatwg.org/specs/web-apps/current-work/multipage/dom.html#dom-document-getelementsbyclassname
  *
  * Namely, this implementation supports only single class name as
  * argument and not set of space-separated tokens representing classes,
@@ -133,11 +133,11 @@ function addCssRule(selector, style) {
  * (via getElementsByTagName).
  *
  * Based on
- *   http://code.google.com/p/getelementsbyclassname/
+ *   https://code.google.com/p/getelementsbyclassname/
  *   http://www.dustindiaz.com/getelementsbyclass/
- *   http://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
+ *   https://stackoverflow.com/questions/1818865/do-we-have-getelementsbyclassname-in-javascript
  *
- * See also http://ejohn.org/blog/getelementsbyclassname-speed-comparison/
+ * See also https://johnresig.com/blog/getelementsbyclassname-speed-comparison/
  *
  * @param {String} class: name of _single_ class to find
  * @param {String} [taghint] limit search to given tags
index 48f43c5a21d34569bdc966eefd652da38003d157..95e764acb14b3e069a255a8261a7d724c5f8d1ad 100644 (file)
@@ -12,7 +12,6 @@
 #include "sigchain.h"
 #include "tempfile.h"
 #include "alias.h"
-#include "environment.h"
 
 static int git_gpg_config(const char *, const char *,
                          const struct config_context *, void *);
@@ -762,23 +761,14 @@ static int git_gpg_config(const char *var, const char *value,
                return 0;
        }
 
-       if (!strcmp(var, "gpg.ssh.defaultkeycommand")) {
-               if (!value)
-                       return config_error_nonbool(var);
+       if (!strcmp(var, "gpg.ssh.defaultkeycommand"))
                return git_config_string(&ssh_default_key_command, var, value);
-       }
 
-       if (!strcmp(var, "gpg.ssh.allowedsignersfile")) {
-               if (!value)
-                       return config_error_nonbool(var);
+       if (!strcmp(var, "gpg.ssh.allowedsignersfile"))
                return git_config_pathname(&ssh_allowed_signers, var, value);
-       }
 
-       if (!strcmp(var, "gpg.ssh.revocationfile")) {
-               if (!value)
-                       return config_error_nonbool(var);
+       if (!strcmp(var, "gpg.ssh.revocationfile"))
                return git_config_pathname(&ssh_revocation_file, var, value);
-       }
 
        if (!strcmp(var, "gpg.program") || !strcmp(var, "gpg.openpgp.program"))
                fmtname = "openpgp";
@@ -1088,7 +1078,7 @@ static int sign_buffer_ssh(struct strbuf *buffer, struct strbuf *signature,
                if (strstr(signer_stderr.buf, "usage:"))
                        error(_("ssh-keygen -Y sign is needed for ssh signing (available in openssh version 8.2p1+)"));
 
-               error("%s", signer_stderr.buf);
+               ret = error("%s", signer_stderr.buf);
                goto out;
        }
 
index 143cdc1c02d4b31fa08f92fbcae1691c80d2c2d6..7cd98161f7f21b5946daa6834617d4876745119f 100644 (file)
@@ -66,7 +66,7 @@ size_t parse_signed_buffer(const char *buf, size_t size);
  * Create a detached signature for the contents of "buffer" and append
  * it after "signature"; "buffer" and "signature" can be the same
  * strbuf instance, which would cause the detached signature appended
- * at the end.
+ * at the end.  Returns 0 on success, non-zero on failure.
  */
 int sign_buffer(struct strbuf *buffer, struct strbuf *signature,
                const char *signing_key);
diff --git a/graph.h b/graph.h
index e88632a0140f70ef25535e23120c898c007b8349..3fd1dcb2e94d4399fc40406f9ec71b319cda0d5f 100644 (file)
--- a/graph.h
+++ b/graph.h
@@ -130,7 +130,7 @@ void graph_setup_line_prefix(struct diff_options *diffopt);
  * This functions must be called BEFORE graph_init() is called.
  *
  * NOTE: This function isn't used in Git outside graph.c but it is used
- * by CGit (http://git.zx2c4.com/cgit/) to use HTML for colors.
+ * by CGit (https://git.zx2c4.com/cgit/) to use HTML for colors.
  */
 void graph_set_column_colors(const char **colors, unsigned short colors_max);
 
@@ -196,7 +196,7 @@ int graph_is_commit_finished(struct git_graph const *graph);
  * graph_update() is called.
  *
  * NOTE: This function isn't used in Git outside graph.c but it is used
- * by CGit (http://git.zx2c4.com/cgit/) to wrap HTML around graph lines.
+ * by CGit (https://git.zx2c4.com/cgit/) to wrap HTML around graph lines.
  */
 int graph_next_line(struct git_graph *graph, struct strbuf *sb);
 
diff --git a/grep.c b/grep.c
index fc2d0c837a378d6a14da32fad69c0f3620447a21..5f23d1a50cabb35732f9515355fe0a85a33d2ff8 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -9,7 +9,6 @@
 #include "xdiff-interface.h"
 #include "diff.h"
 #include "diffcore.h"
-#include "commit.h"
 #include "quote.h"
 #include "help.h"
 
diff --git a/help.c b/help.c
index 6d2ebfbd2a45f134bc45c039cb4cf26b402b8f6c..2dbe57b413b2a8f2e8262fb2c022711aa2d60a2a 100644 (file)
--- a/help.c
+++ b/help.c
@@ -464,8 +464,11 @@ static int get_alias(const char *var, const char *value,
 {
        struct string_list *list = data;
 
-       if (skip_prefix(var, "alias.", &var))
+       if (skip_prefix(var, "alias.", &var)) {
+               if (!value)
+                       return config_error_nonbool(var);
                string_list_append(list, var)->util = xstrdup(value);
+       }
 
        return 0;
 }
index fffda592670e667e81eb92af218f9a4d95d7614d..bec94988bbe563a5048c6dd5905f1a9827193489 100644 (file)
@@ -1,12 +1,12 @@
 #include "git-compat-util.h"
 #include "config.h"
-#include "exec-cmd.h"
 #include "gettext.h"
 #include "hex.h"
 #include "http.h"
 #include "walker.h"
 #include "setup.h"
 #include "strvec.h"
+#include "url.h"
 #include "urlmatch.h"
 #include "trace2.h"
 
index a704f490fdb2c2144b47a5629ed9ee0643ab0d83..b4d0b2a6aa381f4edb1bd890de4a4be1d10ab8fb 100644 (file)
@@ -6,10 +6,8 @@
 #include "tag.h"
 #include "blob.h"
 #include "http.h"
-#include "refs.h"
 #include "diff.h"
 #include "revision.h"
-#include "exec-cmd.h"
 #include "remote.h"
 #include "list-objects.h"
 #include "setup.h"
@@ -17,6 +15,7 @@
 #include "strvec.h"
 #include "tree.h"
 #include "tree-walk.h"
+#include "url.h"
 #include "packfile.h"
 #include "object-store-ll.h"
 #include "commit-reach.h"
index 78d99f7c4b002cb95196800a62a1de8fbcce6cea..b395ef13279eaa3f672e36512a7816fee209abf9 100644 (file)
@@ -1,6 +1,5 @@
 #include "git-compat-util.h"
 #include "repository.h"
-#include "commit.h"
 #include "hex.h"
 #include "walker.h"
 #include "http.h"
diff --git a/http.c b/http.c
index 8f71bf00d8998af44e177a86d73dbc86872c9726..e73b136e5897bd8fce2f874b20f316141ba59c31 100644 (file)
--- a/http.c
+++ b/http.c
@@ -4,7 +4,6 @@
 #include "http.h"
 #include "config.h"
 #include "pack.h"
-#include "sideband.h"
 #include "run-command.h"
 #include "url.h"
 #include "urlmatch.h"
@@ -15,7 +14,6 @@
 #include "trace.h"
 #include "transport.h"
 #include "packfile.h"
-#include "protocol.h"
 #include "string-list.h"
 #include "object-file.h"
 #include "object-store-ll.h"
@@ -1902,7 +1900,7 @@ static void write_accept_language(struct strbuf *buf)
         * MAX_DECIMAL_PLACES must not be larger than 3. If it is larger than
         * that, q-value will be smaller than 0.001, the minimum q-value the
         * HTTP specification allows. See
-        * http://tools.ietf.org/html/rfc7231#section-5.3.1 for q-value.
+        * https://datatracker.ietf.org/doc/html/rfc7231#section-5.3.1 for q-value.
         */
        const int MAX_DECIMAL_PLACES = 3;
        const int MAX_LANGUAGE_TAGS = 1000;
diff --git a/http.h b/http.h
index 3a409bccd4e6197874a97629c36b050ca923b944..3af19a8bf53e0550fa7c877bb661c34463283adf 100644 (file)
--- a/http.h
+++ b/http.h
@@ -10,7 +10,6 @@ struct packed_git;
 
 #include "strbuf.h"
 #include "remote.h"
-#include "url.h"
 
 #define DEFAULT_MAX_REQUESTS 5
 
index 996651e4f80abd5fa2daf570f9d981934d328aeb..f2e1947e63815c80e45f648f0ce37cd6341f825b 100644 (file)
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *  along with this program; if not, see <https://www.gnu.org/licenses/>.
  */
 
 #include "git-compat-util.h"
 #include "config.h"
 #include "credential.h"
-#include "exec-cmd.h"
 #include "gettext.h"
 #include "run-command.h"
 #include "parse-options.h"
@@ -860,7 +859,7 @@ static void imap_close_store(struct imap_store *ctx)
 
 /*
  * hexchar() and cram() functions are based on the code from the isync
- * project (http://isync.sf.net/).
+ * project (https://isync.sourceforge.io/).
  */
 static char hexchar(unsigned int b)
 {
@@ -1346,7 +1345,7 @@ static int git_imap_config(const char *var, const char *val,
                server.port = git_config_int(var, val, ctx->kvi);
        else if (!strcmp("imap.host", var)) {
                if (!val) {
-                       git_die_config("imap.host", "Missing value for 'imap.host'");
+                       return config_error_nonbool(var);
                } else {
                        if (starts_with(val, "imap:"))
                                val += 5;
index 209355e0f12ce296c120b5e5b9f1651a2daf311f..04413bd1afda5d6693d5dfec2e96645557e1bb45 100644 (file)
@@ -3,8 +3,8 @@
 
 /*
  * JSON data structures are defined at:
- * [1] http://www.ietf.org/rfc/rfc7159.txt
- * [2] http://json.org/
+ * [1] https://www.ietf.org/rfc/rfc7159.txt
+ * [2] https://www.json.org/
  *
  * The JSON-writer API allows one to build JSON data structures using a
  * simple wrapper around a "struct strbuf" buffer.  It is intended as a
diff --git a/kwset.c b/kwset.c
index bbfcf815a567b053bd0206ddb7bb38d138731bd1..695e47b7ccfaf1aaa0e866933dffa8b7fcc51868 100644 (file)
--- a/kwset.c
+++ b/kwset.c
@@ -18,7 +18,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>. */
+   along with this program; if not, see <https://www.gnu.org/licenses/>. */
 
 /* Written August 1989 by Mike Haertel.
    The author may be reached (Email) at the address mike@ai.mit.edu,
diff --git a/kwset.h b/kwset.h
index d42a793a301cb6d7ba758a5d592516cdf9d8444f..c722664e5a7eeef9900a86738a5553b3eace49fc 100644 (file)
--- a/kwset.h
+++ b/kwset.h
@@ -20,7 +20,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>. */
+   along with this program; if not, see <https://www.gnu.org/licenses/>. */
 
 /* Written August 1989 by Mike Haertel.
    The author may be reached (Email) at the address mike@ai.mit.edu,
index 24a1ecb67799c23570ef485bc382b4bbdf2779d2..8ff6ccb77241fd249f58827ecc1add65356648a4 100644 (file)
@@ -1,8 +1,8 @@
 #include "git-compat-util.h"
+#include "diffcore.h"
 #include "line-range.h"
 #include "hex.h"
 #include "tag.h"
-#include "blob.h"
 #include "tree.h"
 #include "diff.h"
 #include "commit.h"
@@ -12,8 +12,6 @@
 #include "xdiff-interface.h"
 #include "strbuf.h"
 #include "log-tree.h"
-#include "graph.h"
-#include "userdiff.h"
 #include "line-log.h"
 #include "setup.h"
 #include "strvec.h"
index 4291da8d79235d1f477742a11a5fdb67a4346e2e..e9dadbc1a58e2c657511b03f289994143b62bbfb 100644 (file)
@@ -1,8 +1,6 @@
 #ifndef LINE_LOG_H
 #define LINE_LOG_H
 
-#include "diffcore.h"
-
 struct rev_info;
 struct commit;
 struct string_list;
index 47bf0d6f1a253a01baf6e3d0f68dfa5d5df6a0f0..60f0e5ada81967d3743ef866438aaf9b8efdc497 100644 (file)
@@ -1,7 +1,6 @@
 #include "git-compat-util.h"
 #include "line-range.h"
 #include "xdiff-interface.h"
-#include "strbuf.h"
 #include "userdiff.h"
 
 /*
index 8a08b7af49c1ff7750296508102bf67807027bea..c5f363ca6f729ace28756467470e56363fad7a1e 100644 (file)
@@ -1,11 +1,6 @@
 #include "git-compat-util.h"
-#include "commit.h"
 #include "config.h"
 #include "gettext.h"
-#include "revision.h"
-#include "strvec.h"
-#include "list-objects.h"
-#include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "promisor-remote.h"
 #include "trace.h"
index 9327ccd5057cb6fffc9fcd9a92f2939a50b50253..da287cc8e0dd2935cb230dd256d5f268495ed40f 100644 (file)
@@ -2,14 +2,9 @@
 #include "dir.h"
 #include "gettext.h"
 #include "hex.h"
-#include "tag.h"
 #include "commit.h"
-#include "tree.h"
-#include "blob.h"
 #include "diff.h"
-#include "tree-walk.h"
 #include "revision.h"
-#include "list-objects.h"
 #include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "oidmap.h"
diff --git a/list.h b/list.h
index 362a4cd7f5f10f17f174086911dc30e60e07e6ec..98428010f4d131580f8d3fa640efc6a10651a35b 100644 (file)
--- a/list.h
+++ b/list.h
@@ -19,7 +19,7 @@
  *
  * You should have received a copy of the GNU Lesser General Public
  * License along with this library; if not, see
- * <http://www.gnu.org/licenses/>.
+ * <https://www.gnu.org/licenses/>.
  */
 
 #ifndef LIST_H
index 504da6b519edff523bd542d07684a4c27a6c10bb..337b9334cdbafe0d3ffd2bf2fd36898f6d112410 100644 (file)
@@ -2,6 +2,7 @@
 #include "commit-reach.h"
 #include "config.h"
 #include "diff.h"
+#include "diffcore.h"
 #include "environment.h"
 #include "hex.h"
 #include "object-name.h"
index 0e49b932c308b24a5654910d5e0197cf1388162e..819cbefee3de07c7cb7f8f92e1fd715b1b2f7af6 100644 (file)
--- a/ls-refs.c
+++ b/ls-refs.c
@@ -5,7 +5,6 @@
 #include "hex.h"
 #include "repository.h"
 #include "refs.h"
-#include "remote.h"
 #include "strvec.h"
 #include "ls-refs.h"
 #include "pkt-line.h"
index a07d2da16dedb2779a9797cfa185ec29d9321491..94b9b0abf228b891bc1df5a71bcd96807ed982a8 100644 (file)
@@ -58,12 +58,13 @@ static void parse_bogus_from(struct mailinfo *mi, const struct strbuf *line)
 
 static const char *unquote_comment(struct strbuf *outbuf, const char *in)
 {
-       int c;
        int take_next_literally = 0;
+       int depth = 1;
 
        strbuf_addch(outbuf, '(');
 
-       while ((c = *in++) != 0) {
+       while (*in) {
+               int c = *in++;
                if (take_next_literally == 1) {
                        take_next_literally = 0;
                } else {
@@ -72,11 +73,14 @@ static const char *unquote_comment(struct strbuf *outbuf, const char *in)
                                take_next_literally = 1;
                                continue;
                        case '(':
-                               in = unquote_comment(outbuf, in);
+                               strbuf_addch(outbuf, '(');
+                               depth++;
                                continue;
                        case ')':
                                strbuf_addch(outbuf, ')');
-                               return in;
+                               if (!--depth)
+                                       return in;
+                               continue;
                        }
                }
 
@@ -88,10 +92,10 @@ static const char *unquote_comment(struct strbuf *outbuf, const char *in)
 
 static const char *unquote_quoted_string(struct strbuf *outbuf, const char *in)
 {
-       int c;
        int take_next_literally = 0;
 
-       while ((c = *in++) != 0) {
+       while (*in) {
+               int c = *in++;
                if (take_next_literally == 1) {
                        take_next_literally = 0;
                } else {
@@ -1253,6 +1257,8 @@ static int git_mailinfo_config(const char *var, const char *value,
                return 0;
        }
        if (!strcmp(var, "mailinfo.quotedcr")) {
+               if (!value)
+                       return config_error_nonbool(var);
                if (mailinfo_parse_quoted_cr_action(value, &mi->quoted_cr) != 0)
                        return error(_("bad action '%s' for '%s'"), value, var);
                return 0;
index 9293cbf75c8ab737a2cf7267d3e31ffd93a48dc8..2f659fd01432d4249d1d2be1876f0edfd8c9cd09 100644 (file)
@@ -1,6 +1,4 @@
 #include "git-compat-util.h"
-#include "run-command.h"
-#include "xdiff-interface.h"
 #include "merge-ll.h"
 #include "blob.h"
 #include "merge-blobs.h"
index 8fcf2d3710ed1a87bd851abe04dd22a32fafdf84..1df58ebaac08582d042268f5a07cf5cbd9d7b1c3 100644 (file)
@@ -301,7 +301,7 @@ static int read_merge_config(const char *var, const char *value,
 
        if (!strcmp("driver", key)) {
                if (!value)
-                       return error("%s: lacks value", var);
+                       return config_error_nonbool(var);
                /*
                 * merge.<name>.driver specifies the command line:
                 *
index 6491070d965835f9202b68fbdae72cb6cd6c987f..cb83449d7f7340eaf5969256fe4fdc9d09911c64 100644 (file)
@@ -19,7 +19,6 @@
 
 #include "alloc.h"
 #include "attr.h"
-#include "blob.h"
 #include "cache-tree.h"
 #include "commit.h"
 #include "commit-reach.h"
@@ -42,8 +41,6 @@
 #include "revision.h"
 #include "sparse-index.h"
 #include "strmap.h"
-#include "submodule-config.h"
-#include "submodule.h"
 #include "trace2.h"
 #include "tree.h"
 #include "unpack-trees.h"
@@ -2644,7 +2641,7 @@ static void apply_directory_rename_modifications(struct merge_options *opt,
                        oidcpy(&ci->stages[i].oid, null_oid());
                }
 
-               // Now we want to focus on new_ci, so reassign ci to it
+               /* Now we want to focus on new_ci, so reassign ci to it. */
                ci = new_ci;
        }
 
index e3beb0801b115691d84b5da3403bc52abcb97336..a0c3e7a2d9105dd895f0ae2613d0f87f00b8d794 100644 (file)
@@ -6,10 +6,7 @@
 #include "git-compat-util.h"
 #include "merge-recursive.h"
 
-#include "advice.h"
 #include "alloc.h"
-#include "attr.h"
-#include "blob.h"
 #include "cache-tree.h"
 #include "commit.h"
 #include "commit-reach.h"
@@ -32,8 +29,6 @@
 #include "revision.h"
 #include "sparse-index.h"
 #include "string-list.h"
-#include "submodule-config.h"
-#include "submodule.h"
 #include "symlinks.h"
 #include "tag.h"
 #include "tree-walk.h"
diff --git a/merge.c b/merge.c
index b60925459c292bbb4a9daae46534edfbb3eca756..ca89b312d173530f8c8a1e5d07470b9d2404e9d4 100644 (file)
--- a/merge.c
+++ b/merge.c
@@ -1,6 +1,4 @@
 #include "git-compat-util.h"
-#include "diff.h"
-#include "diffcore.h"
 #include "gettext.h"
 #include "hash.h"
 #include "hex.h"
@@ -13,7 +11,6 @@
 #include "tree.h"
 #include "tree-walk.h"
 #include "unpack-trees.h"
-#include "dir.h"
 
 static const char *merge_argument(struct commit *commit)
 {
diff --git a/midx.h b/midx.h
index a5d98919c857b812789f44d86fb6ad13fb7e0560..eb57a37519ce018fdd7aa9ba0d9d6c11003d5452 100644 (file)
--- a/midx.h
+++ b/midx.h
@@ -1,7 +1,6 @@
 #ifndef MIDX_H
 #define MIDX_H
 
-#include "repository.h"
 #include "string-list.h"
 
 struct object_id;
index de39028ab7f88058c87f735a79185da2f3b5e749..65e3c200084aa4a198145e2433ad6055425ae2fa 100644 (file)
@@ -1,6 +1,5 @@
 #include "git-compat-util.h"
 #include "noop.h"
-#include "../commit.h"
 #include "../fetch-negotiator.h"
 
 static void known_common(struct fetch_negotiator *n UNUSED,
index 97c031c26ec7c7c2fdade8478fa039d470820bad..6197a5a4556400603ed7e669d5cccb0db4089e21 100644 (file)
@@ -5,7 +5,6 @@
 #include "gettext.h"
 #include "refs.h"
 #include "notes-utils.h"
-#include "repository.h"
 #include "strbuf.h"
 
 void create_notes_commit(struct repository *r,
@@ -112,6 +111,8 @@ static int notes_rewrite_config(const char *k, const char *v,
                }
                return 0;
        } else if (!c->refs_from_env && !strcmp(k, "notes.rewriteref")) {
+               if (!v)
+                       return config_error_nonbool(k);
                /* note that a refs/ prefix is implied in the
                 * underlying for_each_glob_ref */
                if (starts_with(v, "refs/notes/"))
diff --git a/notes.c b/notes.c
index 1ef2a331ce9302e58cb2078e58b7b40a94972b3e..fed1eda80cd7e41a2e21af26aed81e1dd472b27c 100644 (file)
--- a/notes.c
+++ b/notes.c
@@ -5,8 +5,6 @@
 #include "notes.h"
 #include "object-name.h"
 #include "object-store-ll.h"
-#include "blob.h"
-#include "tree.h"
 #include "utf8.h"
 #include "strbuf.h"
 #include "tree-walk.h"
index 7c7afe5793641c06b10dee6f1f6735a1a476c7d9..619f039ebc7ceb52467e4810c5c4cf3afabb907a 100644 (file)
 #include "hex.h"
 #include "string-list.h"
 #include "lockfile.h"
-#include "delta.h"
 #include "pack.h"
-#include "blob.h"
 #include "commit.h"
 #include "run-command.h"
-#include "tag.h"
-#include "tree.h"
-#include "tree-walk.h"
 #include "refs.h"
-#include "pack-revindex.h"
-#include "hash-lookup.h"
 #include "bulk-checkin.h"
 #include "repository.h"
 #include "replace-object.h"
 #include "streaming.h"
 #include "dir.h"
 #include "list.h"
-#include "mergesort.h"
 #include "quote.h"
 #include "packfile.h"
 #include "object-file.h"
index 0bfa29dbbfe9b489e454c03b419092294427425d..3a2ef5d6800173fa669bdfcb2612bf21a7c6417a 100644 (file)
@@ -8,7 +8,6 @@
 #include "tag.h"
 #include "commit.h"
 #include "tree.h"
-#include "blob.h"
 #include "tree-walk.h"
 #include "refs.h"
 #include "remote.h"
@@ -21,7 +20,6 @@
 #include "read-cache-ll.h"
 #include "repository.h"
 #include "setup.h"
-#include "submodule.h"
 #include "midx.h"
 #include "commit-reach.h"
 #include "date.h"
index f4ecdf8b0e3581cb6d92d0b88832c37adf749dc1..be4733e3bdcff59c135569d696b72e1451e53898 100644 (file)
@@ -4,12 +4,9 @@
 #include "hex.h"
 #include "object-store-ll.h"
 #include "commit.h"
-#include "tag.h"
 #include "diff.h"
 #include "revision.h"
-#include "list-objects.h"
 #include "progress.h"
-#include "pack-revindex.h"
 #include "pack.h"
 #include "pack-bitmap.h"
 #include "hash-lookup.h"
index 977f619618e0a9b97044f0b07e5617d3b3e1839b..25104d5b14c1e8f9a9988f106a1ad1a6823ca31c 100644 (file)
@@ -3,7 +3,6 @@
 #include "hex.h"
 #include "repository.h"
 #include "pack.h"
-#include "pack-revindex.h"
 #include "progress.h"
 #include "packfile.h"
 #include "object-file.h"
index b19ddf15b284868acd7ad9123aed8fba10d08d30..80ecfa544c5d9f7980adfad829e32cabd281ecc4 100644 (file)
@@ -7,7 +7,6 @@
 #include "remote.h"
 #include "chunk-format.h"
 #include "pack-mtimes.h"
-#include "oidmap.h"
 #include "pack-objects.h"
 #include "pack-revindex.h"
 #include "path.h"
index 9cc0a2e37a83dd38c2fe1b26d34cfb5fea983bc7..84a005674d8749407afffc1f6fd670501ce764d4 100644 (file)
@@ -9,7 +9,6 @@
 #include "mergesort.h"
 #include "packfile.h"
 #include "delta.h"
-#include "streaming.h"
 #include "hash-lookup.h"
 #include "commit.h"
 #include "object.h"
index c3692308b8dc866b2b99b2ed9b983db4d6d1352b..28c8fd3e39a23ae997a66a11dfd0d5d281dbc28f 100644 (file)
@@ -54,7 +54,7 @@ const char *pack_basename(struct packed_git *p);
 struct packed_git *parse_pack_index(unsigned char *sha1, const char *idx_path);
 
 typedef void each_file_in_pack_dir_fn(const char *full_path, size_t full_path_len,
-                                     const char *file_pach, void *data);
+                                     const char *file_name, void *data);
 void for_each_file_in_pack_dir(const char *objdir,
                               each_file_in_pack_dir_fn fn,
                               void *data);
index e0c94b0546b5487c5b324c4c2b76d668289e8b10..63a99dea6ef06b19bbb679a3ddd76087abc2a028 100644 (file)
@@ -2,8 +2,6 @@
 #include "parse-options.h"
 #include "abspath.h"
 #include "parse.h"
-#include "commit.h"
-#include "color.h"
 #include "gettext.h"
 #include "strbuf.h"
 #include "string-list.h"
@@ -279,7 +277,8 @@ static enum parse_opt_result get_value(struct parse_opt_ctx_t *p,
 
        opt_name = optnamearg(opt, arg, flags);
        other_opt_name = optnamearg(elem->opt, elem->arg, elem->flags);
-       error(_("%s is incompatible with %s"), opt_name, other_opt_name);
+       error(_("options '%s' and '%s' cannot be used together"),
+             opt_name, other_opt_name);
        free(opt_name);
        free(other_opt_name);
        return -1;
@@ -358,6 +357,7 @@ static enum parse_opt_result parse_long_opt(
        const char *arg_end = strchrnul(arg, '=');
        const struct option *abbrev_option = NULL, *ambiguous_option = NULL;
        enum opt_parsed abbrev_flags = OPT_LONG, ambiguous_flags = OPT_LONG;
+       int allow_abbrev = !(p->flags & PARSE_OPT_KEEP_UNKNOWN_OPT);
 
        for (; options->type != OPTION_END; options++) {
                const char *rest, *long_name = options->long_name;
@@ -368,12 +368,16 @@ static enum parse_opt_result parse_long_opt(
                if (!long_name)
                        continue;
 
-again:
+               if (!starts_with(arg, "no-") &&
+                   !(options->flags & PARSE_OPT_NONEG) &&
+                   skip_prefix(long_name, "no-", &long_name))
+                       opt_flags |= OPT_UNSET;
+
                if (!skip_prefix(arg, long_name, &rest))
                        rest = NULL;
                if (!rest) {
                        /* abbreviated? */
-                       if (!(p->flags & PARSE_OPT_KEEP_UNKNOWN_OPT) &&
+                       if (allow_abbrev &&
                            !strncmp(long_name, arg, arg_end - arg)) {
 is_abbreviated:
                                if (abbrev_option &&
@@ -397,22 +401,18 @@ is_abbreviated:
                        if (options->flags & PARSE_OPT_NONEG)
                                continue;
                        /* negated and abbreviated very much? */
-                       if (starts_with("no-", arg)) {
+                       if (allow_abbrev && starts_with("no-", arg)) {
                                flags |= OPT_UNSET;
                                goto is_abbreviated;
                        }
                        /* negated? */
-                       if (!starts_with(arg, "no-")) {
-                               if (skip_prefix(long_name, "no-", &long_name)) {
-                                       opt_flags |= OPT_UNSET;
-                                       goto again;
-                               }
+                       if (!starts_with(arg, "no-"))
                                continue;
-                       }
                        flags |= OPT_UNSET;
                        if (!skip_prefix(arg + 3, long_name, &rest)) {
                                /* abbreviated and negated? */
-                               if (starts_with(long_name, arg + 3))
+                               if (allow_abbrev &&
+                                   starts_with(long_name, arg + 3))
                                        goto is_abbreviated;
                                else
                                        continue;
@@ -929,13 +929,18 @@ enum parse_opt_result parse_options_step(struct parse_opt_ctx_t *ctx,
                        continue;
                }
 
-               if (!arg[2] /* "--" */ ||
-                   !strcmp(arg + 2, "end-of-options")) {
+               if (!arg[2] /* "--" */) {
                        if (!(ctx->flags & PARSE_OPT_KEEP_DASHDASH)) {
                                ctx->argc--;
                                ctx->argv++;
                        }
                        break;
+               } else if (!strcmp(arg + 2, "end-of-options")) {
+                       if (!(ctx->flags & PARSE_OPT_KEEP_UNKNOWN_OPT)) {
+                               ctx->argc--;
+                               ctx->argv++;
+                       }
+                       break;
                }
 
                if (internal_help && !strcmp(arg + 2, "help-all"))
index c3e1a0dd216c80c92c47f0e2a98d74a57c422742..a5683b462c6e7692ceff3218213b9747a9b6cc02 100644 (file)
@@ -2,7 +2,6 @@
 #include "diff.h"
 #include "commit.h"
 #include "hash.h"
-#include "hash-lookup.h"
 #include "hex.h"
 #include "patch-ids.h"
 
index d82b71325c6bd492cd7eb0f703b00fa6634c627d..5b97e0315d6f16c9a215b387fb587dba1074bd23 100644 (file)
@@ -1025,7 +1025,7 @@ C<:warndie> handlers added by Paul Evans <leonerd@leonerd.org.uk>
 
 =head1 MAINTAINER
 
-Shlomi Fish, L<http://www.shlomifish.org/> .
+Shlomi Fish, L<https://www.shlomifish.org/> .
 
 =head1 PAST MAINTAINERS
 
index 117765dc73c4a8c30bfbcf9b3b37bad6b26a9ede..03bf570bf4c852932973f3a6815c2d3dd4802622 100644 (file)
@@ -7,7 +7,7 @@ Git - Perl interface to the Git version control system
 
 package Git;
 
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 
index 895e759c57a9d9c76d677299ff4658796e2930af..5454c3a6d2c433c1456c0d6151c50746e8f2fad4 100644 (file)
@@ -1,5 +1,5 @@
 package Git::I18N;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 BEGIN {
index 0c360bc799860798ade6b2afce6e05b0a567d21f..8c7fa805f97390a47366b0d0058966ee391b9df1 100644 (file)
@@ -1,5 +1,5 @@
 package Git::LoadCPAN;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 
index 5d84c202884b7cb7cea576ea1a6f146b2e653ae2..5cecb0fcd6930a1806aafdaacee9312aa7e8212e 100644 (file)
@@ -1,5 +1,5 @@
 package Git::LoadCPAN::Error;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use Git::LoadCPAN (
index 340e88a7a56be37af8b1f437c92ecb52b1b29089..9f808090a66a16c02eba9c5ed84669ec03f1b944 100644 (file)
@@ -1,5 +1,5 @@
 package Git::LoadCPAN::Mail::Address;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 use Git::LoadCPAN (
index d144f5168f37adaf54a2f9b768f04ad2a1c20196..d896e6952399b0fa92b249144d61fcd58d2aab67 100644 (file)
@@ -1,5 +1,5 @@
 package Git::Packet;
-use 5.008;
+use 5.008001;
 use strict;
 use warnings $ENV{GIT_PERL_FATAL_WARNINGS} ? qw(FATAL all) : ();
 BEGIN {
index 6ce2e283c8d18b3de72cbec12957ebd532d25333..7721708ce5d7f6560ba9f84706e9ad840664020a 100644 (file)
@@ -1752,7 +1752,7 @@ sub tie_for_persistent_memoization {
 END {
        # Force cache writeout explicitly instead of waiting for
        # global destruction to avoid segfault in Storable:
-       # http://rt.cpan.org/Public/Bug/Display.html?id=36087
+       # https://rt.cpan.org/Public/Bug/Display.html?id=36087
        unmemoize_svn_mergeinfo_functions();
 }
 
index af83a19f4df5537da9f1c7a87ea29cb2f5903ea2..24479eae4dbe2a44b15a10f86b15bfc6f865bb34 100644 (file)
@@ -4,6 +4,7 @@
 #include "gettext.h"
 #include "hex.h"
 #include "run-command.h"
+#include "sideband.h"
 #include "trace.h"
 #include "write-or-die.h"
 
@@ -462,8 +463,32 @@ enum packet_read_status packet_read_with_status(int fd, char **src_buffer,
        }
 
        if ((options & PACKET_READ_CHOMP_NEWLINE) &&
-           len && buffer[len-1] == '\n')
-               len--;
+           len && buffer[len-1] == '\n') {
+               if (options & PACKET_READ_USE_SIDEBAND) {
+                       int band = *buffer & 0xff;
+                       switch (band) {
+                       case 1:
+                               /* Chomp newline for payload */
+                               len--;
+                               break;
+                       case 2:
+                       case 3:
+                               /*
+                                * Do not chomp newline for progress and error
+                                * message.
+                                */
+                               break;
+                       default:
+                               /*
+                                * Bad sideband, let's leave it to
+                                * demultiplex_sideband() to catch this error.
+                                */
+                               break;
+                       }
+               } else {
+                       len--;
+               }
+       }
 
        buffer[len] = 0;
        if (options & PACKET_READ_REDACT_URI_PATH &&
@@ -592,17 +617,19 @@ void packet_reader_init(struct packet_reader *reader, int fd,
        reader->options = options;
        reader->me = "git";
        reader->hash_algo = &hash_algos[GIT_HASH_SHA1];
+       strbuf_init(&reader->scratch, 0);
 }
 
 enum packet_read_status packet_reader_read(struct packet_reader *reader)
 {
-       struct strbuf scratch = STRBUF_INIT;
-
        if (reader->line_peeked) {
                reader->line_peeked = 0;
                return reader->status;
        }
 
+       if (reader->use_sideband)
+               reader->options |= PACKET_READ_USE_SIDEBAND;
+
        /*
         * Consume all progress packets until a primary payload packet is
         * received
@@ -620,7 +647,7 @@ enum packet_read_status packet_reader_read(struct packet_reader *reader)
                        break;
                if (demultiplex_sideband(reader->me, reader->status,
                                         reader->buffer, reader->pktlen, 1,
-                                        &scratch, &sideband_type))
+                                        &reader->scratch, &sideband_type))
                        break;
        }
 
index 954eec87197d3e0c50812879d47e0afbb008baa3..3b33cc64f34dcc3447f6a6f42f12451dbc1a77a9 100644 (file)
@@ -2,7 +2,6 @@
 #define PKTLINE_H
 
 #include "strbuf.h"
-#include "sideband.h"
 
 /*
  * Write a packetized stream, where each line is preceded by
@@ -85,6 +84,7 @@ void packet_fflush(FILE *f);
 #define PACKET_READ_DIE_ON_ERR_PACKET    (1u<<2)
 #define PACKET_READ_GENTLE_ON_READ_ERROR (1u<<3)
 #define PACKET_READ_REDACT_URI_PATH      (1u<<4)
+#define PACKET_READ_USE_SIDEBAND         (1u<<5)
 int packet_read(int fd, char *buffer, unsigned size, int options);
 
 /*
@@ -194,6 +194,9 @@ struct packet_reader {
 
        /* hash algorithm in use */
        const struct git_hash_algo *hash_algo;
+
+       /* hold temporary sideband message */
+       struct strbuf scratch;
 };
 
 /*
index 808a68c974ab7715513657c62d238aae8d3af07f..75f4cbb0a70951a85c8e5a4dba853f027ee7cf4b 100644 (file)
@@ -3,7 +3,6 @@
 #include "gettext.h"
 #include "hex.h"
 #include "pkt-line.h"
-#include "strvec.h"
 #include "hash-ll.h"
 #include "hex.h"
 #include "object.h"
index de66bf80f8409370069fed46ce97dadb25519d7d..1e574bbd80be1bf9d9366dfefd24e3016ec87cf0 100644 (file)
@@ -18,7 +18,7 @@
  * with Linus Torvalds <torvalds@osdl.org> as the point of
  * contact. September 2005.
  *
- * See http://www.iana.org/assignments/port-numbers
+ * See https://www.iana.org/assignments/port-numbers
  */
 #define DEFAULT_GIT_PORT 9418
 
index 0ce8f83e56a9b42400b8ec792b19deb3a69ddb6e..f29b06a5d059e23030333f26d5ba0667872251ab 100644 (file)
@@ -2,7 +2,6 @@
 #include "gettext.h"
 #include "hex.h"
 #include "refs.h"
-#include "tag.h"
 #include "commit.h"
 #include "blob.h"
 #include "diff.h"
index 080bd39713bc1782434b7212954e6bc590fa4d6d..08970caff7cd08112db8838465e953d6c8380d1b 100644 (file)
@@ -20,7 +20,6 @@
 #include "oid-array.h"
 #include "tree.h"
 #include "commit.h"
-#include "blob.h"
 #include "environment.h"
 #include "gettext.h"
 #include "mem-pool.h"
@@ -31,7 +30,6 @@
 #include "read-cache.h"
 #include "resolve-undo.h"
 #include "revision.h"
-#include "run-command.h"
 #include "strbuf.h"
 #include "trace2.h"
 #include "varint.h"
index e4d3510e28e15a7ff967737f08a8c1acadb588e1..0ac3fca67da00956896dffada6a2a37d4870800f 100644 (file)
 #include "ref-filter.h"
 #include "revision.h"
 #include "utf8.h"
-#include "version.h"
 #include "versioncmp.h"
 #include "trailer.h"
 #include "wt-status.h"
 #include "commit-slab.h"
-#include "commit-graph.h"
 #include "commit-reach.h"
 #include "worktree.h"
 #include "hashmap.h"
-#include "strvec.h"
 
 static struct ref_msg {
        const char *gone;
@@ -2212,7 +2209,7 @@ char *get_head_description(void)
                                    state.detached_from);
        } else if (state.bisect_in_progress)
                strbuf_addf(&desc, _("(no branch, bisect started on %s)"),
-                           state.branch);
+                           state.bisecting_from);
        else if (state.detached_from) {
                if (state.detached_at)
                        strbuf_addf(&desc, _("(HEAD detached at %s)"),
index 1524bc463a5701d475cb68e50caa884a6daf890a..4ecb6ab1c6039ebca47ec6d7bfaee22a94d5e9f0 100644 (file)
@@ -3,7 +3,6 @@
 
 #include "gettext.h"
 #include "oid-array.h"
-#include "refs.h"
 #include "commit.h"
 #include "string-list.h"
 #include "strvec.h"
index 9ad50e7d93e40c7a5f9c7ad0cecb0b7d1766105b..0a1bc35e8cd2c82771c0272dcdc08f8b99ba73e7 100644 (file)
--- a/reflog.c
+++ b/reflog.c
@@ -6,7 +6,6 @@
 #include "revision.h"
 #include "tree.h"
 #include "tree-walk.h"
-#include "worktree.h"
 
 /* Remember to update object flag allocation in object.h */
 #define INCOMPLETE     (1u<<10)
diff --git a/refs.h b/refs.h
index 23211a5ea1cabbb0a35d091bf2b5dbbd87e28252..ff113bb12a2512c8f2caf9f0bd8e1e471490a5c0 100644 (file)
--- a/refs.h
+++ b/refs.h
@@ -56,7 +56,7 @@ struct worktree;
  * Even with RESOLVE_REF_ALLOW_BAD_NAME, names that escape the refs/
  * directory and do not consist of all caps and underscores cannot be
  * resolved. The function returns NULL for such ref names.
- * Caps and underscores refers to the special refs, such as HEAD,
+ * Caps and underscores refers to the pseudorefs, such as HEAD,
  * FETCH_HEAD and friends, that all live outside of the refs/ directory.
  */
 #define RESOLVE_REF_READING 0x01
index db5c0c7a724d57ad67250cb0be996ae5cfbc0372..922e65e0d9c7228ba584899229c1cced1f69766f 100644 (file)
@@ -1,5 +1,4 @@
 #include "../git-compat-util.h"
-#include "../config.h"
 #include "../copy.h"
 #include "../environment.h"
 #include "../gettext.h"
@@ -19,7 +18,6 @@
 #include "../dir.h"
 #include "../chdir-notify.h"
 #include "../setup.h"
-#include "../worktree.h"
 #include "../wrapper.h"
 #include "../write-or-die.h"
 #include "../revision.h"
index 59c78d7941f8d5e05fec6c895aafeb41803b919d..5963e67c14c6c4b7dff3986764666d2dafabf3e4 100644 (file)
@@ -1,5 +1,4 @@
 #include "../git-compat-util.h"
-#include "../alloc.h"
 #include "../config.h"
 #include "../gettext.h"
 #include "../hash.h"
index 6e3b725245c3e8df1ec666cc23ab51b718be1d1f..a372a00941fda659cc60722452c8766f9c7de455 100644 (file)
@@ -1,5 +1,4 @@
 #include "../git-compat-util.h"
-#include "../alloc.h"
 #include "../hash.h"
 #include "../refs.h"
 #include "../repository.h"
index 34d4d073692f9e913d84715d987c8e1c35a7fe8a..1df3d8a0f09671c74143e655cb2963adda872545 100644 (file)
@@ -323,30 +323,28 @@ int block_iter_next(struct block_iter *it, struct reftable_record *rec)
                .len = it->br->block_len - it->next_off,
        };
        struct string_view start = in;
-       struct strbuf key = STRBUF_INIT;
        uint8_t extra = 0;
        int n = 0;
 
        if (it->next_off >= it->br->block_len)
                return 1;
 
-       n = reftable_decode_key(&key, &extra, it->last_key, in);
+       n = reftable_decode_key(&it->key, &extra, it->last_key, in);
        if (n < 0)
                return -1;
 
-       if (!key.len)
+       if (!it->key.len)
                return REFTABLE_FORMAT_ERROR;
 
        string_view_consume(&in, n);
-       n = reftable_record_decode(rec, key, extra, in, it->br->hash_size);
+       n = reftable_record_decode(rec, it->key, extra, in, it->br->hash_size);
        if (n < 0)
                return -1;
        string_view_consume(&in, n);
 
        strbuf_reset(&it->last_key);
-       strbuf_addbuf(&it->last_key, &key);
+       strbuf_addbuf(&it->last_key, &it->key);
        it->next_off += start.len - in.len;
-       strbuf_release(&key);
        return 0;
 }
 
@@ -377,6 +375,7 @@ int block_iter_seek(struct block_iter *it, struct strbuf *want)
 void block_iter_close(struct block_iter *it)
 {
        strbuf_release(&it->last_key);
+       strbuf_release(&it->key);
 }
 
 int block_reader_seek(struct block_reader *br, struct block_iter *it,
@@ -387,11 +386,8 @@ int block_reader_seek(struct block_reader *br, struct block_iter *it,
                .r = br,
        };
        struct reftable_record rec = reftable_new_record(block_reader_type(br));
-       struct strbuf key = STRBUF_INIT;
        int err = 0;
-       struct block_iter next = {
-               .last_key = STRBUF_INIT,
-       };
+       struct block_iter next = BLOCK_ITER_INIT;
 
        int i = binsearch(br->restart_count, &restart_key_less, &args);
        if (args.error) {
@@ -416,8 +412,8 @@ int block_reader_seek(struct block_reader *br, struct block_iter *it,
                if (err < 0)
                        goto done;
 
-               reftable_record_key(&rec, &key);
-               if (err > 0 || strbuf_cmp(&key, want) >= 0) {
+               reftable_record_key(&rec, &it->key);
+               if (err > 0 || strbuf_cmp(&it->key, want) >= 0) {
                        err = 0;
                        goto done;
                }
@@ -426,8 +422,7 @@ int block_reader_seek(struct block_reader *br, struct block_iter *it,
        }
 
 done:
-       strbuf_release(&key);
-       strbuf_release(&next.last_key);
+       block_iter_close(&next);
        reftable_record_release(&rec);
 
        return err;
index 87c77539b5bd6ab0b9909c51801719258507b424..17481e6331979cc31972ee3dad576e9c594a1769 100644 (file)
@@ -84,8 +84,14 @@ struct block_iter {
 
        /* key for last entry we read. */
        struct strbuf last_key;
+       struct strbuf key;
 };
 
+#define BLOCK_ITER_INIT { \
+       .last_key = STRBUF_INIT, \
+       .key = STRBUF_INIT, \
+}
+
 /* initializes a block reader. */
 int block_reader_init(struct block_reader *br, struct reftable_block *bl,
                      uint32_t header_off, uint32_t table_block_size,
index cb88af4a5639258945f569ede758e31809b62ead..c00bbc8aed50f02d21ed06c046bed3c5d4c2f17f 100644 (file)
@@ -32,7 +32,7 @@ static void test_block_read_write(void)
        int i = 0;
        int n;
        struct block_reader br = { 0 };
-       struct block_iter it = { .last_key = STRBUF_INIT };
+       struct block_iter it = BLOCK_ITER_INIT;
        int j = 0;
        struct strbuf want = STRBUF_INIT;
 
@@ -87,7 +87,7 @@ static void test_block_read_write(void)
        block_iter_close(&it);
 
        for (i = 0; i < N; i++) {
-               struct block_iter it = { .last_key = STRBUF_INIT };
+               struct block_iter it = BLOCK_ITER_INIT;
                strbuf_reset(&want);
                strbuf_addstr(&want, names[i]);
 
index 8331b34e82300630b68c574e4f68071f3ebf261a..a1ea3044292ef2032485bad261ffa5ed178421bc 100644 (file)
@@ -109,7 +109,7 @@ static int file_read_block(void *v, struct reftable_block *dest, uint64_t off,
        struct file_block_source *b = v;
        assert(off + size <= b->size);
        dest->data = reftable_malloc(size);
-       if (pread(b->fd, dest->data, size, off) != size)
+       if (pread_in_full(b->fd, dest->data, size, off) != size)
                return -1;
        dest->len = size;
        return size;
index ce936b4e1887ca982c9d814a014b469cbb49e52e..26e0393c7db7a4b6677bb3c5a73ce08559956dd7 100644 (file)
@@ -11,14 +11,12 @@ https://developers.google.com/open-source/licenses/bsd
 
 #include "reftable-blocksource.h"
 #include "reftable-error.h"
-#include "reftable-merged.h"
 #include "reftable-record.h"
 #include "reftable-tests.h"
 #include "reftable-writer.h"
 #include "reftable-iterator.h"
 #include "reftable-reader.h"
 #include "reftable-stack.h"
-#include "reftable-generic.h"
 
 #include <stddef.h>
 #include <stdio.h>
index 57f8032db941ca77f5c61d0e6d38268c56958be9..b9f1c7c18a2efc48e91c2526a42bb9433783f8dd 100644 (file)
@@ -6,7 +6,6 @@ license that can be found in the LICENSE file or at
 https://developers.google.com/open-source/licenses/bsd
 */
 
-#include "basics.h"
 #include "constants.h"
 #include "record.h"
 #include "generic.h"
index 09eb0cbfa5997e0eca4f378a8d45025c4af8732d..47d67d84df679c522ce50d1d7aade2d1be683b5a 100644 (file)
@@ -53,10 +53,10 @@ struct indexed_table_ref_iter {
        int is_finished;
 };
 
-#define INDEXED_TABLE_REF_ITER_INIT                                     \
-       {                                                               \
-               .cur = { .last_key = STRBUF_INIT }, .oid = STRBUF_INIT, \
-       }
+#define INDEXED_TABLE_REF_ITER_INIT { \
+       .cur = BLOCK_ITER_INIT, \
+       .oid = STRBUF_INIT, \
+}
 
 void iterator_from_indexed_table_ref_iter(struct reftable_iterator *it,
                                          struct indexed_table_ref_iter *itr);
index 5ded470c086c92760083dc16c08e7bdff821e9bf..574394092d1c2241e794cda58564382a1e8b42dc 100644 (file)
@@ -11,7 +11,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "constants.h"
 #include "iter.h"
 #include "pq.h"
-#include "reader.h"
 #include "record.h"
 #include "generic.h"
 #include "reftable-merged.h"
@@ -52,6 +51,8 @@ static void merged_iter_close(void *p)
                reftable_iterator_destroy(&mi->stack[i]);
        }
        reftable_free(mi->stack);
+       strbuf_release(&mi->key);
+       strbuf_release(&mi->entry_key);
 }
 
 static int merged_iter_advance_nonnull_subiter(struct merged_iter *mi,
@@ -85,7 +86,6 @@ static int merged_iter_advance_subiter(struct merged_iter *mi, size_t idx)
 static int merged_iter_next_entry(struct merged_iter *mi,
                                  struct reftable_record *rec)
 {
-       struct strbuf entry_key = STRBUF_INIT;
        struct pq_entry entry = { 0 };
        int err = 0;
 
@@ -105,33 +105,31 @@ static int merged_iter_next_entry(struct merged_iter *mi,
          such a deployment, the loop below must be changed to collect all
          entries for the same key, and return new the newest one.
        */
-       reftable_record_key(&entry.rec, &entry_key);
+       reftable_record_key(&entry.rec, &mi->entry_key);
        while (!merged_iter_pqueue_is_empty(mi->pq)) {
                struct pq_entry top = merged_iter_pqueue_top(mi->pq);
-               struct strbuf k = STRBUF_INIT;
-               int err = 0, cmp = 0;
+               int cmp = 0;
 
-               reftable_record_key(&top.rec, &k);
+               reftable_record_key(&top.rec, &mi->key);
 
-               cmp = strbuf_cmp(&k, &entry_key);
-               strbuf_release(&k);
-
-               if (cmp > 0) {
+               cmp = strbuf_cmp(&mi->key, &mi->entry_key);
+               if (cmp > 0)
                        break;
-               }
 
                merged_iter_pqueue_remove(&mi->pq);
                err = merged_iter_advance_subiter(mi, top.index);
-               if (err < 0) {
-                       return err;
-               }
+               if (err < 0)
+                       goto done;
                reftable_record_release(&top.rec);
        }
 
        reftable_record_copy_from(rec, &entry.rec, hash_size(mi->hash_id));
+
+done:
        reftable_record_release(&entry.rec);
-       strbuf_release(&entry_key);
-       return 0;
+       strbuf_release(&mi->entry_key);
+       strbuf_release(&mi->key);
+       return err;
 }
 
 static int merged_iter_next(struct merged_iter *mi, struct reftable_record *rec)
@@ -248,6 +246,8 @@ static int merged_table_seek_record(struct reftable_merged_table *mt,
                .typ = reftable_record_type(rec),
                .hash_id = mt->hash_id,
                .suppress_deletions = mt->suppress_deletions,
+               .key = STRBUF_INIT,
+               .entry_key = STRBUF_INIT,
        };
        int n = 0;
        int err = 0;
index 7d9f95d27ed0a44c4208e743b6b83ba4cdc5536c..d5b39dfe7f1e3b54b5dc5e7ae46068155794986f 100644 (file)
@@ -31,6 +31,8 @@ struct merged_iter {
        uint8_t typ;
        int suppress_deletions;
        struct merged_iter_pqueue pq;
+       struct strbuf key;
+       struct strbuf entry_key;
 };
 
 void merged_table_release(struct reftable_merged_table *mt);
index d08c16abefbc3d8562c29cf1703d1a6908f71dcd..0d6e0d4bf572f46683a1a9a3c6e1c128ed51f928 100644 (file)
@@ -12,7 +12,6 @@ https://developers.google.com/open-source/licenses/bsd
 
 #include "basics.h"
 #include "blocksource.h"
-#include "constants.h"
 #include "reader.h"
 #include "record.h"
 #include "test_framework.h"
index 011b5c75028a9d8dbad15f23ddb99d39e09ca9cb..c202eff84801820b28c56ddb7de28a2d041f3c08 100644 (file)
@@ -60,7 +60,7 @@ static void test_pq(void)
                if (last) {
                        EXPECT(strcmp(last, rec->u.ref.refname) < 0);
                }
-               // this is names[i], so don't dealloc.
+               /* this is names[i], so don't dealloc. */
                last = rec->u.ref.refname;
                rec->u.ref.refname = NULL;
                reftable_record_release(rec);
index b4db23ce1880794a937b841e28ffa27e8869d2c7..64dc366fb15935c55c5377ec9d4f1b74640cc3f6 100644 (file)
@@ -16,7 +16,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "record.h"
 #include "reftable-error.h"
 #include "reftable-generic.h"
-#include "tree.h"
 
 uint64_t block_source_size(struct reftable_block_source *source)
 {
@@ -224,10 +223,9 @@ struct table_iter {
        struct block_iter bi;
        int is_finished;
 };
-#define TABLE_ITER_INIT                          \
-       {                                        \
-               .bi = {.last_key = STRBUF_INIT } \
-       }
+#define TABLE_ITER_INIT { \
+       .bi = BLOCK_ITER_INIT \
+}
 
 static void table_iter_copy_from(struct table_iter *dest,
                                 struct table_iter *src)
index 469ab79a5adf3dfaba0160e523bdcece5b9875e0..79cd4e4c28abc4dbbad43f219b11fe4c0b28e5c3 100644 (file)
@@ -11,7 +11,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "basics.h"
 #include "block.h"
 #include "blocksource.h"
-#include "constants.h"
 #include "reader.h"
 #include "record.h"
 #include "test_framework.h"
@@ -141,8 +140,8 @@ static void test_log_buffer_size(void)
        */
        uint8_t hash1[GIT_SHA1_RAWSZ], hash2[GIT_SHA1_RAWSZ];
        for (i = 0; i < GIT_SHA1_RAWSZ; i++) {
-               hash1[i] = (uint8_t)(rand() % 256);
-               hash2[i] = (uint8_t)(rand() % 256);
+               hash1[i] = (uint8_t)(git_rand() % 256);
+               hash2[i] = (uint8_t)(git_rand() % 256);
        }
        log.value.update.old_hash = hash1;
        log.value.update.new_hash = hash2;
@@ -320,7 +319,7 @@ static void test_log_zlib_corruption(void)
        };
 
        for (i = 0; i < sizeof(message) - 1; i++)
-               message[i] = (uint8_t)(rand() % 64 + ' ');
+               message[i] = (uint8_t)(git_rand() % 64 + ' ');
 
        reftable_writer_set_limits(w, 1, 1);
 
index 8645cd93bbd8f9b51e05eb9143ed99217bfa1035..699e1aea4122d66a8a00451521f7d902858474c2 100644 (file)
@@ -9,7 +9,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "basics.h"
 #include "block.h"
 #include "blocksource.h"
-#include "constants.h"
 #include "reader.h"
 #include "record.h"
 #include "refname.h"
index ddbdf1b9c8bf4668dfe4f9b7c03cabd43effb660..16bab82063d2b3e228abe05b3a8a26ffd310767c 100644 (file)
@@ -17,6 +17,8 @@ https://developers.google.com/open-source/licenses/bsd
 #include "reftable-merged.h"
 #include "writer.h"
 
+#include "tempfile.h"
+
 static int stack_try_add(struct reftable_stack *st,
                         int (*write_table)(struct reftable_writer *wr,
                                            void *arg),
@@ -42,7 +44,7 @@ static void stack_filename(struct strbuf *dest, struct reftable_stack *st,
 static ssize_t reftable_fd_write(void *arg, const void *data, size_t sz)
 {
        int *fdp = (int *)arg;
-       return write(*fdp, data, sz);
+       return write_in_full(*fdp, data, sz);
 }
 
 int reftable_new_stack(struct reftable_stack **dest, const char *dir,
@@ -92,7 +94,7 @@ static int fd_read_lines(int fd, char ***namesp)
        }
 
        buf = reftable_malloc(size + 1);
-       if (read(fd, buf, size) != size) {
+       if (read_in_full(fd, buf, size) != size) {
                err = REFTABLE_IO_ERROR;
                goto done;
        }
@@ -204,6 +206,7 @@ static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
                reftable_calloc(sizeof(struct reftable_table) * names_len);
        int new_readers_len = 0;
        struct reftable_merged_table *new_merged = NULL;
+       struct strbuf table_path = STRBUF_INIT;
        int i;
 
        while (*names) {
@@ -223,13 +226,10 @@ static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
 
                if (!rd) {
                        struct reftable_block_source src = { NULL };
-                       struct strbuf table_path = STRBUF_INIT;
                        stack_filename(&table_path, st, name);
 
                        err = reftable_block_source_from_file(&src,
                                                              table_path.buf);
-                       strbuf_release(&table_path);
-
                        if (err < 0)
                                goto done;
 
@@ -267,16 +267,13 @@ static int reftable_stack_reload_once(struct reftable_stack *st, char **names,
        for (i = 0; i < cur_len; i++) {
                if (cur[i]) {
                        const char *name = reader_name(cur[i]);
-                       struct strbuf filename = STRBUF_INIT;
-                       stack_filename(&filename, st, name);
+                       stack_filename(&table_path, st, name);
 
                        reader_close(cur[i]);
                        reftable_reader_free(cur[i]);
 
                        /* On Windows, can only unlink after closing. */
-                       unlink(filename.buf);
-
-                       strbuf_release(&filename);
+                       unlink(table_path.buf);
                }
        }
 
@@ -288,6 +285,7 @@ done:
        reftable_free(new_readers);
        reftable_free(new_tables);
        reftable_free(cur);
+       strbuf_release(&table_path);
        return err;
 }
 
@@ -436,7 +434,7 @@ int reftable_stack_add(struct reftable_stack *st,
 static void format_name(struct strbuf *dest, uint64_t min, uint64_t max)
 {
        char buf[100];
-       uint32_t rnd = (uint32_t)rand();
+       uint32_t rnd = (uint32_t)git_rand();
        snprintf(buf, sizeof(buf), "0x%012" PRIx64 "-0x%012" PRIx64 "-%08x",
                 min, max, rnd);
        strbuf_reset(dest);
@@ -444,8 +442,7 @@ static void format_name(struct strbuf *dest, uint64_t min, uint64_t max)
 }
 
 struct reftable_addition {
-       int lock_file_fd;
-       struct strbuf lock_file_name;
+       struct tempfile *lock_file;
        struct reftable_stack *stack;
 
        char **new_tables;
@@ -453,24 +450,19 @@ struct reftable_addition {
        uint64_t next_update_index;
 };
 
-#define REFTABLE_ADDITION_INIT                \
-       {                                     \
-               .lock_file_name = STRBUF_INIT \
-       }
+#define REFTABLE_ADDITION_INIT {0}
 
 static int reftable_stack_init_addition(struct reftable_addition *add,
                                        struct reftable_stack *st)
 {
+       struct strbuf lock_file_name = STRBUF_INIT;
        int err = 0;
        add->stack = st;
 
-       strbuf_reset(&add->lock_file_name);
-       strbuf_addstr(&add->lock_file_name, st->list_file);
-       strbuf_addstr(&add->lock_file_name, ".lock");
+       strbuf_addf(&lock_file_name, "%s.lock", st->list_file);
 
-       add->lock_file_fd = open(add->lock_file_name.buf,
-                                O_EXCL | O_CREAT | O_WRONLY, 0666);
-       if (add->lock_file_fd < 0) {
+       add->lock_file = create_tempfile(lock_file_name.buf);
+       if (!add->lock_file) {
                if (errno == EEXIST) {
                        err = REFTABLE_LOCK_ERROR;
                } else {
@@ -479,7 +471,7 @@ static int reftable_stack_init_addition(struct reftable_addition *add,
                goto done;
        }
        if (st->config.default_permissions) {
-               if (chmod(add->lock_file_name.buf, st->config.default_permissions) < 0) {
+               if (chmod(add->lock_file->filename.buf, st->config.default_permissions) < 0) {
                        err = REFTABLE_IO_ERROR;
                        goto done;
                }
@@ -499,6 +491,7 @@ done:
        if (err) {
                reftable_addition_close(add);
        }
+       strbuf_release(&lock_file_name);
        return err;
 }
 
@@ -516,15 +509,7 @@ static void reftable_addition_close(struct reftable_addition *add)
        add->new_tables = NULL;
        add->new_tables_len = 0;
 
-       if (add->lock_file_fd > 0) {
-               close(add->lock_file_fd);
-               add->lock_file_fd = 0;
-       }
-       if (add->lock_file_name.len > 0) {
-               unlink(add->lock_file_name.buf);
-               strbuf_release(&add->lock_file_name);
-       }
-
+       delete_tempfile(&add->lock_file);
        strbuf_release(&nm);
 }
 
@@ -540,8 +525,10 @@ void reftable_addition_destroy(struct reftable_addition *add)
 int reftable_addition_commit(struct reftable_addition *add)
 {
        struct strbuf table_list = STRBUF_INIT;
+       int lock_file_fd = get_tempfile_fd(add->lock_file);
        int i = 0;
        int err = 0;
+
        if (add->new_tables_len == 0)
                goto done;
 
@@ -554,28 +541,20 @@ int reftable_addition_commit(struct reftable_addition *add)
                strbuf_addstr(&table_list, "\n");
        }
 
-       err = write(add->lock_file_fd, table_list.buf, table_list.len);
+       err = write_in_full(lock_file_fd, table_list.buf, table_list.len);
        strbuf_release(&table_list);
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                goto done;
        }
 
-       err = close(add->lock_file_fd);
-       add->lock_file_fd = 0;
-       if (err < 0) {
-               err = REFTABLE_IO_ERROR;
-               goto done;
-       }
-
-       err = rename(add->lock_file_name.buf, add->stack->list_file);
+       err = rename_tempfile(&add->lock_file, add->stack->list_file);
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                goto done;
        }
 
        /* success, no more state to clean up. */
-       strbuf_release(&add->lock_file_name);
        for (i = 0; i < add->new_tables_len; i++) {
                reftable_free(add->new_tables[i]);
        }
@@ -584,6 +563,12 @@ int reftable_addition_commit(struct reftable_addition *add)
        add->new_tables_len = 0;
 
        err = reftable_stack_reload(add->stack);
+       if (err)
+               goto done;
+
+       if (!add->stack->disable_auto_compact)
+               err = reftable_stack_auto_compact(add->stack);
+
 done:
        reftable_addition_close(add);
        return err;
@@ -1024,7 +1009,7 @@ static int stack_compact_range(struct reftable_stack *st, int first, int last,
                strbuf_addstr(&ref_list_contents, "\n");
        }
 
-       err = write(lock_file_fd, ref_list_contents.buf, ref_list_contents.len);
+       err = write_in_full(lock_file_fd, ref_list_contents.buf, ref_list_contents.len);
        if (err < 0) {
                err = REFTABLE_IO_ERROR;
                unlink(new_table_path.buf);
index d0b717510fa7d6dd8832bf77490630964e33b23b..82280c2fd586e2464561765575127051dd77c15b 100644 (file)
@@ -13,7 +13,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "reftable-reader.h"
 #include "merged.h"
 #include "basics.h"
-#include "constants.h"
 #include "record.h"
 #include "test_framework.h"
 #include "reftable-tests.h"
@@ -78,7 +77,7 @@ static void test_read_file(void)
        int i = 0;
 
        EXPECT(fd > 0);
-       n = write(fd, out, strlen(out));
+       n = write_in_full(fd, out, strlen(out));
        EXPECT(n == strlen(out));
        err = close(fd);
        EXPECT(err >= 0);
@@ -289,6 +288,61 @@ static void test_reftable_stack_transaction_api(void)
        clear_dir(dir);
 }
 
+static void test_reftable_stack_transaction_api_performs_auto_compaction(void)
+{
+       char *dir = get_tmp_dir(__LINE__);
+       struct reftable_write_options cfg = {0};
+       struct reftable_addition *add = NULL;
+       struct reftable_stack *st = NULL;
+       int i, n = 20, err;
+
+       err = reftable_new_stack(&st, dir, cfg);
+       EXPECT_ERR(err);
+
+       for (i = 0; i <= n; i++) {
+               struct reftable_ref_record ref = {
+                       .update_index = reftable_stack_next_update_index(st),
+                       .value_type = REFTABLE_REF_SYMREF,
+                       .value.symref = "master",
+               };
+               char name[100];
+
+               snprintf(name, sizeof(name), "branch%04d", i);
+               ref.refname = name;
+
+               /*
+                * Disable auto-compaction for all but the last runs. Like this
+                * we can ensure that we indeed honor this setting and have
+                * better control over when exactly auto compaction runs.
+                */
+               st->disable_auto_compact = i != n;
+
+               err = reftable_stack_new_addition(&add, st);
+               EXPECT_ERR(err);
+
+               err = reftable_addition_add(add, &write_test_ref, &ref);
+               EXPECT_ERR(err);
+
+               err = reftable_addition_commit(add);
+               EXPECT_ERR(err);
+
+               reftable_addition_destroy(add);
+
+               /*
+                * The stack length should grow continuously for all runs where
+                * auto compaction is disabled. When enabled, we should merge
+                * all tables in the stack.
+                */
+               if (i != n)
+                       EXPECT(st->merged->stack_len == i + 1);
+               else
+                       EXPECT(st->merged->stack_len == 1);
+       }
+
+       reftable_stack_destroy(st);
+       clear_dir(dir);
+}
+
 static void test_reftable_stack_validate_refname(void)
 {
        struct reftable_write_options cfg = { 0 };
@@ -850,6 +904,54 @@ static void test_reftable_stack_auto_compaction(void)
        clear_dir(dir);
 }
 
+static void test_reftable_stack_add_performs_auto_compaction(void)
+{
+       struct reftable_write_options cfg = { 0 };
+       struct reftable_stack *st = NULL;
+       struct strbuf refname = STRBUF_INIT;
+       char *dir = get_tmp_dir(__LINE__);
+       int err, i, n = 20;
+
+       err = reftable_new_stack(&st, dir, cfg);
+       EXPECT_ERR(err);
+
+       for (i = 0; i <= n; i++) {
+               struct reftable_ref_record ref = {
+                       .update_index = reftable_stack_next_update_index(st),
+                       .value_type = REFTABLE_REF_SYMREF,
+                       .value.symref = "master",
+               };
+
+               /*
+                * Disable auto-compaction for all but the last runs. Like this
+                * we can ensure that we indeed honor this setting and have
+                * better control over when exactly auto compaction runs.
+                */
+               st->disable_auto_compact = i != n;
+
+               strbuf_reset(&refname);
+               strbuf_addf(&refname, "branch-%04d", i);
+               ref.refname = refname.buf;
+
+               err = reftable_stack_add(st, &write_test_ref, &ref);
+               EXPECT_ERR(err);
+
+               /*
+                * The stack length should grow continuously for all runs where
+                * auto compaction is disabled. When enabled, we should merge
+                * all tables in the stack.
+                */
+               if (i != n)
+                       EXPECT(st->merged->stack_len == i + 1);
+               else
+                       EXPECT(st->merged->stack_len == 1);
+       }
+
+       reftable_stack_destroy(st);
+       strbuf_release(&refname);
+       clear_dir(dir);
+}
+
 static void test_reftable_stack_compaction_concurrent(void)
 {
        struct reftable_write_options cfg = { 0 };
@@ -960,6 +1062,7 @@ int stack_test_main(int argc, const char *argv[])
        RUN_TEST(test_reftable_stack_add);
        RUN_TEST(test_reftable_stack_add_one);
        RUN_TEST(test_reftable_stack_auto_compaction);
+       RUN_TEST(test_reftable_stack_add_performs_auto_compaction);
        RUN_TEST(test_reftable_stack_compaction_concurrent);
        RUN_TEST(test_reftable_stack_compaction_concurrent_clean);
        RUN_TEST(test_reftable_stack_hash_id);
@@ -967,6 +1070,7 @@ int stack_test_main(int argc, const char *argv[])
        RUN_TEST(test_reftable_stack_log_normalize);
        RUN_TEST(test_reftable_stack_tombstone);
        RUN_TEST(test_reftable_stack_transaction_api);
+       RUN_TEST(test_reftable_stack_transaction_api_performs_auto_compaction);
        RUN_TEST(test_reftable_stack_update_index_check);
        RUN_TEST(test_reftable_stack_uptodate);
        RUN_TEST(test_reftable_stack_validate_refname);
index 84ac972cad063a3402731c704d9c7bfde4d24d6e..04044fc1a0fb5ffa143264527b882afb752fc2c6 100644 (file)
@@ -9,7 +9,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "system.h"
 #include "test_framework.h"
 
-#include "basics.h"
 
 void set_test_hash(uint8_t *p, int i)
 {
index 774cb275bf679440b804d86370c8858c9e0b1bd2..ee44f735aea51d03fc3400a9340ccbd7af881f9e 100644 (file)
@@ -12,32 +12,38 @@ https://developers.google.com/open-source/licenses/bsd
 #include "system.h"
 #include "reftable-error.h"
 
-#define EXPECT_ERR(c)                                                  \
-       if (c != 0) {                                                  \
-               fflush(stderr);                                        \
-               fflush(stdout);                                        \
-               fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
-                       __FILE__, __LINE__, c, reftable_error_str(c)); \
-               abort();                                               \
-       }
-
-#define EXPECT_STREQ(a, b)                                               \
-       if (strcmp(a, b)) {                                              \
-               fflush(stderr);                                          \
-               fflush(stdout);                                          \
-               fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
-                       __LINE__, #a, a, #b, b);                         \
-               abort();                                                 \
-       }
-
-#define EXPECT(c)                                                          \
-       if (!(c)) {                                                        \
-               fflush(stderr);                                            \
-               fflush(stdout);                                            \
-               fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
-                       __LINE__, #c);                                     \
-               abort();                                                   \
-       }
+#define EXPECT_ERR(c)                                                          \
+       do {                                                                   \
+               if (c != 0) {                                                  \
+                       fflush(stderr);                                        \
+                       fflush(stdout);                                        \
+                       fprintf(stderr, "%s: %d: error == %d (%s), want 0\n",  \
+                               __FILE__, __LINE__, c, reftable_error_str(c)); \
+                       abort();                                               \
+               }                                                              \
+       } while (0)
+
+#define EXPECT_STREQ(a, b)                                                       \
+       do {                                                                     \
+               if (strcmp(a, b)) {                                              \
+                       fflush(stderr);                                          \
+                       fflush(stdout);                                          \
+                       fprintf(stderr, "%s:%d: %s (%s) != %s (%s)\n", __FILE__, \
+                               __LINE__, #a, a, #b, b);                         \
+                       abort();                                                 \
+               }                                                                \
+       } while (0)
+
+#define EXPECT(c)                                                                  \
+       do {                                                                       \
+               if (!(c)) {                                                        \
+                       fflush(stderr);                                            \
+                       fflush(stdout);                                            \
+                       fprintf(stderr, "%s: %d: failed assertion %s\n", __FILE__, \
+                               __LINE__, #c);                                     \
+                       abort();                                                   \
+               }                                                                  \
+       } while (0)
 
 #define RUN_TEST(f)                          \
        fprintf(stderr, "running %s\n", #f); \
index ac3a045ad4afbc893f4daff8da98c768cabaf8fd..6961a657adb80497676895eedca696d142e5b57c 100644 (file)
@@ -9,8 +9,6 @@ https://developers.google.com/open-source/licenses/bsd
 #include "system.h"
 #include "tree.h"
 
-#include "basics.h"
-#include "record.h"
 #include "test_framework.h"
 #include "reftable-tests.h"
 
index ef05752ca5738ea16d16d38c8ea9c65e2a9ea167..7f81bf3fafc4e5de90fa1fbf19c3b2cde26df8aa 100644 (file)
@@ -8,11 +8,9 @@
 #include "strbuf.h"
 #include "walker.h"
 #include "http.h"
-#include "exec-cmd.h"
 #include "run-command.h"
 #include "pkt-line.h"
 #include "string-list.h"
-#include "sideband.h"
 #include "strvec.h"
 #include "credential.h"
 #include "oid-array.h"
@@ -22,6 +20,7 @@
 #include "quote.h"
 #include "trace2.h"
 #include "transport.h"
+#include "url.h"
 #include "write-or-die.h"
 
 static struct remote *remote;
index abb24822beb2a17187d4afa9474dd1c537f078ba..6bef95316af6573b5a6829ace42b183e25548939 100644 (file)
--- a/remote.c
+++ b/remote.c
@@ -15,7 +15,6 @@
 #include "diff.h"
 #include "revision.h"
 #include "dir.h"
-#include "tag.h"
 #include "setup.h"
 #include "string-list.h"
 #include "strvec.h"
index cdc8b1db42c4a836804009a036628aaa94d94b5a..3a7377ff9631262536583db7763f1f2136450d0a 100644 (file)
--- a/remote.h
+++ b/remote.h
@@ -400,8 +400,6 @@ struct ref *get_stale_heads(struct refspec *rs, struct ref *fetch_map);
 /*
  * Compare-and-swap
  */
-#define CAS_OPT_NAME "force-with-lease"
-
 struct push_cas_option {
        unsigned use_tracking_for_rest:1;
        unsigned use_force_if_includes:1;
index 525f69c0c7785845cdf8991e56c8d231c2e6d239..30cd4787627b7cacbc2dbceddc0babee1b72cb3e 100644 (file)
@@ -2,7 +2,6 @@
 #include "config.h"
 #include "repository.h"
 #include "midx.h"
-#include "compat/fsmonitor/fsm-listen.h"
 
 static void repo_cfg_bool(struct repository *r, const char *key, int *dest,
                          int def)
index 09e19412859b3edb7be4142947d3967fc76520cc..ca7e77ba68c1ad4aa49f032906ba419098be0d04 100644 (file)
--- a/rerere.c
+++ b/rerere.c
 #include "dir.h"
 #include "resolve-undo.h"
 #include "merge-ll.h"
-#include "attr.h"
 #include "path.h"
 #include "pathspec.h"
 #include "object-file.h"
 #include "object-store-ll.h"
-#include "hash-lookup.h"
 #include "strmap.h"
 
 #define RESOLVED 0
diff --git a/reset.c b/reset.c
index 48da0adf851e1b09edfc22ffbbc0b1128cbbc5ab..0f2ff0fe31531fc5602025cfcd866a9348cfcf63 100644 (file)
--- a/reset.c
+++ b/reset.c
@@ -6,7 +6,6 @@
 #include "object-name.h"
 #include "refs.h"
 #include "reset.h"
-#include "run-command.h"
 #include "tree-walk.h"
 #include "tree.h"
 #include "unpack-trees.h"
index 00d5c29bfce18a1d4a5f5d701a593596ccd65783..2424c9bd674e534909df89e25c21b5eb119fda05 100644 (file)
 #include "reflog-walk.h"
 #include "patch-ids.h"
 #include "decorate.h"
-#include "log-tree.h"
 #include "string-list.h"
 #include "line-log.h"
 #include "mailmap.h"
 #include "commit-slab.h"
-#include "dir.h"
 #include "cache-tree.h"
 #include "bisect.h"
 #include "packfile.h"
@@ -2223,6 +2221,27 @@ static void add_message_grep(struct rev_info *revs, const char *pattern)
        add_grep(revs, pattern, GREP_PATTERN_BODY);
 }
 
+static int parse_count(const char *arg)
+{
+       int count;
+
+       if (strtol_i(arg, 10, &count) < 0)
+               die("'%s': not an integer", arg);
+       return count;
+}
+
+static timestamp_t parse_age(const char *arg)
+{
+       timestamp_t num;
+       char *p;
+
+       errno = 0;
+       num = parse_timestamp(arg, &p, 10);
+       if (errno || *p || p == arg)
+               die("'%s': not a number of seconds since epoch", arg);
+       return num;
+}
+
 static int handle_revision_opt(struct rev_info *revs, int argc, const char **argv,
                               int *unkc, const char **unkv,
                               const struct setup_revision_opt* opt)
@@ -2249,29 +2268,27 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
        }
 
        if ((argcount = parse_long_opt("max-count", argv, &optarg))) {
-               revs->max_count = atoi(optarg);
+               revs->max_count = parse_count(optarg);
                revs->no_walk = 0;
                return argcount;
        } else if ((argcount = parse_long_opt("skip", argv, &optarg))) {
-               revs->skip_count = atoi(optarg);
+               revs->skip_count = parse_count(optarg);
                return argcount;
        } else if ((*arg == '-') && isdigit(arg[1])) {
                /* accept -<digit>, like traditional "head" */
-               if (strtol_i(arg + 1, 10, &revs->max_count) < 0 ||
-                   revs->max_count < 0)
-                       die("'%s': not a non-negative integer", arg + 1);
+               revs->max_count = parse_count(arg + 1);
                revs->no_walk = 0;
        } else if (!strcmp(arg, "-n")) {
                if (argc <= 1)
                        return error("-n requires an argument");
-               revs->max_count = atoi(argv[1]);
+               revs->max_count = parse_count(argv[1]);
                revs->no_walk = 0;
                return 2;
        } else if (skip_prefix(arg, "-n", &optarg)) {
-               revs->max_count = atoi(optarg);
+               revs->max_count = parse_count(optarg);
                revs->no_walk = 0;
        } else if ((argcount = parse_long_opt("max-age", argv, &optarg))) {
-               revs->max_age = atoi(optarg);
+               revs->max_age = parse_age(optarg);
                return argcount;
        } else if ((argcount = parse_long_opt("since", argv, &optarg))) {
                revs->max_age = approxidate(optarg);
@@ -2283,7 +2300,7 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->max_age = approxidate(optarg);
                return argcount;
        } else if ((argcount = parse_long_opt("min-age", argv, &optarg))) {
-               revs->min_age = atoi(optarg);
+               revs->min_age = parse_age(optarg);
                return argcount;
        } else if ((argcount = parse_long_opt("before", argv, &optarg))) {
                revs->min_age = approxidate(optarg);
@@ -2371,11 +2388,11 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
        } else if (!strcmp(arg, "--no-merges")) {
                revs->max_parents = 1;
        } else if (skip_prefix(arg, "--min-parents=", &optarg)) {
-               revs->min_parents = atoi(optarg);
+               revs->min_parents = parse_count(optarg);
        } else if (!strcmp(arg, "--no-min-parents")) {
                revs->min_parents = 0;
        } else if (skip_prefix(arg, "--max-parents=", &optarg)) {
-               revs->max_parents = atoi(optarg);
+               revs->max_parents = parse_count(optarg);
        } else if (!strcmp(arg, "--no-max-parents")) {
                revs->max_parents = -1;
        } else if (!strcmp(arg, "--boundary")) {
@@ -2384,8 +2401,8 @@ static int handle_revision_opt(struct rev_info *revs, int argc, const char **arg
                revs->left_right = 1;
        } else if (!strcmp(arg, "--left-only")) {
                if (revs->right_only)
-                       die("--left-only is incompatible with --right-only"
-                           " or --cherry");
+                       die(_("options '%s' and '%s' cannot be used together"),
+                           "--left-only", "--right-only/--cherry");
                revs->left_only = 1;
        } else if (!strcmp(arg, "--right-only")) {
                if (revs->left_only)
@@ -2709,7 +2726,8 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (!strcmp(arg, "--branches")) {
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --branches"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--branches");
                handle_refs(refs, revs, *flags, refs_for_each_branch_ref);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (!strcmp(arg, "--bisect")) {
@@ -2720,12 +2738,14 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
                revs->bisect = 1;
        } else if (!strcmp(arg, "--tags")) {
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --tags"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--tags");
                handle_refs(refs, revs, *flags, refs_for_each_tag_ref);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (!strcmp(arg, "--remotes")) {
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --remotes"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--remotes");
                handle_refs(refs, revs, *flags, refs_for_each_remote_ref);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if ((argcount = parse_long_opt("glob", argv, &optarg))) {
@@ -2743,21 +2763,24 @@ static int handle_revision_pseudo_opt(struct rev_info *revs,
        } else if (skip_prefix(arg, "--branches=", &optarg)) {
                struct all_refs_cb cb;
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --branches"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--branches");
                init_all_refs_cb(&cb, revs, *flags);
                for_each_glob_ref_in(handle_one_ref, optarg, "refs/heads/", &cb);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (skip_prefix(arg, "--tags=", &optarg)) {
                struct all_refs_cb cb;
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --tags"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--tags");
                init_all_refs_cb(&cb, revs, *flags);
                for_each_glob_ref_in(handle_one_ref, optarg, "refs/tags/", &cb);
                clear_ref_exclusions(&revs->ref_excludes);
        } else if (skip_prefix(arg, "--remotes=", &optarg)) {
                struct all_refs_cb cb;
                if (revs->ref_excludes.hidden_refs_configured)
-                       return error(_("--exclude-hidden cannot be used together with --remotes"));
+                       return error(_("options '%s' and '%s' cannot be used together"),
+                                    "--exclude-hidden", "--remotes");
                init_all_refs_cb(&cb, revs, *flags);
                for_each_glob_ref_in(handle_one_ref, optarg, "refs/remotes/", &cb);
                clear_ref_exclusions(&revs->ref_excludes);
@@ -3036,8 +3059,6 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
                revs->grep_filter.ignore_locale = 1;
        compile_grep_patterns(&revs->grep_filter);
 
-       if (revs->reverse && revs->reflog_info)
-               die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--walk-reflogs");
        if (revs->reflog_info && revs->limited)
                die("cannot combine --walk-reflogs with history-limiting options");
        if (revs->rewrite_parents && revs->children.name)
@@ -3048,11 +3069,10 @@ int setup_revisions(int argc, const char **argv, struct rev_info *revs, struct s
        /*
         * Limitations on the graph functionality
         */
-       if (revs->reverse && revs->graph)
-               die(_("options '%s' and '%s' cannot be used together"), "--reverse", "--graph");
+       die_for_incompatible_opt3(!!revs->graph, "--graph",
+                                 !!revs->reverse, "--reverse",
+                                 !!revs->reflog_info, "--walk-reflogs");
 
-       if (revs->reflog_info && revs->graph)
-               die(_("options '%s' and '%s' cannot be used together"), "--walk-reflogs", "--graph");
        if (revs->no_walk && revs->graph)
                die(_("options '%s' and '%s' cannot be used together"), "--no-walk", "--graph");
        if (!revs->reflog_info && revs->grep_filter.use_reflog_filter)
index a558042c876ad2baefcfcc111163bab9691f7f1c..0e7435718a52267a2421a27320b783ee9ce0c1a4 100644 (file)
@@ -14,9 +14,7 @@
 #include "quote.h"
 #include "config.h"
 #include "packfile.h"
-#include "hook.h"
 #include "compat/nonblock.h"
-#include "alloc.h"
 
 void child_process_init(struct child_process *child)
 {
index 89aca9d829ed046f532b87120f39d807c86ebcb9..37f59d4f66bbc2b21bf08288a75de4a159b24625 100644 (file)
@@ -4,7 +4,6 @@
 #include "date.h"
 #include "gettext.h"
 #include "hex.h"
-#include "refs.h"
 #include "object-store-ll.h"
 #include "pkt-line.h"
 #include "sideband.h"
@@ -12,7 +11,6 @@
 #include "remote.h"
 #include "connect.h"
 #include "send-pack.h"
-#include "quote.h"
 #include "transport.h"
 #include "version.h"
 #include "oid-array.h"
index d584cac8ed9307caad0f8a9ede98d1f57ceab874..3cc88d8a8004d91eb2a404214f4ac136a845d61f 100644 (file)
 #include "pager.h"
 #include "commit.h"
 #include "sequencer.h"
-#include "tag.h"
 #include "run-command.h"
 #include "hook.h"
-#include "exec-cmd.h"
 #include "utf8.h"
 #include "cache-tree.h"
 #include "diff.h"
@@ -39,7 +37,6 @@
 #include "notes-utils.h"
 #include "sigchain.h"
 #include "unpack-trees.h"
-#include "worktree.h"
 #include "oidmap.h"
 #include "oidset.h"
 #include "commit-slab.h"
@@ -238,34 +235,29 @@ static int git_sequencer_config(const char *k, const char *v,
                                const struct config_context *ctx, void *cb)
 {
        struct replay_opts *opts = cb;
-       int status;
 
        if (!strcmp(k, "commit.cleanup")) {
-               const char *s;
+               if (!v)
+                       return config_error_nonbool(k);
 
-               status = git_config_string(&s, k, v);
-               if (status)
-                       return status;
-
-               if (!strcmp(s, "verbatim")) {
+               if (!strcmp(v, "verbatim")) {
                        opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_NONE;
                        opts->explicit_cleanup = 1;
-               } else if (!strcmp(s, "whitespace")) {
+               } else if (!strcmp(v, "whitespace")) {
                        opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SPACE;
                        opts->explicit_cleanup = 1;
-               } else if (!strcmp(s, "strip")) {
+               } else if (!strcmp(v, "strip")) {
                        opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_ALL;
                        opts->explicit_cleanup = 1;
-               } else if (!strcmp(s, "scissors")) {
+               } else if (!strcmp(v, "scissors")) {
                        opts->default_msg_cleanup = COMMIT_MSG_CLEANUP_SCISSORS;
                        opts->explicit_cleanup = 1;
                } else {
                        warning(_("invalid commit message cleanup mode '%s'"),
-                                 s);
+                                 v);
                }
 
-               free((char *)s);
-               return status;
+               return 0;
        }
 
        if (!strcmp(k, "commit.gpgsign")) {
@@ -345,7 +337,7 @@ static int has_conforming_footer(struct strbuf *sb, struct strbuf *sob,
        if (ignore_footer)
                sb->buf[sb->len - ignore_footer] = saved_char;
 
-       if (info.trailer_start == info.trailer_end)
+       if (info.trailer_block_start == info.trailer_block_end)
                return 0;
 
        for (i = 0; i < info.trailer_nr; i++)
diff --git a/setup.c b/setup.c
index fc592dc6dd5bf3f2ac7ac01ca0d72b7ce0129e77..75df6692ab3749cbe7e341fc498a587fc554b286 100644 (file)
--- a/setup.c
+++ b/setup.c
@@ -13,7 +13,6 @@
 #include "string-list.h"
 #include "chdir-notify.h"
 #include "path.h"
-#include "promisor-remote.h"
 #include "quote.h"
 #include "trace2.h"
 #include "worktree.h"
@@ -559,6 +558,8 @@ static enum extension_result handle_extension_v0(const char *var,
                        data->precious_objects = git_config_bool(var, value);
                        return EXTENSION_OK;
                } else if (!strcmp(ext, "partialclone")) {
+                       if (!value)
+                               return config_error_nonbool(var);
                        data->partial_clone = xstrdup(value);
                        return EXTENSION_OK;
                } else if (!strcmp(ext, "worktreeconfig")) {
index 133496bd4d9f2979dfe2765e98a50186463dde1d..f69fd166105a44a8be74fa6cd74841f06aa1a12d 100644 (file)
@@ -31,7 +31,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
 
 /* closeout.c - close standard output and standard error
    Copyright (C) 1998-2007 Free Software Foundation, Inc.
@@ -47,7 +47,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program; if not, see <http://www.gnu.org/licenses/>.  */
+   along with this program; if not, see <https://www.gnu.org/licenses/>.  */
 
 #include <errno.h>
 #include <stdio.h>
index dede2cbddf94f0c62ef01ba5e48a93026408c5d6..f993ef9c69091740ea2248d6c34452ecb58fba02 100644 (file)
@@ -88,7 +88,7 @@
 /*
  * Should define Big Endian for a whitelist of known processors. See
  * https://sourceforge.net/p/predef/wiki/Endianness/ and
- * http://www.oracle.com/technetwork/server-storage/solaris/portingtosolaris-138514.html
+ * https://web.archive.org/web/20140421151132/http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.superuser.html
  */
 #define SHA1DC_BIGENDIAN
 
index ac728cdd77892dab1c323fc81adaf240d988c6d9..7711798127e49efaa18b6403ecf103f05e92f7e7 100644 (file)
--- a/shallow.c
+++ b/shallow.c
@@ -7,7 +7,6 @@
 #include "commit.h"
 #include "tag.h"
 #include "pkt-line.h"
-#include "remote.h"
 #include "refs.h"
 #include "oid-array.h"
 #include "path.h"
diff --git a/shell.c b/shell.c
index 5c67e7bd97e2c825d79c3503267b5b41cd83bb8a..2ece8b16e2e8e1e3473dbc7bae6deedea51ee4e8 100644 (file)
--- a/shell.c
+++ b/shell.c
@@ -4,7 +4,6 @@
 #include "strbuf.h"
 #include "run-command.h"
 #include "alias.h"
-#include "prompt.h"
 
 #define COMMAND_DIR "git-shell-commands"
 #define HELP_COMMAND COMMAND_DIR "/help"
index 6cbfd391c47fb531740eb4b963a11b77f8abe29d..266a67342be7245ae3c1dfae5a1a5ad6647f95df 100644 (file)
@@ -69,7 +69,10 @@ void list_config_color_sideband_slots(struct string_list *list, const char *pref
  * of the line. This should be called for a single line only, which is
  * passed as the first N characters of the SRC array.
  *
- * NEEDSWORK: use "size_t n" instead for clarity.
+ * It is fine to use "int n" here instead of "size_t n" as all calls to this
+ * function pass an 'int' parameter. Additionally, the buffer involved in
+ * storing these 'int' values takes input from a packet via the pkt-line
+ * interface, which is capable of transferring only 64kB at a time.
  */
 static void maybe_colorize_sideband(struct strbuf *dest, const char *src, int n)
 {
index 6a48fd12f66f93d132aab6745d67effd482a168f..f4dd482abc95e7c1668623be7c24ec163745e189 100644 (file)
@@ -516,7 +516,9 @@ static int parse_config(const char *var, const char *value,
                        submodule->recommend_shallow =
                                git_config_bool(var, value);
        } else if (!strcmp(item.buf, "branch")) {
-               if (!me->overwrite && submodule->branch)
+               if (!value)
+                       ret = config_error_nonbool(var);
+               else if (!me->overwrite && submodule->branch)
                        warn_multiple_config(me->treeish_name, submodule->name,
                                             "branch");
                else {
index 2a37689cc272e30fa6f5dc9cfbbde044a52068c3..958f320ac6ce08a0b0ac856415a173d5fa7c2600 100644 (file)
@@ -2,9 +2,7 @@
 #define SUBMODULE_CONFIG_CACHE_H
 
 #include "config.h"
-#include "hashmap.h"
 #include "submodule.h"
-#include "strbuf.h"
 #include "tree-walk.h"
 
 /**
index e603a19a876c88c59f18da33caa1541b15ded9f3..213da79f66116f3db835036140affb98406a934a 100644 (file)
 #include "string-list.h"
 #include "oid-array.h"
 #include "strvec.h"
-#include "blob.h"
 #include "thread-utils.h"
 #include "path.h"
-#include "quote.h"
 #include "remote.h"
 #include "worktree.h"
 #include "parse-options.h"
@@ -30,7 +28,6 @@
 #include "commit-reach.h"
 #include "read-cache-ll.h"
 #include "setup.h"
-#include "shallow.h"
 #include "trace2.h"
 
 static int config_update_recurse_submodules = RECURSE_SUBMODULES_OFF;
index 3e00cdd801d637388edf1a546f9613a99cd3c737..fae301248fe3d8d7394449b63a9282e74b522046 100644 (file)
@@ -90,20 +90,12 @@ check-chainlint:
                echo "# chainlint: $(CHAINLINTTMP_SQ)/tests" && \
                for i in $(CHAINLINTTESTS); do \
                        echo "# chainlint: $$i" && \
-                       sed -e '/^[     ]*$$/d' chainlint/$$i.expect; \
+                       cat chainlint/$$i.expect; \
                done \
        } >'$(CHAINLINTTMP_SQ)'/expect && \
        $(CHAINLINT) --emit-all '$(CHAINLINTTMP_SQ)'/tests | \
-               sed -e 's/^[1-9][0-9]* //;/^[   ]*$$/d' >'$(CHAINLINTTMP_SQ)'/actual && \
-       if test -f ../GIT-BUILD-OPTIONS; then \
-               . ../GIT-BUILD-OPTIONS; \
-       fi && \
-       if test -x ../git$$X; then \
-               DIFFW="../git$$X --no-pager diff -w --no-index"; \
-       else \
-               DIFFW="diff -w -u"; \
-       fi && \
-       $$DIFFW '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual
+               sed -e 's/^[1-9][0-9]* //' >'$(CHAINLINTTMP_SQ)'/actual && \
+       diff -u '$(CHAINLINTTMP_SQ)'/expect '$(CHAINLINTTMP_SQ)'/actual
 
 test-lint: test-lint-duplicates test-lint-executable test-lint-shell-syntax \
        test-lint-filenames
index a0ebe294848ddc3ea6abdd7b9308edce34f7a876..36463d074259e3805e6de6d41d30bc3632b369f5 100644 (file)
--- a/t/README
+++ b/t/README
@@ -32,7 +32,7 @@ the tests.
     ok 2 - plain with GIT_WORK_TREE
     ok 3 - plain bare
 
-Since the tests all output TAP (see http://testanything.org) they can
+Since the tests all output TAP (see https://testanything.org) they can
 be run with any TAP harness. Here's an example of parallel testing
 powered by a recent version of prove(1):
 
@@ -1278,7 +1278,7 @@ Devel::Cover module. To install it do:
    sudo aptitude install libdevel-cover-perl
 
    # From the CPAN with cpanminus
-   curl -L http://cpanmin.us | perl - --sudo --self-upgrade
+   curl -L https://cpanmin.us/ | perl - --sudo --self-upgrade
    cpanm --sudo Devel::Cover
 
 Then, at the top-level:
index 48ed4eb1246efc67b0064b03ea531ea3fad3a320..056e03003d3e7847ead4f14e47b69de630cb507e 100644 (file)
@@ -1,11 +1,11 @@
-test_done ( ) {
+test_done () {
        case "$test_failure" in
-       0 )
+       0)
                test_at_end_hook_
 
                exit 0 ;;
 
-       * )
+       *)
                if test $test_external_has_tap -eq 0
                then
                        say_color error "# failed $test_failure among $msg"
@@ -14,5 +14,5 @@ test_done ( ) {
 
                exit 1 ;;
 
-               esac
+       esac
 }
index f76fde1ffba91d7becf17c0990c39ac25a7083f0..b47827d7499f607289cc6ec78a7b0030ee2449c0 100644 (file)
@@ -1,4 +1,8 @@
 (
+
        nothing &&
+
        something
+
+
 )
index a3bcea492a915f62cc6870a3e194fd86c19344a7..1c873263647907de91d461b4bf19b48ea5e85c3a 100644 (file)
@@ -12,9 +12,9 @@
 ) &&
 
 {
-       echo a ; ?!AMP?! echo b
+       echo a; ?!AMP?! echo b
 } &&
-{ echo a ; ?!AMP?! echo b ; } &&
+{ echo a; ?!AMP?! echo b; } &&
 
 {
        echo "${var}9" &&
index 28f9114f42de6b4dd6682ba7fdea5cd2bd3de263..20d0bb5333083208285e87408e5f16fb7263594c 100644 (file)
@@ -1,9 +1,9 @@
 JGIT_DAEMON_PID= &&
 git init --bare empty.git &&
-> empty.git/git-daemon-export-ok &&
+>empty.git/git-daemon-export-ok &&
 mkfifo jgit_daemon_output &&
 {
-       jgit daemon --port="$JGIT_DAEMON_PORT" . > jgit_daemon_output &
+       jgit daemon --port="$JGIT_DAEMON_PORT" . >jgit_daemon_output &
        JGIT_DAEMON_PID=$!
 } &&
 test_expect_code 2 git ls-remote --exit-code git://localhost:$JGIT_DAEMON_PORT/empty.git
index 1732d221c32e98bf40438167769869cb597ed4a1..4cd18e2edfc80a4bcb30ea409da0e6afac0d341b 100644 (file)
@@ -1,16 +1,16 @@
 case "$(git ls-files)" in
-one ) echo pass one ;;
-* ) echo bad one ; return 1 ;;
+one) echo pass one ;;
+*) echo bad one; return 1 ;;
 esac &&
 (
        case "$(git ls-files)" in
-       two ) echo pass two ;;
-       * ) echo bad two ; exit 1 ;;
-esac
+       two) echo pass two ;;
+       *) echo bad two; exit 1 ;;
+       esac
 ) &&
 case "$(git ls-files)" in
-dir/two"$LF"one ) echo pass both ;;
-* ) echo bad ; return 1 ;;
+dir/two"$LF"one) echo pass both ;;
+*) echo bad; return 1 ;;
 esac &&
 
 for i in 1 2 3 4 ; do
index f4bada946322a6bee2634efc27b1e67f684c1c5e..e6b3b2193e869136e222ec582853ba3f17254e53 100644 (file)
@@ -1,7 +1,7 @@
-OUT=$(( ( large_git ; echo $? 1 >& 3 ) | : ) 3 >& 1) &&
+OUT=$( ((large_git; echo $? 1>&3) | :) 3>&1 ) &&
 test_match_signal 13 "$OUT" &&
 
-{ test-tool sigchain > actual ; ret=$? ; } &&
+{ test-tool sigchain >actual; ret=$?; } &&
 {
        test_match_signal 15 "$ret" ||
        test "$ret" = 3
index af0369d3285b177dac4d2ccbf6528aa6b76ec2f8..83810ea7ec7d34d439c69b12bbfe2d70be16e3df 100644 (file)
@@ -4,7 +4,7 @@ mkdir sub && (
        nuff said
 ) &&
 
-cut "-d " -f actual | ( read s1 s2 s3 &&
+cut "-d " -f actual | (read s1 s2 s3 &&
 test -f $s1 ?!AMP?!
 test $(cat $s2) = tree2path1 &&
-test $(cat $s3) = tree3path1 )
+test $(cat $s3) = tree3path1)
index ab2f79e845703731124315bee2d90b6eff329126..ec42f2c30c98630ef0538936bbaa5f96c0fa7626 100644 (file)
@@ -1,2 +1,2 @@
-OUT=$(( ( large_git 1 >& 3 ) | : ) 3 >& 1) &&
+OUT=$( ((large_git 1>&3) | :) 3>&1 ) &&
 test_match_signal 13 "$OUT"
index bf9ced60d4c4a360266fc942430bbe79f6689345..37eab80738e4018e48b966cb9933ca332ae71f5e 100644 (file)
@@ -1,3 +1,5 @@
-echo 'fatal: reword option of --fixup is mutually exclusive with' '--patch/--interactive/--all/--include/--only' > expect &&
-test_must_fail git commit --fixup=reword:HEAD~ $1 2 > actual &&
+
+echo 'fatal: reword option of --fixup is mutually exclusive with'      '--patch/--interactive/--all/--include/--only' >expect &&
+test_must_fail git commit --fixup=reword:HEAD~ $1 2>actual &&
 test_cmp expect actual
+
index 10724987a5fbb6ba19ba0972c77b5689ca52ab28..087eda15e49144a9cbe24f9fc526f489b63aa068 100644 (file)
@@ -6,6 +6,7 @@ grep "^\.git$" output.txt &&
 (
        cd client$version &&
        GIT_TEST_PROTOCOL_VERSION=$version git fetch-pack --no-progress .. $(cat ../input)
-) > output &&
-       cut -d ' ' -f 2 < output | sort > actual &&
+) >output &&
+       cut -d ' ' -f 2 <output | sort >actual &&
        test_cmp expect actual
+
index e8733c97c645afce31a1253e90a69cfb017e4d7d..8507721192aeb4b5486ca7e7ddd2ecd7a484ebe0 100644 (file)
@@ -1,4 +1,4 @@
-git ls-tree $tree path > current &&
-cat > expected <<\EOF &&
+git ls-tree $tree path >current &&
+cat >expected <<\EOF &&
 EOF
 test_output
index 2d961a58c6676cee9db9ecfb573d4bac51f2d071..765a35bb4c47e31d369e481a3531ab7eaec2b097 100644 (file)
@@ -1,4 +1,4 @@
-if ! condition ; then echo nope ; else yep ; fi &&
+if ! condition; then echo nope; else yep; fi &&
 test_prerequisite !MINGW &&
 mail uucp!address &&
 echo !whatever!
index a21007a63f171c92482e47c381a759f7e6f20e03..02c0d15cca5cd42d7909f9fccbb95a932e217953 100644 (file)
@@ -1,5 +1,5 @@
 for it
 do
-       path=$(expr "$it" : ( [^:]*) ) &&
+       path=$(expr "$it" : ([^:]*)) &&
        git update-index --add "$path" || exit
 done
index d65c82129a68b7c3e2088ba9a95971e03a6952ee..d2237f1e38fad73938ff6335dac9de538e337caa 100644 (file)
@@ -6,6 +6,7 @@
                bar
                EOF
        done ?!AMP?!
+
        for i in a b c; do
                echo $i &&
                cat $i ?!LOOP?!
index a14388e6b9faeb67cdc79eea38a0cb3f94b240f8..dd7c997a3c340d633d9cbf7a78f4b29727a22ce4 100644 (file)
@@ -1,8 +1,8 @@
-sha1_file ( ) {
+sha1_file() {
        echo "$*" | sed "s#..#.git/objects/&/#"
 } &&
 
-remove_object ( ) {
+remove_object() {
        file=$(sha1_file "$*") &&
        test -e "$file" ?!AMP?!
        rm -f "$file"
index 1df3f782821b6a7221767fbdd76ad2c26b5d67c9..91b961242a1cabb7cc3f5edecaa6d99eb3eeef9e 100644 (file)
@@ -1,6 +1,6 @@
 boodle wobba \
-       gorgo snoot \
-       wafta snurb <<EOF &&
+       gorgo snoot \
+       wafta snurb <<EOF &&
 quoth the raven,
 nevermore...
 EOF
index 24da9e86d596b5d068b149242e213ba0224051d3..7ce3a348060dcfaf91299282eb4eee2b471f58bc 100644 (file)
@@ -1,18 +1,18 @@
-( while test $i -le $blobcount
-do
-       printf "Generating blob $i/$blobcount\r" >& 2 &&
+(while test $i -le $blobcount
+ do
+       printf "Generating blob $i/$blobcount\r" >&2 &&
        printf "blob\nmark :$i\ndata $blobsize\n" &&
        #test-tool genrandom $i $blobsize &&
        printf "%-${blobsize}s" $i &&
        echo "M 100644 :$i $i" >> commit &&
        i=$(($i+1)) ||
        echo $? > exit-status
-done &&
-echo "commit refs/heads/main" &&
-echo "author A U Thor <author@email.com> 123456789 +0000" &&
-echo "committer C O Mitter <committer@email.com> 123456789 +0000" &&
-echo "data 5" &&
-echo ">2gb" &&
-cat commit ) |
+ done &&
+ echo "commit refs/heads/main" &&
+ echo "author A U Thor <author@email.com> 123456789 +0000" &&
+ echo "committer C O Mitter <committer@email.com> 123456789 +0000" &&
+ echo "data 5" &&
+ echo ">2gb" &&
+ cat commit) |
 git fast-import --big-file-threshold=2 &&
 test ! -f exit-status
index 2a86885ee6a330450a76591248b60b89e601816f..3836049cc4190e4a37c35511279cd3fd36040b65 100644 (file)
@@ -2,18 +2,24 @@
        (cd foo &&
                bar
        ) &&
+
        (cd foo &&
                bar
        ) ?!AMP?!
+
        (
                cd foo &&
                bar) &&
+
        (
                cd foo &&
                bar) ?!AMP?!
+
        (cd foo &&
                bar) &&
+
        (cd foo &&
                bar) ?!AMP?!
+
        foobar
 )
index 4793a0e8e12aeb0f4d4c4497a2e77a87a2d6d2b6..3461df40e5129423ab58d92f84518d145f2f8b5d 100644 (file)
@@ -1,31 +1,31 @@
-for i in 0 1 2 3 4 5 6 7 8 9 ;
+for i in 0 1 2 3 4 5 6 7 8 9;
 do
-       for j in 0 1 2 3 4 5 6 7 8 9 ;
+       for j in 0 1 2 3 4 5 6 7 8 9;
        do
-               echo "$i$j" > "path$i$j" ?!LOOP?!
+               echo "$i$j" >"path$i$j" ?!LOOP?!
        done ?!LOOP?!
 done &&
 
-for i in 0 1 2 3 4 5 6 7 8 9 ;
+for i in 0 1 2 3 4 5 6 7 8 9;
 do
-       for j in 0 1 2 3 4 5 6 7 8 9 ;
+       for j in 0 1 2 3 4 5 6 7 8 9;
        do
-               echo "$i$j" > "path$i$j" || return 1
+               echo "$i$j" >"path$i$j" || return 1
        done
 done &&
 
-for i in 0 1 2 3 4 5 6 7 8 9 ;
+for i in 0 1 2 3 4 5 6 7 8 9;
 do
-       for j in 0 1 2 3 4 5 6 7 8 9 ;
+       for j in 0 1 2 3 4 5 6 7 8 9;
        do
-               echo "$i$j" > "path$i$j" ?!LOOP?!
+               echo "$i$j" >"path$i$j" ?!LOOP?!
        done || return 1
 done &&
 
-for i in 0 1 2 3 4 5 6 7 8 9 ;
+for i in 0 1 2 3 4 5 6 7 8 9;
 do
-       for j in 0 1 2 3 4 5 6 7 8 9 ;
+       for j in 0 1 2 3 4 5 6 7 8 9;
        do
-               echo "$i$j" > "path$i$j" || return 1
+               echo "$i$j" >"path$i$j" || return 1
        done || return 1
 done
index 02e0a9f1bb5f302a2903817b5d8ef7ff25b2efa7..73ff28546ae720bd7ce8e15cd9597e27e6afae41 100644 (file)
@@ -4,6 +4,7 @@
                echo a &&
                echo b
        ) >file &&
+
        cd foo &&
        (
                echo a ?!AMP?!
index 2cfc0282970db02dd37eaf1c0c079e22a233cef1..811971b1a3c495da2adf0064c24007c6a7bf913d 100644 (file)
@@ -2,7 +2,9 @@
        foo |
        bar |
        baz &&
+
        fish |
        cow ?!AMP?!
+
        sunder
 )
index 52789278d13b7605a63c0c92c09c518990ab316f..75d6f607e295638e9e0c5029711357bc2e9d2fda 100644 (file)
@@ -1,7 +1,7 @@
 (
        echo wobba \
-               gorgo snoot \
-               wafta snurb <<-EOF &&
+              gorgo snoot \
+              wafta snurb <<-EOF &&
        quoth the raven,
        nevermore...
        EOF
index b7015361bfe6a3555d02e97d2bdc0413b8f8c432..8f694990e8d9f1ce1205399f54b61436cfe4100c 100644 (file)
@@ -2,13 +2,18 @@
        (foo && bar) &&
        (foo && bar) |
        (foo && bar) >baz &&
+
        (foo; ?!AMP?! bar) &&
        (foo; ?!AMP?! bar) |
        (foo; ?!AMP?! bar) >baz &&
+
        (foo || exit 1) &&
        (foo || exit 1) |
        (foo || exit 1) >baz &&
+
        (foo && bar) ?!AMP?!
+
        (foo && bar; ?!AMP?! baz) ?!AMP?!
+
        foobar
 )
index 71b3b3bc20ed1d6718f8d0ee6efe35b147557b8c..02f3129232a0d114bf90211b9a6508385d0115bd 100644 (file)
@@ -15,6 +15,7 @@ main-sub4" &&
 $chkms
 TXT
 ) &&
+
        subfiles=$(git ls-files) &&
        check_equal "$subfiles" "$chkms
 $chks"
index 342360bcd05941c55c924e041a4715e9fe201361..6a387917a7af18bc39b70c91b091b91eb6a7ee82 100644 (file)
@@ -4,22 +4,22 @@ git config filter.rot13.clean ./rot13.sh &&
 {
     echo "*.t filter=rot13" ?!AMP?!
     echo "*.i ident"
-} > .gitattributes &&
+} >.gitattributes &&
 
 {
     echo a b c d e f g h i j k l m ?!AMP?!
     echo n o p q r s t u v w x y z ?!AMP?!
     echo '$Id$'
-} > test &&
-cat test > test.t &&
-cat test > test.o &&
-cat test > test.i &&
+} >test &&
+cat test >test.t &&
+cat test >test.o &&
+cat test >test.i &&
 git add test test.t test.i &&
 rm -f test test.t test.i &&
 git checkout -- test test.t test.i &&
 
-echo "content-test2" > test2.o &&
-echo "content-test3 - filename with special characters" > "test3 'sq',$x=.o" ?!AMP?!
+echo "content-test2" >test2.o &&
+echo "content-test3 - filename with special characters" >"test3 'sq',$x=.o" ?!AMP?!
 
 downstream_url_for_sed=$(
        printf "%sn" "$downstream_url" |
index 1f5eaea0fd59757ea78b7dc0b24ec0971c2faa36..06c1567f481e8cbc21cf50fdf58bfb9a502d439e 100644 (file)
@@ -6,6 +6,7 @@
                bar
                EOF
        done ?!AMP?!
+
        while true; do
                echo foo &&
                cat bar ?!LOOP?!
index 475058592d157da39a40ff32231a91f62a5d186a..09dc78733c009d386a7da4981aee1f3de4c57dda 100644 (file)
@@ -5,9 +5,7 @@
 #include "strbuf.h"
 #include "string-list.h"
 #include "transport.h"
-#include "ref-filter.h"
 #include "remote.h"
-#include "refs.h"
 
 enum input_mode {
        KEY_VALUE_PAIRS,
index f4d134a145214f3964e781db949c05cf51f32fc5..4daa82f00fcb5f0b178aa912033c906fe14c7718 100644 (file)
@@ -1,7 +1,9 @@
 #include "git-compat-util.h"
 #include "test-tool.h"
 #include "pkt-line.h"
+#include "sideband.h"
 #include "write-or-die.h"
+#include "parse-options.h"
 
 static void pack_line(const char *line)
 {
@@ -64,12 +66,33 @@ static void unpack(void)
        }
 }
 
-static void unpack_sideband(void)
+static void unpack_sideband(int argc, const char **argv)
 {
        struct packet_reader reader;
-       packet_reader_init(&reader, 0, NULL, 0,
-                          PACKET_READ_GENTLE_ON_EOF |
-                          PACKET_READ_CHOMP_NEWLINE);
+       int options = PACKET_READ_GENTLE_ON_EOF;
+       int chomp_newline = 1;
+       int reader_use_sideband = 0;
+       const char *const unpack_sideband_usage[] = {
+               "test_tool unpack_sideband [options...]", NULL
+       };
+       struct option cmd_options[] = {
+               OPT_BOOL(0, "reader-use-sideband", &reader_use_sideband,
+                        "set use_sideband bit for packet reader (Default: off)"),
+               OPT_BOOL(0, "chomp-newline", &chomp_newline,
+                        "chomp newline in packet (Default: on)"),
+               OPT_END()
+       };
+
+       argc = parse_options(argc, argv, "", cmd_options, unpack_sideband_usage,
+                            0);
+       if (argc > 0)
+               usage_msg_opt(_("too many arguments"), unpack_sideband_usage,
+                             cmd_options);
+
+       if (chomp_newline)
+               options |= PACKET_READ_CHOMP_NEWLINE;
+       packet_reader_init(&reader, 0, NULL, 0, options);
+       reader.use_sideband = reader_use_sideband;
 
        while (packet_reader_read(&reader) != PACKET_READ_EOF) {
                int band;
@@ -79,6 +102,17 @@ static void unpack_sideband(void)
                case PACKET_READ_EOF:
                        break;
                case PACKET_READ_NORMAL:
+                       /*
+                        * When the "use_sideband" field of the reader is turned
+                        * on, sideband packets other than the payload have been
+                        * parsed and consumed in packet_reader_read(), and only
+                        * the payload arrives here.
+                        */
+                       if (reader.use_sideband) {
+                               write_or_die(1, reader.line, reader.pktlen - 1);
+                               break;
+                       }
+
                        band = reader.line[0] & 0xff;
                        if (band < 1 || band > 2)
                                continue; /* skip non-sideband packets */
@@ -97,15 +131,31 @@ static void unpack_sideband(void)
 
 static int send_split_sideband(void)
 {
+       const char *foo = "Foo.\n";
+       const char *bar = "Bar.\n";
        const char *part1 = "Hello,";
        const char *primary = "\001primary: regular output\n";
        const char *part2 = " world!\n";
 
+       /* Each sideband message has a trailing newline character. */
+       send_sideband(1, 2, foo, strlen(foo), LARGE_PACKET_MAX);
+       send_sideband(1, 2, bar, strlen(bar), LARGE_PACKET_MAX);
+
+       /*
+        * One sideband message is divided into part1 and part2
+        * by the primary message.
+        */
        send_sideband(1, 2, part1, strlen(part1), LARGE_PACKET_MAX);
        packet_write(1, primary, strlen(primary));
        send_sideband(1, 2, part2, strlen(part2), LARGE_PACKET_MAX);
        packet_response_end(1);
 
+       /*
+        * We use unpack_sideband() to consume packets. A flush packet
+        * is required to end parsing.
+        */
+       packet_flush(1);
+
        return 0;
 }
 
@@ -126,7 +176,7 @@ int cmd__pkt_line(int argc, const char **argv)
        else if (!strcmp(argv[1], "unpack"))
                unpack();
        else if (!strcmp(argv[1], "unpack-sideband"))
-               unpack_sideband();
+               unpack_sideband(argc - 1, argv + 1);
        else if (!strcmp(argv[1], "send-split-sideband"))
                send_split_sideband();
        else if (!strcmp(argv[1], "receive-sideband"))
index 3e173399a00f5296a70aa293107dfb4db94b1633..1e159a754db6db5d02eaa81072b0ab19fa863004 100644 (file)
@@ -1,11 +1,9 @@
 #include "test-tool.h"
 #include "commit.h"
 #include "commit-reach.h"
-#include "config.h"
 #include "gettext.h"
 #include "hex.h"
 #include "object-name.h"
-#include "parse-options.h"
 #include "ref-filter.h"
 #include "setup.h"
 #include "string-list.h"
index bd871a735b4fbb19ed99e9bfab56f13d138a0567..80042eafc20603e0c84cb83d3ba400cd316010c7 100644 (file)
@@ -30,7 +30,7 @@ static int test_regex_bug(void)
        if (regexec(&r, str, 1, m, 0))
                die("no match of pattern '%s' to string '%s'", pat, str);
 
-       /* http://sourceware.org/bugzilla/show_bug.cgi?id=3957  */
+       /* https://sourceware.org/bugzilla/show_bug.cgi?id=3957 */
        if (m[0].rm_so == 3) /* matches '\n' when it should not */
                die("regex bug confirmed: re-build git with NO_REGEX=1");
 
index 4cd8a952e5c6f55fbb3cfdbffe8c3be07bf008d7..0c7c5aa4dd7641a72b930b57eeff17dbf90c4c16 100644 (file)
@@ -1,10 +1,8 @@
 #include "test-tool.h"
 #include "commit-graph.h"
 #include "commit.h"
-#include "config.h"
 #include "environment.h"
 #include "hex.h"
-#include "object-store-ll.h"
 #include "object.h"
 #include "repository.h"
 #include "setup.h"
index 941ae7e3bcf3eda6e88148d9ff9d923aea707ada..fb5927775daef80040ea9675742aa2cb47d46d4e 100644 (file)
@@ -4,7 +4,6 @@
 
 #include "test-tool.h"
 #include "gettext.h"
-#include "strbuf.h"
 #include "simple-ipc.h"
 #include "parse-options.h"
 #include "thread-utils.h"
index 356e0a26c5a0b87714d76f608a917807f69599f5..50c154d0370bfbdd91b70747133977a752f2b504 100644 (file)
@@ -4,6 +4,7 @@
 #include "remote.h"
 #include "repository.h"
 #include "setup.h"
+#include "strbuf.h"
 #include "submodule-config.h"
 #include "submodule.h"
 
index d5ca0046c89fd434e5b4c5c4f28cb24d6a076bd2..1adac29a575254492f206bf4c4e4b6cab08f999d 100644 (file)
@@ -412,6 +412,56 @@ static int ut_201counter(int argc, const char **argv)
        return 0;
 }
 
+static int ut_300redact_start(int argc, const char **argv)
+{
+       if (!argc)
+               die("expect <argv...>");
+
+       trace2_cmd_start(argv);
+
+       return 0;
+}
+
+static int ut_301redact_child_start(int argc, const char **argv)
+{
+       struct child_process cmd = CHILD_PROCESS_INIT;
+       int k;
+
+       if (!argc)
+               die("expect <argv...>");
+
+       for (k = 0; argv[k]; k++)
+               strvec_push(&cmd.args, argv[k]);
+
+       trace2_child_start(&cmd);
+
+       strvec_clear(&cmd.args);
+
+       return 0;
+}
+
+static int ut_302redact_exec(int argc, const char **argv)
+{
+       if (!argc)
+               die("expect <exe> <argv...>");
+
+       trace2_exec(argv[0], &argv[1]);
+
+       return 0;
+}
+
+static int ut_303redact_def_param(int argc, const char **argv)
+{
+       struct key_value_info kvi = KVI_INIT;
+
+       if (argc < 2)
+               die("expect <key> <value>");
+
+       trace2_def_param(argv[0], argv[1], &kvi);
+
+       return 0;
+}
+
 /*
  * Usage:
  *     test-tool trace2 <ut_name_1> <ut_usage_1>
@@ -438,6 +488,11 @@ static struct unit_test ut_table[] = {
 
        { ut_200counter,  "200counter", "<v1> [<v2> [<v3> [...]]]" },
        { ut_201counter,  "201counter", "<v1> <v2> <threads>" },
+
+       { ut_300redact_start,       "300redact_start",       "<argv...>" },
+       { ut_301redact_child_start, "301redact_child_start", "<argv...>" },
+       { ut_302redact_exec,        "302redact_exec",        "<exe> <argv...>" },
+       { ut_303redact_def_param,   "303redact_def_param",   "<key> <value>" },
 };
 /* clang-format on */
 
index 83b83c9abb5089186adfd4ac0b647b6f4c673820..add11e88fc00d7c452f62c0f6da0835fd12f53a2 100644 (file)
@@ -13,7 +13,7 @@ test_lazy_prereq GPG '
        gpg_version=$(gpg --version 2>&1)
        test $? != 127 || exit 1
 
-       # As said here: http://www.gnupg.org/documentation/faqs.html#q6.19
+       # As said here: https://web.archive.org/web/20130212022238/https://www.gnupg.org/faq/gnupg-faq.html#why-does-gnupg-1.0.6-bail-out-on-keyrings-used-with-1.0.7
        # the gpg version 1.0.6 did not parse trust packets correctly, so for
        # that version, creation of signed tags using the generated key fails.
        case "$gpg_version" in
index 5fe3c8ab69d166b79f6c3ebcfe6e1d497ba17d15..dbc99775934bbe9eb10f6a4ec6be43962615d90a 100644 (file)
@@ -67,7 +67,8 @@ for DEFAULT_HTTPD_MODULE_PATH in '/usr/libexec/apache2' \
                                 '/usr/lib/apache2/modules' \
                                 '/usr/lib64/httpd/modules' \
                                 '/usr/lib/httpd/modules' \
-                                '/usr/libexec/httpd'
+                                '/usr/libexec/httpd' \
+                                '/usr/lib/apache2'
 do
        if test -d "$DEFAULT_HTTPD_MODULE_PATH"
        then
@@ -127,6 +128,20 @@ else
                "Could not identify web server at '$LIB_HTTPD_PATH'"
 fi
 
+if test -n "$LIB_HTTPD_DAV" && test -f /etc/os-release
+then
+       case "$(grep "^ID=" /etc/os-release | cut -d= -f2-)" in
+       alpine)
+               # The WebDAV module in Alpine Linux is broken at least up to
+               # Alpine v3.16 as the default DBM driver is missing.
+               #
+               # https://gitlab.alpinelinux.org/alpine/aports/-/issues/13112
+               test_skip_or_die GIT_TEST_HTTPD \
+                       "Apache WebDAV module does not have default DBM backend driver"
+               ;;
+       esac
+fi
+
 install_script () {
        write_script "$HTTPD_ROOT_PATH/$1" <"$TEST_PATH/$1"
 }
index e7786775a9016151e063335047256bfea93d2f63..def22e70aed351e67288ac869a94180b72b2b06c 100644 (file)
@@ -15,7 +15,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 
 # These variables must be set before the inclusion of test-lib.sh below,
 # because it will change our working directory.
index 8fdef88b65e77bd03b9db8fc287914022ab10848..ec974867e4337ca503cb817fd79926193c518710 100755 (executable)
@@ -376,7 +376,7 @@ test_expect_success 'OPT_CMDMODE() detects incompatibility (1)' '
        test_must_be_empty output &&
        test_grep "mode1" output.err &&
        test_grep "mode2" output.err &&
-       test_grep "is incompatible with" output.err
+       test_grep "cannot be used together" output.err
 '
 
 test_expect_success 'OPT_CMDMODE() detects incompatibility (2)' '
@@ -384,7 +384,7 @@ test_expect_success 'OPT_CMDMODE() detects incompatibility (2)' '
        test_must_be_empty output &&
        test_grep "mode2" output.err &&
        test_grep "set23" output.err &&
-       test_grep "is incompatible with" output.err
+       test_grep "cannot be used together" output.err
 '
 
 test_expect_success 'OPT_CMDMODE() detects incompatibility (3)' '
@@ -392,7 +392,7 @@ test_expect_success 'OPT_CMDMODE() detects incompatibility (3)' '
        test_must_be_empty output &&
        test_grep "mode2" output.err &&
        test_grep "set23" output.err &&
-       test_grep "is incompatible with" output.err
+       test_grep "cannot be used together" output.err
 '
 
 test_expect_success 'OPT_CMDMODE() detects incompatibility (4)' '
@@ -401,7 +401,7 @@ test_expect_success 'OPT_CMDMODE() detects incompatibility (4)' '
        test_must_be_empty output &&
        test_grep "mode2" output.err &&
        test_grep "mode34.3" output.err &&
-       test_grep "is incompatible with" output.err
+       test_grep "cannot be used together" output.err
 '
 
 test_expect_success 'OPT_COUNTUP() with PARSE_OPT_NODASH works' '
index 487bc8d9054c908f97bc376005c3fd1eedd107b9..f18f9284a5bf3961a3f5373f887b808e55cd9b75 100755 (executable)
@@ -53,4 +53,62 @@ test_expect_success 'missing sideband designator is reported' '
        test_grep "missing sideband" err
 '
 
+test_expect_success 'unpack-sideband: --no-chomp-newline' '
+       test_when_finished "rm -f expect-out expect-err" &&
+       test-tool pkt-line send-split-sideband >split-sideband &&
+       test-tool pkt-line unpack-sideband \
+               --no-chomp-newline <split-sideband >out 2>err &&
+       cat >expect-out <<-EOF &&
+               primary: regular output
+       EOF
+       cat >expect-err <<-EOF &&
+               Foo.
+               Bar.
+               Hello, world!
+       EOF
+       test_cmp expect-out out &&
+       test_cmp expect-err err
+'
+
+test_expect_success 'unpack-sideband: --chomp-newline (default)' '
+       test_when_finished "rm -f expect-out expect-err" &&
+       test-tool pkt-line send-split-sideband >split-sideband &&
+       test-tool pkt-line unpack-sideband \
+               --chomp-newline <split-sideband >out 2>err &&
+       printf "primary: regular output" >expect-out &&
+       printf "Foo.Bar.Hello, world!" >expect-err &&
+       test_cmp expect-out out &&
+       test_cmp expect-err err
+'
+
+test_expect_success 'unpack-sideband: packet_reader_read() consumes sideband, no chomp payload' '
+       test_when_finished "rm -f expect-out expect-err" &&
+       test-tool pkt-line send-split-sideband >split-sideband &&
+       test-tool pkt-line unpack-sideband \
+               --reader-use-sideband \
+               --no-chomp-newline <split-sideband >out 2>err &&
+       cat >expect-out <<-EOF &&
+               primary: regular output
+       EOF
+       printf "remote: Foo.        \n"           >expect-err &&
+       printf "remote: Bar.        \n"          >>expect-err &&
+       printf "remote: Hello, world!        \n" >>expect-err &&
+       test_cmp expect-out out &&
+       test_cmp expect-err err
+'
+
+test_expect_success 'unpack-sideband: packet_reader_read() consumes sideband, chomp payload' '
+       test_when_finished "rm -f expect-out expect-err" &&
+       test-tool pkt-line send-split-sideband >split-sideband &&
+       test-tool pkt-line unpack-sideband \
+               --reader-use-sideband \
+               --chomp-newline <split-sideband >out 2>err &&
+       printf "primary: regular output" >expect-out &&
+       printf "remote: Foo.        \n"           >expect-err &&
+       printf "remote: Bar.        \n"          >>expect-err &&
+       printf "remote: Hello, world!        \n" >>expect-err &&
+       test_cmp expect-out out &&
+       test_cmp expect-err err
+'
+
 test_done
index 2cbf7b95907384b4b4b5ac91f801026810b85f0a..47d96a2a13f93b235f6f3d0c9f8f06922f6ee872 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-use 5.008;
+use 5.008001;
 use lib (split(/:/, $ENV{GITPERLLIB}));
 use strict;
 use warnings;
index 80e76a4695ed8d5abbaf8deb1ea2a55d2f535d41..c312657a12cd34334ce58361c7f0a73f384daff6 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description='test trace2 facility (normal target)'
 
-TEST_PASSES_SANITIZE_LEAK=true
+TEST_PASSES_SANITIZE_LEAK=false
 . ./test-lib.sh
 
 # Turn off any inherited trace2 settings for this test.
@@ -283,4 +283,22 @@ test_expect_success 'using global config with include' '
        test_cmp expect actual
 '
 
+test_expect_success 'unsafe URLs are redacted by default' '
+       test_when_finished \
+               "rm -r trace.normal unredacted.normal clone clone2" &&
+
+       test_config_global \
+               "url.$(pwd).insteadOf" https://user:pwd@example.com/ &&
+       test_config_global trace2.configParams "core.*,remote.*.url" &&
+
+       GIT_TRACE2="$(pwd)/trace.normal" \
+               git clone https://user:pwd@example.com/ clone &&
+       ! grep user:pwd trace.normal &&
+
+       GIT_TRACE2_REDACT=0 GIT_TRACE2="$(pwd)/unredacted.normal" \
+               git clone https://user:pwd@example.com/ clone2 &&
+       grep "start .* clone https://user:pwd@example.com" unredacted.normal &&
+       grep "remote.origin.url=https://user:pwd@example.com" unredacted.normal
+'
+
 test_done
index cfba6861322e373c64897e4c543838b7879cf3e0..290b6eaaab16052b84ca3c4e5527c8910f67ebf0 100755 (executable)
@@ -2,7 +2,7 @@
 
 test_description='test trace2 facility (perf target)'
 
-TEST_PASSES_SANITIZE_LEAK=true
+TEST_PASSES_SANITIZE_LEAK=false
 . ./test-lib.sh
 
 # Turn off any inherited trace2 settings for this test.
@@ -268,4 +268,23 @@ test_expect_success PTHREADS 'global counter test/test2' '
        have_counter_event "main" "counter" "test" "test2" 60 actual
 '
 
+test_expect_success 'unsafe URLs are redacted by default' '
+       test_when_finished \
+               "rm -r actual trace.perf unredacted.perf clone clone2" &&
+
+       test_config_global \
+               "url.$(pwd).insteadOf" https://user:pwd@example.com/ &&
+       test_config_global trace2.configParams "core.*,remote.*.url" &&
+
+       GIT_TRACE2_PERF="$(pwd)/trace.perf" \
+               git clone https://user:pwd@example.com/ clone &&
+       ! grep user:pwd trace.perf &&
+
+       GIT_TRACE2_REDACT=0 GIT_TRACE2_PERF="$(pwd)/unredacted.perf" \
+               git clone https://user:pwd@example.com/ clone2 &&
+       perl "$TEST_DIRECTORY/t0211/scrub_perf.perl" <unredacted.perf >actual &&
+       grep "d0|main|start|.* clone https://user:pwd@example.com" actual &&
+       grep "d0|main|def_param|.*|remote.origin.url:https://user:pwd@example.com" actual
+'
+
 test_done
index 6d3374ff773c1ef3b612b2a0df9aa9df4525790e..147643d582643efebf794000fa48e3d460c76173 100755 (executable)
@@ -323,4 +323,44 @@ test_expect_success 'discard traces when there are too many files' '
        head -n2 trace_target_dir/git-trace2-discard | tail -n1 | grep \"event\":\"too_many_files\"
 '
 
+# In the following "...redact..." tests, skip testing the GIT_TRACE2_REDACT=0
+# case because we would need to exactly model the full JSON event stream like
+# we did in the basic tests above and I do not think it is worth it.
+
+test_expect_success 'unsafe URLs are redacted by default in cmd_start events' '
+       test_when_finished \
+               "rm -r trace.event" &&
+
+       GIT_TRACE2_EVENT="$(pwd)/trace.event" \
+               test-tool trace2 300redact_start git clone https://user:pwd@example.com/ clone2 &&
+       ! grep user:pwd trace.event
+'
+
+test_expect_success 'unsafe URLs are redacted by default in child_start events' '
+       test_when_finished \
+               "rm -r trace.event" &&
+
+       GIT_TRACE2_EVENT="$(pwd)/trace.event" \
+               test-tool trace2 301redact_child_start git clone https://user:pwd@example.com/ clone2 &&
+       ! grep user:pwd trace.event
+'
+
+test_expect_success 'unsafe URLs are redacted by default in exec events' '
+       test_when_finished \
+               "rm -r trace.event" &&
+
+       GIT_TRACE2_EVENT="$(pwd)/trace.event" \
+               test-tool trace2 302redact_exec git clone https://user:pwd@example.com/ clone2 &&
+       ! grep user:pwd trace.event
+'
+
+test_expect_success 'unsafe URLs are redacted by default in def_param events' '
+       test_when_finished \
+               "rm -r trace.event" &&
+
+       GIT_TRACE2_EVENT="$(pwd)/trace.event" \
+               test-tool trace2 303redact_def_param url https://user:pwd@example.com/ &&
+       ! grep user:pwd trace.event
+'
+
 test_done
index 5b7bee888d567b5b55e2d4e7c53849db8945fdcb..6b6424b3df17135666b332b7857ec8382c813ece 100755 (executable)
@@ -49,7 +49,7 @@ test_expect_success 'convert shallow clone to partial clone' '
        test_cmp_config -C client 1 core.repositoryformatversion
 '
 
-test_expect_success SHA1 'convert to partial clone with noop extension' '
+test_expect_success SHA1,REFFILES 'convert to partial clone with noop extension' '
        rm -fr server client &&
        test_create_repo server &&
        test_commit -C server my_commit 1 &&
@@ -60,7 +60,7 @@ test_expect_success SHA1 'convert to partial clone with noop extension' '
        git -C client fetch --unshallow --filter="blob:none"
 '
 
-test_expect_success SHA1 'converting to partial clone fails with unrecognized extension' '
+test_expect_success SHA1,REFFILES 'converting to partial clone fails with unrecognized extension' '
        rm -fr server client &&
        test_create_repo server &&
        test_commit -C server my_commit 1 &&
index d73a0be1b9d1bfa3e0f1fd96e69c0e78ad2dec06..e0c6482797e1203a9e97ec27714d5ea48aaf1b6c 100755 (executable)
@@ -6,7 +6,7 @@ test_description='git cat-file'
 
 test_cmdmode_usage () {
        test_expect_code 129 "$@" 2>err &&
-       grep "^error:.*is incompatible with" err
+       grep "^error: .* cannot be used together" err
 }
 
 for switches in \
@@ -1100,6 +1100,42 @@ test_expect_success 'cat-file --batch="batman" with --batch-all-objects will wor
        cmp expect actual
 '
 
+test_expect_success 'cat-file %(objectsize:disk) with --batch-all-objects' '
+       # our state has both loose and packed objects,
+       # so find both for our expected output
+       {
+               find .git/objects/?? -type f |
+               awk -F/ "{ print \$0, \$3\$4 }" |
+               while read path oid
+               do
+                       size=$(test_file_size "$path") &&
+                       echo "$oid $size" ||
+                       return 1
+               done &&
+               rawsz=$(test_oid rawsz) &&
+               find .git/objects/pack -name "*.idx" |
+               while read idx
+               do
+                       git show-index <"$idx" >idx.raw &&
+                       sort -nr <idx.raw >idx.sorted &&
+                       packsz=$(test_file_size "${idx%.idx}.pack") &&
+                       end=$((packsz - rawsz)) &&
+                       while read start oid rest
+                       do
+                               size=$((end - start)) &&
+                               end=$start &&
+                               echo "$oid $size" ||
+                               return 1
+                       done <idx.sorted ||
+                       return 1
+               done
+       } >expect.raw &&
+       sort <expect.raw >expect &&
+       git cat-file --batch-all-objects \
+               --batch-check="%(objectname) %(objectsize:disk)" >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success 'set up replacement object' '
        orig=$(git rev-parse HEAD) &&
        git cat-file commit $orig >orig &&
index 9ac4b7036bf7ec8fe0befca6f08797c83a72c4b0..c41cd9b6bf91b2fece4e5139613f59584e882e8f 100755 (executable)
@@ -354,14 +354,28 @@ test_expect_success "verifying $m's log (logged by config)" '
 '
 
 test_expect_success 'set up for querying the reflog' '
+       git update-ref -d $m &&
+       test-tool ref-store main delete-reflog $m &&
+
+       GIT_COMMITTER_DATE="1117150320 -0500" git update-ref $m $C &&
+       GIT_COMMITTER_DATE="1117150350 -0500" git update-ref $m $A &&
+       GIT_COMMITTER_DATE="1117150380 -0500" git update-ref $m $B &&
+       GIT_COMMITTER_DATE="1117150680 -0500" git update-ref $m $F &&
+       GIT_COMMITTER_DATE="1117150980 -0500" git update-ref $m $E &&
        git update-ref $m $D &&
-       cat >.git/logs/$m <<-EOF
+       # Delete the last reflog entry so that the tip of m and the reflog for
+       # it disagree.
+       git reflog delete $m@{0} &&
+
+       cat >expect <<-EOF &&
        $Z $C $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
        $C $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150350 -0500
        $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
-       $F $Z $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
-       $Z $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
+       $B $F $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
+       $F $E $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150980 -0500
        EOF
+       test-tool ref-store main for-each-reflog-ent $m >actual &&
+       test_cmp expect actual
 '
 
 ed="Thu, 26 May 2005 18:32:00 -0500"
@@ -409,13 +423,12 @@ test_expect_success 'Query "main@{2005-05-26 23:33:01}" (middle of history with
        test_when_finished "rm -f o e" &&
        git rev-parse --verify "main@{2005-05-26 23:33:01}" >o 2>e &&
        echo "$B" >expect &&
-       test_cmp expect o &&
-       test_grep -F "warning: log for ref $m has gap after $gd" e
+       test_cmp expect o
 '
 test_expect_success 'Query "main@{2005-05-26 23:38:00}" (middle of history)' '
        test_when_finished "rm -f o e" &&
        git rev-parse --verify "main@{2005-05-26 23:38:00}" >o 2>e &&
-       echo "$Z" >expect &&
+       echo "$F" >expect &&
        test_cmp expect o &&
        test_must_be_empty e
 '
@@ -436,6 +449,22 @@ test_expect_success 'Query "main@{2005-05-28}" (past end of history)' '
 
 rm -f .git/$m .git/logs/$m expect
 
+test_expect_success REFFILES 'query reflog with gap' '
+       test_when_finished "git update-ref -d $m" &&
+
+       git update-ref $m $F &&
+       cat >.git/logs/$m <<-EOF &&
+       $Z $A $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150320 -0500
+       $A $B $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150380 -0500
+       $D $F $GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL> 1117150680 -0500
+       EOF
+
+       git rev-parse --verify "main@{2005-05-26 23:33:01}" >actual 2>stderr &&
+       echo "$B" >expect &&
+       test_cmp expect actual &&
+       test_grep -F "warning: log for ref $m has gap after $gd" stderr
+'
+
 test_expect_success 'creating initial files' '
        test_when_finished rm -f M &&
        echo TEST >F &&
index c7745e1bf69e910c2d66a61bb8bef36b45473a56..3241d3591799415e423e4f6155e4111de778a964 100755 (executable)
@@ -171,8 +171,8 @@ test_expect_success 'symbolic-ref refuses invalid target for non-HEAD' '
 '
 
 test_expect_success 'symbolic-ref allows top-level target for non-HEAD' '
-       git symbolic-ref refs/heads/top-level FETCH_HEAD &&
-       git update-ref FETCH_HEAD HEAD &&
+       git symbolic-ref refs/heads/top-level ORIG_HEAD &&
+       git update-ref ORIG_HEAD HEAD &&
        test_cmp_rev top-level HEAD
 '
 
index b50ae6fcf115abe384444db1ef0ddbf04ce247d3..872ba8f1101a41f0d42d9c4ee43f6b95c63fc95b 100755 (executable)
@@ -197,18 +197,20 @@ test_expect_success 'show-ref --verify with dangling ref' '
 '
 
 test_expect_success 'show-ref sub-modes are mutually exclusive' '
-       cat >expect <<-EOF &&
-       fatal: only one of ${SQ}--exclude-existing${SQ}, ${SQ}--verify${SQ} or ${SQ}--exists${SQ} can be given
-       EOF
-
        test_must_fail git show-ref --verify --exclude-existing 2>err &&
-       test_cmp expect err &&
+       grep "verify" err &&
+       grep "exclude-existing" err &&
+       grep "cannot be used together" err &&
 
        test_must_fail git show-ref --verify --exists 2>err &&
-       test_cmp expect err &&
+       grep "verify" err &&
+       grep "exists" err &&
+       grep "cannot be used together" err &&
 
        test_must_fail git show-ref --exclude-existing --exists 2>err &&
-       test_cmp expect err
+       grep "exclude-existing" err &&
+       grep "exists" err &&
+       grep "cannot be used together" err
 '
 
 test_expect_success '--exists with existing reference' '
@@ -260,9 +262,9 @@ test_expect_success '--exists with non-commit object' '
 
 test_expect_success '--exists with directory fails with generic error' '
        cat >expect <<-EOF &&
-       error: failed to look up reference: Is a directory
+       error: reference does not exist
        EOF
-       test_expect_code 1 git show-ref --exists refs/heads 2>err &&
+       test_expect_code 2 git show-ref --exists refs/heads 2>err &&
        test_cmp expect err
 '
 
index aeddc2fb3f69516921733c49ad6211c00bf066d3..a0ff8d51f04b2d9ad34060a4f42290577d6673f7 100755 (executable)
@@ -469,11 +469,11 @@ test_expect_success 'expire one of multiple worktrees' '
        )
 '
 
-test_expect_success REFFILES 'empty reflog' '
+test_expect_success 'empty reflog' '
        test_when_finished "rm -rf empty" &&
        git init empty &&
        test_commit -C empty A &&
-       >empty/.git/logs/refs/heads/foo &&
+       test-tool ref-store main create-reflog refs/heads/foo &&
        git -C empty reflog expire --all 2>err &&
        test_must_be_empty err
 '
index 14f13b57c6d2017d199a5d91d6908665c7f2671d..0eb5e674bc1f0dbc688523dd3f94a5e5bb32b6d7 100755 (executable)
@@ -14,9 +14,13 @@ test_expect_success 'setup' '
                test_commit B &&
                test_commit C &&
 
-               cp .git/logs/HEAD HEAD.old &&
+               git reflog HEAD >expect &&
                git reset --hard HEAD~ &&
-               cp HEAD.old .git/logs/HEAD
+               # Make sure that the reflog does not point to the same commit
+               # as HEAD.
+               git reflog delete HEAD@{0} &&
+               git reflog HEAD >actual &&
+               test_cmp expect actual
        )
 '
 
@@ -25,7 +29,7 @@ test_reflog_updateref () {
        shift
        args="$@"
 
-       test_expect_success REFFILES "get '$exp' with '$args'"  '
+       test_expect_success "get '$exp' with '$args'"  '
                test_when_finished "rm -rf copy" &&
                cp -R repo copy &&
 
index df4aff7825c9f8430d7449d1bdf2b0d5045d397a..4b7627e8529a5b5fd33fe5344108cee83ee22a80 100755 (executable)
@@ -415,7 +415,7 @@ test_wt_add_orphan_hint () {
                git -C repo switch --orphan noref &&
                test_must_fail git -C repo worktree add $opts foobar/ 2>actual &&
                ! grep "error: unknown switch" actual &&
-               grep "hint: If you meant to create a worktree containing a new orphan branch" actual &&
+               grep "hint: If you meant to create a worktree containing a new unborn branch" actual &&
                if [ $use_branch -eq 1 ]
                then
                        grep -E "^hint: +git worktree add --orphan -b [^ ]+ [^ ]+$" actual
@@ -436,7 +436,7 @@ test_expect_success "'worktree add' doesn't show orphan hint in bad/orphan HEAD
        (cd repo && test_commit commit) &&
        test_must_fail git -C repo worktree add --quiet foobar_branch foobar/ 2>actual &&
        ! grep "error: unknown switch" actual &&
-       ! grep "hint: If you meant to create a worktree containing a new orphan branch" actual
+       ! grep "hint: If you meant to create a worktree containing a new unborn branch" actual
 '
 
 test_expect_success 'local clone from linked checkout' '
@@ -709,9 +709,9 @@ test_expect_success 'git worktree --no-guess-remote option overrides config' '
 test_dwim_orphan () {
        local info_text="No possible source branch, inferring '--orphan'" &&
        local fetch_error_text="fatal: No local or remote refs exist despite at least one remote" &&
-       local orphan_hint="hint: If you meant to create a worktree containing a new orphan branch" &&
+       local orphan_hint="hint: If you meant to create a worktree containing a new unborn branch" &&
        local invalid_ref_regex="^fatal: invalid reference: " &&
-       local bad_combo_regex="^fatal: '[-a-z]*' and '[-a-z]*' cannot be used together" &&
+       local bad_combo_regex="^fatal: options '[-a-z]*' and '[-a-z]*' cannot be used together" &&
 
        local git_ns="repo" &&
        local dashc_args="-C $git_ns" &&
index 60d6ed2dc8438a22439d55432d5664ea2080b9f0..597df5ebc0a582018d30c018e734d1154c364ed6 100755 (executable)
@@ -561,9 +561,9 @@ y and z notes on 4th commit
 EOF
        # Fail to finalize merge
        test_must_fail git notes merge --commit >output 2>&1 &&
-       # .git/NOTES_MERGE_* must remain
-       test -f .git/NOTES_MERGE_PARTIAL &&
-       test -f .git/NOTES_MERGE_REF &&
+       # NOTES_MERGE_* refs and .git/NOTES_MERGE_* state files must remain
+       git rev-parse --verify NOTES_MERGE_PARTIAL &&
+       git rev-parse --verify NOTES_MERGE_REF &&
        test -f .git/NOTES_MERGE_WORKTREE/$commit_sha1 &&
        test -f .git/NOTES_MERGE_WORKTREE/$commit_sha2 &&
        test -f .git/NOTES_MERGE_WORKTREE/$commit_sha3 &&
index 34faeac3f1cde42633fc5a8b8b67cbf14d57edaf..3caf490e3996ec4379e84c6adfe5505723931622 100755 (executable)
@@ -1516,4 +1516,56 @@ test_expect_success 'restore untracked files even when we hit conflicts' '
        )
 '
 
+test_expect_success 'stash create reports a locked index' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A A.file &&
+               echo change >A.file &&
+               touch .git/index.lock &&
+
+               cat >expect <<-EOF &&
+               error: could not write index
+               EOF
+               test_must_fail git stash create 2>err &&
+               test_cmp expect err
+       )
+'
+
+test_expect_success 'stash push reports a locked index' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A A.file &&
+               echo change >A.file &&
+               touch .git/index.lock &&
+
+               cat >expect <<-EOF &&
+               error: could not write index
+               EOF
+               test_must_fail git stash push 2>err &&
+               test_cmp expect err
+       )
+'
+
+test_expect_success 'stash apply reports a locked index' '
+       test_when_finished "rm -rf repo" &&
+       git init repo &&
+       (
+               cd repo &&
+               test_commit A A.file &&
+               echo change >A.file &&
+               git stash push &&
+               touch .git/index.lock &&
+
+               cat >expect <<-EOF &&
+               error: could not write index
+               EOF
+               test_must_fail git stash apply 2>err &&
+               test_cmp expect err
+       )
+'
+
 test_done
index 85be1367de6a3f73e1162ffc03563ec7b9a9eb5a..49c042a38ae987fa95f201bd3a00f55e4adeffab 100755 (executable)
@@ -286,4 +286,28 @@ test_expect_success 'basename similarity vs best similarity' '
        test_cmp expected actual
 '
 
+test_expect_success 'last line matters too' '
+       {
+               test_write_lines a 0 1 2 3 4 5 6 7 8 9 &&
+               printf "git ignores final up to 63 characters if not newline terminated"
+       } >no-final-lf &&
+       git add no-final-lf &&
+       git commit -m "original version of file with no final newline" &&
+
+       # Change ONLY the first character of the whole file
+       {
+               test_write_lines b 0 1 2 3 4 5 6 7 8 9 &&
+               printf "git ignores final up to 63 characters if not newline terminated"
+       } >no-final-lf &&
+       git add no-final-lf &&
+       git mv no-final-lf still-absent-final-lf &&
+       git commit -a -m "rename no-final-lf -> still-absent-final-lf" &&
+       git diff-tree -r -M --name-status HEAD^ HEAD >actual &&
+       sed -e "s/^R[0-9]*      /R      /" actual >actual.munged &&
+       cat >expected <<-\EOF &&
+       R       no-final-lf     still-absent-final-lf
+       EOF
+       test_cmp expected actual.munged
+'
+
 test_done
index 5cc17c2e0da6fdfff7e7a4a2fa87744d81b1f7c4..1a7e2b0bcb5e3a3024ed482c855af6acfbe41e4e 100755 (executable)
@@ -178,32 +178,29 @@ process_diffs () {
 V=$(git version | sed -e 's/^git version //' -e 's/\./\\./g')
 while read magic cmd
 do
-       status=success
        case "$magic" in
        '' | '#'*)
                continue ;;
-       :*)
-               magic=${magic#:}
+       :noellipses)
+               magic=noellipses
                label="$magic-$cmd"
-               case "$magic" in
-               noellipses) ;;
-               failure)
-                       status=failure
-                       magic=
-                       label="$cmd" ;;
-               *)
-                       BUG "unknown magic $magic" ;;
-               esac ;;
+               ;;
+       :*)
+               BUG "unknown magic $magic"
+               ;;
        *)
-               cmd="$magic $cmd" magic=
-               label="$cmd" ;;
+               cmd="$magic $cmd"
+               magic=
+               label="$cmd"
+               ;;
        esac
+
        test=$(echo "$label" | sed -e 's|[/ ][/ ]*|_|g')
        pfx=$(printf "%04d" $test_count)
        expect="$TEST_DIRECTORY/t4013/diff.$test"
        actual="$pfx-diff.$test"
 
-       test_expect_$status "git $cmd # magic is ${magic:-(not used)}" '
+       test_expect_success "git $cmd # magic is ${magic:-(not used)}" '
                {
                        echo "$ git $cmd"
                        case "$magic" in
@@ -666,4 +663,10 @@ test_expect_success 'diff --default-prefix overrides diff.mnemonicprefix' '
        check_prefix actual a/file0 b/file0
 '
 
+test_expect_success 'diff --no-renames cannot be abbreviated' '
+       test_expect_code 129 git diff --no-rename >actual 2>error &&
+       test_must_be_empty actual &&
+       grep "invalid option: --no-rename" error
+'
+
 test_done
index 5ce345d309eb70425b9c04cdbfa57d1611675af8..651ec776606bb0990edc40bebf13ccc4937bb0ce 100755 (executable)
@@ -205,6 +205,18 @@ test_expect_success POSIXPERM,SYMLINKS 'diff --no-index normalizes: mode not lik
        test_cmp expected actual
 '
 
+test_expect_success POSIXPERM 'external diff with mode-only change' '
+       echo content >not-executable &&
+       echo content >executable &&
+       chmod +x executable &&
+       echo executable executable $(test_oid zero) 100755 \
+               not-executable $(test_oid zero) 100644 not-executable \
+               >expect &&
+       test_expect_code 1 git -c diff.external=echo diff \
+               --no-index executable not-executable >actual &&
+       test_cmp expect actual
+'
+
 test_expect_success "diff --no-index treats '-' as stdin" '
        cat >expect <<-EOF &&
        diff --git a/- b/a/1
index b2c8a43fce311570e358d77a3b062228adcbbf68..12ac43687366d72f2fa2870c72a9d5563a05fc66 100755 (executable)
@@ -887,7 +887,7 @@ test_expect_success '--stdin with both a successful and a conflicted merge' '
 test_expect_success '--merge-base is incompatible with --stdin' '
        test_must_fail git merge-tree --merge-base=side1 --stdin 2>expect &&
 
-       grep "^fatal: --merge-base is incompatible with --stdin" expect
+       grep "^fatal: .*merge-base.*stdin.* cannot be used together" expect
 '
 
 # specify merge-base as parent of branch2
index 4b4c3315d885f02fdcf2be65885ea9107f65b86d..72b8d0ff02e34be0606747c850b0815be31196d4 100755 (executable)
@@ -124,6 +124,16 @@ test_expect_success 'setup' '
        EOF
 '
 
+test_expect_success '--list notices extra parameters' '
+       test_must_fail git archive --list blah &&
+       test_must_fail git archive --remote=. --list blah
+'
+
+test_expect_success 'end-of-options is correctly eaten' '
+       git archive --list --end-of-options &&
+       git archive --remote=. --list --end-of-options
+'
+
 test_expect_success 'populate workdir' '
        mkdir a &&
        echo simple textfile >a/a &&
index db11cababd310f9773dcd0a3bb7039a4df8d4f59..654d8cf3ee003ee4e8d66b6e88df06312014cb47 100755 (executable)
@@ -268,4 +268,26 @@ test_expect_success 'mailinfo warn CR in base64 encoded email' '
        test_must_be_empty quoted-cr/0002.err
 '
 
+test_expect_success 'from line with unterminated quoted string' '
+       echo "From: bob \"unterminated string smith <bob@example.com>" >in &&
+       git mailinfo /dev/null /dev/null <in >actual &&
+       cat >expect <<-\EOF &&
+       Author: bob unterminated string smith
+       Email: bob@example.com
+
+       EOF
+       test_cmp expect actual
+'
+
+test_expect_success 'from line with unterminated comment' '
+       echo "From: bob (unterminated comment smith <bob@example.com>" >in &&
+       git mailinfo /dev/null /dev/null <in >actual &&
+       cat >expect <<-\EOF &&
+       Author: bob (unterminated comment smith
+       Email: bob@example.com
+
+       EOF
+       test_cmp expect actual
+'
+
 test_done
index 72281779843fb270762b5352b8dc213bd3b805e1..bd71956a474531775de56ac26757484a76025676 100644 (file)
@@ -1,4 +1,4 @@
-Author: A U Thor (this is (really) a comment (honestly))
+Author: (this is (really) a "comment" (honestly)) A U Thor
 Email: somebody@example.com
 Subject: testing comments
 Date: Sun, 25 May 2008 00:38:18 -0700
index c53a192dfeac51a32000d80f4f8052eef6e44486..0b7e903b061131b30a258d30b11cd9cc22acae5d 100644 (file)
@@ -1,5 +1,5 @@
 From 1234567890123456789012345678901234567890 Mon Sep 17 00:00:00 2001
-From: "A U Thor" <somebody@example.com> (this is \(really\) a comment (honestly))
+From: (this is \(really\) a "comment" (honestly)) "A U Thor" <somebody@example.com>
 Date: Sun, 25 May 2008 00:38:18 -0700
 Subject: [PATCH] testing comments
 
index d4fc65e078e4bf395ad1c83bba285f672d0785cd..4c751a6871db5f41e64b3e060a6d728212458bed 100755 (executable)
@@ -909,10 +909,10 @@ test_expect_success 'stale commit cannot be parsed when given directly' '
 
                # Verify that it is possible to read the commit from the
                # commit graph when not being paranoid, ...
-               GIT_COMMIT_GRAPH_PARANOIA=false git rev-list B &&
+               git rev-list B &&
                # ... but parsing the commit when double checking that
                # it actually exists in the object database should fail.
-               test_must_fail git rev-list -1 B
+               test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-list -1 B
        )
 '
 
@@ -936,9 +936,9 @@ test_expect_success 'stale commit cannot be parsed when traversing graph' '
 
                # Again, we should be able to parse the commit when not
                # being paranoid about commit graph staleness...
-               GIT_COMMIT_GRAPH_PARANOIA=false git rev-parse HEAD~2 &&
+               git rev-parse HEAD~2 &&
                # ... but fail when we are paranoid.
-               test_must_fail git rev-parse HEAD~2 2>error &&
+               test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git rev-parse HEAD~2 2>error &&
                grep "error: commit $oid exists in commit-graph but not in the object database" error
        )
 '
index 001b7a17ad2bb93610198ebf134ccbedc2781f00..8b8bc47dc0b9d6a8d90928c628bbe122d5d04f31 100755 (executable)
@@ -133,10 +133,8 @@ test_expect_success 'pre-receive hook that forgets to read its input' '
        EOF
        rm -f victim.git/hooks/update victim.git/hooks/post-update &&
 
-       for v in $(test_seq 100 999)
-       do
-               git branch branch_$v main || return
-       done &&
+       printf "create refs/heads/branch_%d main\n" $(test_seq 100 999) >input &&
+       git update-ref --stdin <input &&
        git push ./victim.git "+refs/heads/*:refs/heads/*"
 '
 
index dcadd56d3a6f473fc2fc11f5a3e55261d8c0cc13..91e87b1dd3a5dceb8af2ab614e1d968866dc8b28 100755 (executable)
@@ -802,7 +802,8 @@ test_expect_success 'fetch.writeCommitGraph with submodules' '
                cd super-clone &&
                rm -rf .git/objects/info &&
                git -c fetch.writeCommitGraph=true fetch origin &&
-               test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain
+               test_path_is_file .git/objects/info/commit-graphs/commit-graph-chain &&
+               git -c fetch.writeCommitGraph=true fetch --recurse-submodules origin
        )
 '
 
index 8a41adf1e1f078712a423b0f41541afb1b5f045d..e069737b80b7bd906afa1963f7b818ffac8ed2ca 100755 (executable)
@@ -359,7 +359,9 @@ create_tags () {
 
        # now assign tags to all the dangling commits we created above
        tag=$(perl -e "print \"bla\" x 30") &&
-       sed -e "s|^:\([^ ]*\) \(.*\)$|\2 refs/tags/$tag-\1|" <marks >>packed-refs
+       sed -e "s|^:\([^ ]*\) \(.*\)$|create refs/tags/$tag-\1 \2|" <marks >input &&
+       git update-ref --stdin <input &&
+       rm input
 }
 
 test_expect_success 'create 2,000 tags in the repo' '
index 718dd9b49d493ec55e2503dcb14aa5ddcc26cc6f..9babb9a375e5fb2a66f216d1968312ec094a6d93 100644 (file)
@@ -1,4 +1,4 @@
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 
index a9b06b22510ebe58c0faafd4ac05830c1bf64f3a..5883839a04e991d6ab93a965698662ced064fe3d 100755 (executable)
@@ -61,11 +61,10 @@ test_expect_success 'fetch compact output' '
        test_cmp expect actual
 '
 
-test_expect_success 'fetch porcelain output' '
-       test_when_finished "rm -rf porcelain" &&
-
+test_expect_success 'setup for fetch porcelain output' '
        # Set up a bunch of references that we can use to demonstrate different
        # kinds of flag symbols in the output format.
+       test_commit commit-for-porcelain-output &&
        MAIN_OLD=$(git rev-parse HEAD) &&
        git branch "fast-forward" &&
        git branch "deleted-branch" &&
@@ -74,15 +73,10 @@ test_expect_success 'fetch porcelain output' '
        FORCE_UPDATED_OLD=$(git rev-parse HEAD) &&
        git checkout main &&
 
-       # Clone and pre-seed the repositories. We fetch references into two
-       # namespaces so that we can test that rejected and force-updated
-       # references are reported properly.
-       refspecs="refs/heads/*:refs/unforced/* +refs/heads/*:refs/forced/*" &&
-       git clone . porcelain &&
-       git -C porcelain fetch origin $refspecs &&
+       # Backup to preseed.git
+       git clone --mirror . preseed.git &&
 
-       # Now that we have set up the client repositories we can change our
-       # local references.
+       # Continue changing our local references.
        git branch new-branch &&
        git branch -d deleted-branch &&
        git checkout fast-forward &&
@@ -91,36 +85,53 @@ test_expect_success 'fetch porcelain output' '
        git checkout force-updated &&
        git reset --hard HEAD~ &&
        test_commit --no-tag force-update-new &&
-       FORCE_UPDATED_NEW=$(git rev-parse HEAD) &&
-
-       cat >expect <<-EOF &&
-       - $MAIN_OLD $ZERO_OID refs/forced/deleted-branch
-       - $MAIN_OLD $ZERO_OID refs/unforced/deleted-branch
-         $MAIN_OLD $FAST_FORWARD_NEW refs/unforced/fast-forward
-       ! $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/unforced/force-updated
-       * $ZERO_OID $MAIN_OLD refs/unforced/new-branch
-         $MAIN_OLD $FAST_FORWARD_NEW refs/forced/fast-forward
-       + $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/forced/force-updated
-       * $ZERO_OID $MAIN_OLD refs/forced/new-branch
-         $MAIN_OLD $FAST_FORWARD_NEW refs/remotes/origin/fast-forward
-       + $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/remotes/origin/force-updated
-       * $ZERO_OID $MAIN_OLD refs/remotes/origin/new-branch
-       EOF
-
-       # Execute a dry-run fetch first. We do this to assert that the dry-run
-       # and non-dry-run fetches produces the same output. Execution of the
-       # fetch is expected to fail as we have a rejected reference update.
-       test_must_fail git -C porcelain fetch \
-               --porcelain --dry-run --prune origin $refspecs >actual &&
-       test_cmp expect actual &&
-
-       # And now we perform a non-dry-run fetch.
-       test_must_fail git -C porcelain fetch \
-               --porcelain --prune origin $refspecs >actual 2>stderr &&
-       test_cmp expect actual &&
-       test_must_be_empty stderr
+       FORCE_UPDATED_NEW=$(git rev-parse HEAD)
 '
 
+for opt in "" "--atomic"
+do
+       test_expect_success "fetch porcelain output ${opt:+(atomic)}" '
+               test_when_finished "rm -rf porcelain" &&
+
+               # Clone and pre-seed the repositories. We fetch references into two
+               # namespaces so that we can test that rejected and force-updated
+               # references are reported properly.
+               refspecs="refs/heads/*:refs/unforced/* +refs/heads/*:refs/forced/*" &&
+               git clone preseed.git porcelain &&
+               git -C porcelain fetch origin $opt $refspecs &&
+
+               cat >expect <<-EOF &&
+               - $MAIN_OLD $ZERO_OID refs/forced/deleted-branch
+               - $MAIN_OLD $ZERO_OID refs/unforced/deleted-branch
+                 $MAIN_OLD $FAST_FORWARD_NEW refs/unforced/fast-forward
+               ! $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/unforced/force-updated
+               * $ZERO_OID $MAIN_OLD refs/unforced/new-branch
+                 $MAIN_OLD $FAST_FORWARD_NEW refs/forced/fast-forward
+               + $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/forced/force-updated
+               * $ZERO_OID $MAIN_OLD refs/forced/new-branch
+                 $MAIN_OLD $FAST_FORWARD_NEW refs/remotes/origin/fast-forward
+               + $FORCE_UPDATED_OLD $FORCE_UPDATED_NEW refs/remotes/origin/force-updated
+               * $ZERO_OID $MAIN_OLD refs/remotes/origin/new-branch
+               EOF
+
+               # Change the URL of the repository to fetch different references.
+               git -C porcelain remote set-url origin .. &&
+
+               # Execute a dry-run fetch first. We do this to assert that the dry-run
+               # and non-dry-run fetches produces the same output. Execution of the
+               # fetch is expected to fail as we have a rejected reference update.
+               test_must_fail git -C porcelain fetch $opt \
+                       --porcelain --dry-run --prune origin $refspecs >actual &&
+               test_cmp expect actual &&
+
+               # And now we perform a non-dry-run fetch.
+               test_must_fail git -C porcelain fetch $opt \
+                       --porcelain --prune origin $refspecs >actual 2>stderr &&
+               test_cmp expect actual &&
+               test_must_be_empty stderr
+       '
+done
+
 test_expect_success 'fetch porcelain with multiple remotes' '
        test_when_finished "rm -rf porcelain" &&
 
index fc4bbd9daf4fd3bf1777699f05af9ca39ac5a954..a400bcca622f464f13fe4f0a57c4d44ec8dd827b 100755 (executable)
@@ -64,7 +64,7 @@ test_expect_success 'disallows --bundle-uri with shallow options' '
        for option in --depth=1 --shallow-since=01-01-2000 --shallow-exclude=HEAD
        do
                test_must_fail git clone --bundle-uri=bundle $option from to 2>err &&
-               grep "bundle-uri is incompatible" err || return 1
+               grep "bundle-uri.* cannot be used together" err || return 1
        done
 '
 
index 0729f800c3c95790946d68296240799c2dbbb5ad..ee0306aeec0b6e60fc9b62e7efbc5b659fbc1c72 100755 (executable)
@@ -18,20 +18,34 @@ test_expect_success 'no options' '
 '
 
 test_expect_success '--max-count' '
+       test_must_fail git rev-list --max-count=1q HEAD 2>error &&
+       grep "not an integer" error &&
+
        test_stdout_line_count = 0 git rev-list HEAD --max-count=0 &&
        test_stdout_line_count = 3 git rev-list HEAD --max-count=3 &&
        test_stdout_line_count = 5 git rev-list HEAD --max-count=5 &&
-       test_stdout_line_count = 5 git rev-list HEAD --max-count=10
+       test_stdout_line_count = 5 git rev-list HEAD --max-count=10 &&
+       test_stdout_line_count = 5 git rev-list HEAD --max-count=-1
 '
 
 test_expect_success '--max-count all forms' '
+       test_must_fail git rev-list -1q HEAD 2>error &&
+       grep "not an integer" error &&
+       test_must_fail git rev-list --1 HEAD &&
+       test_must_fail git rev-list -n 1q HEAD 2>error &&
+       grep "not an integer" error &&
+
        test_stdout_line_count = 1 git rev-list HEAD --max-count=1 &&
        test_stdout_line_count = 1 git rev-list HEAD -1 &&
        test_stdout_line_count = 1 git rev-list HEAD -n1 &&
-       test_stdout_line_count = 1 git rev-list HEAD -n 1
+       test_stdout_line_count = 1 git rev-list HEAD -n 1 &&
+       test_stdout_line_count = 5 git rev-list HEAD -n -1
 '
 
 test_expect_success '--skip' '
+       test_must_fail git rev-list --skip 1q HEAD 2>error &&
+       grep "not an integer" error &&
+
        test_stdout_line_count = 5 git rev-list HEAD --skip=0 &&
        test_stdout_line_count = 2 git rev-list HEAD --skip=3 &&
        test_stdout_line_count = 0 git rev-list HEAD --skip=5 &&
index ced40157ed68c077c17cb4758d1ebbc529e67d9c..91db8fafe83e3883923b71e36bbd8bc11bfde1f6 100755 (executable)
@@ -63,6 +63,17 @@ test_expect_success 'setup roots, merges and octopuses' '
        git checkout main
 '
 
+test_expect_success 'parse --max-parents & --min-parents' '
+       test_must_fail git rev-list --max-parents=1q HEAD 2>error &&
+       grep "not an integer" error &&
+
+       test_must_fail git rev-list --min-parents=1q HEAD 2>error &&
+       grep "not an integer" error &&
+
+       git rev-list --max-parents=1 --min-parents=1 HEAD &&
+       git rev-list --max-parents=-1 --min-parents=-1 HEAD
+'
+
 test_expect_success 'rev-list roots' '
 
        check_revlist "--max-parents=0" one five
index 67d523d40571b89b50cc5ca655ec77198c1a3ae3..3b181f771c25a3d8a074f7d0472bf1f0422f582b 100755 (executable)
@@ -214,15 +214,13 @@ do
        for pseudoopt in branches tags remotes
        do
                test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt" '
-                       echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected &&
                        test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt 2>err &&
-                       test_cmp expected err
+                       test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
                '
 
                test_expect_success "rev-parse --exclude-hidden=$section fails with --$pseudoopt=pattern" '
-                       echo "error: --exclude-hidden cannot be used together with --$pseudoopt" >expected &&
                        test_must_fail git rev-parse --exclude-hidden=$section --$pseudoopt=pattern 2>err &&
-                       test_cmp expected err
+                       test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
                '
        done
 done
index cdf7aa94276cb9e993dcad825994828322e5b3ea..51df02105d7b83c3b0b1c85f95d419ac9a4bbfe1 100755 (executable)
@@ -151,12 +151,12 @@ do
        do
                test_expect_success "$section: fails with --$pseudoopt" '
                        test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt 2>err &&
-                       test_grep "error: --exclude-hidden cannot be used together with --$pseudoopt" err
+                       test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
                '
 
                test_expect_success "$section: fails with --$pseudoopt=pattern" '
                        test_must_fail git rev-list --exclude-hidden=$section --$pseudoopt=pattern 2>err &&
-                       test_grep "error: --exclude-hidden cannot be used together with --$pseudoopt" err
+                       test_grep "error: options .--exclude-hidden. and .--$pseudoopt. cannot be used together" err
                '
        done
 done
index 40265a4f66f996501207e6a6e950f45551453cf6..211672759a2260e5a1bb572f96aad93b3d3f91e5 100755 (executable)
@@ -13,6 +13,12 @@ test_expect_success 'create repository and alternate directory' '
        test_commit 3
 '
 
+# We manually corrupt the repository, which means that the commit-graph may
+# contain references to already-deleted objects. We thus need to enable
+# commit-graph paranoia to not returned these deleted commits from the graph.
+GIT_COMMIT_GRAPH_PARANOIA=true
+export GIT_COMMIT_GRAPH_PARANOIA
+
 for obj in "HEAD~1" "HEAD~1^{tree}" "HEAD:1.t"
 do
        test_expect_success "rev-list --missing=error fails with missing object $obj" '
index 2a5b7d8379c2a9ced13f7eb85e29d0c895450e2f..7b24d1684e33aca2aa7da45375e96b217e7cd040 100755 (executable)
@@ -170,6 +170,12 @@ test_expect_success 'bisect reset when not bisecting' '
        cmp branch.expect branch.output
 '
 
+test_expect_success 'bisect reset cleans up even when not bisecting' '
+       echo garbage >.git/BISECT_LOG &&
+       git bisect reset &&
+       test_path_is_missing .git/BISECT_LOG
+'
+
 test_expect_success 'bisect reset removes packed refs' '
        git bisect reset &&
        git bisect start &&
index 00a060df0b5e81cc1c47758240a7c790384b758e..c65c795fce2a58bef7989b43ca05504bdee74193 100755 (executable)
@@ -20,12 +20,13 @@ setdate_and_increment () {
     export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
 }
 
-test_expect_success setup '
-       test_oid_cache <<-EOF &&
-       disklen sha1:138
-       disklen sha256:154
-       EOF
+test_object_file_size () {
+       oid=$(git rev-parse "$1")
+       path=".git/objects/$(test_oid_to_path $oid)"
+       test_file_size "$path"
+}
 
+test_expect_success setup '
        # setup .mailmap
        cat >.mailmap <<-EOF &&
        A Thor <athor@example.com> A U Thor <author@example.com>
@@ -94,7 +95,6 @@ test_atom () {
 }
 
 hexlen=$(test_oid hexsz)
-disklen=$(test_oid disklen)
 
 test_atom head refname refs/heads/main
 test_atom head refname: refs/heads/main
@@ -129,7 +129,7 @@ test_atom head push:strip=1 remotes/myfork/main
 test_atom head push:strip=-1 main
 test_atom head objecttype commit
 test_atom head objectsize $((131 + hexlen))
-test_atom head objectsize:disk $disklen
+test_atom head objectsize:disk $(test_object_file_size refs/heads/main)
 test_atom head deltabase $ZERO_OID
 test_atom head objectname $(git rev-parse refs/heads/main)
 test_atom head objectname:short $(git rev-parse --short refs/heads/main)
@@ -203,8 +203,8 @@ test_atom tag upstream ''
 test_atom tag push ''
 test_atom tag objecttype tag
 test_atom tag objectsize $((114 + hexlen))
-test_atom tag objectsize:disk $disklen
-test_atom tag '*objectsize:disk' $disklen
+test_atom tag objectsize:disk $(test_object_file_size refs/tags/testtag)
+test_atom tag '*objectsize:disk' $(test_object_file_size refs/heads/main)
 test_atom tag deltabase $ZERO_OID
 test_atom tag '*deltabase' $ZERO_OID
 test_atom tag objectname $(git rev-parse refs/tags/testtag)
index 2667dd13fe33893086e2bdf14a94a6f3c8648d84..83b8a19d94176dcf66d2aca1d8a4b9519ee020fe 100755 (executable)
@@ -15,7 +15,7 @@ test_expect_success setup '
        git for-each-ref --format="%(objectname) %(refname)" >brief-list
 '
 
-test_expect_success 'Broken refs are reported correctly' '
+test_expect_success REFFILES 'Broken refs are reported correctly' '
        r=refs/heads/bogus &&
        : >.git/$r &&
        test_when_finished "rm -f .git/$r" &&
@@ -25,7 +25,7 @@ test_expect_success 'Broken refs are reported correctly' '
        test_cmp broken-err err
 '
 
-test_expect_success 'NULL_SHA1 refs are reported correctly' '
+test_expect_success REFFILES 'NULL_SHA1 refs are reported correctly' '
        r=refs/heads/zeros &&
        echo $ZEROS >.git/$r &&
        test_when_finished "rm -f .git/$r" &&
@@ -39,15 +39,14 @@ test_expect_success 'NULL_SHA1 refs are reported correctly' '
 '
 
 test_expect_success 'Missing objects are reported correctly' '
-       r=refs/heads/missing &&
-       echo $MISSING >.git/$r &&
-       test_when_finished "rm -f .git/$r" &&
-       echo "fatal: missing object $MISSING for $r" >missing-err &&
+       test_when_finished "git update-ref -d refs/heads/missing" &&
+       test-tool ref-store main update-ref msg refs/heads/missing "$MISSING" "$ZERO_OID" REF_SKIP_OID_VERIFICATION &&
+       echo "fatal: missing object $MISSING for refs/heads/missing" >missing-err &&
        test_must_fail git for-each-ref 2>err &&
        test_cmp missing-err err &&
        (
                cat brief-list &&
-               echo "$MISSING $r"
+               echo "$MISSING refs/heads/missing"
        ) | sort -k 2 >missing-brief-expected &&
        git for-each-ref --format="%(objectname) %(refname)" >brief-out 2>brief-err &&
        test_cmp missing-brief-expected brief-out &&
index 4287863ae6cab9a67564c9328effd68d2c186ab6..62d9f846ce86c54745eb87619d14fefc005d6fe3 100755 (executable)
@@ -616,4 +616,12 @@ test_expect_success 'reset --mixed sets up work tree' '
        test_must_be_empty actual
 '
 
+test_expect_success 'reset handles --end-of-options' '
+       git update-ref refs/heads/--foo HEAD^ &&
+       git log -1 --format=%s refs/heads/--foo >expect &&
+       git reset --hard --end-of-options --foo &&
+       git log -1 --format=%s HEAD >actual &&
+       test_cmp expect actual
+'
+
 test_done
index c2ab8a444a832513b9365a2a6eca11535e2ec8fe..802f8f704c62eb11192bcc82ecd35f0ae53b5a6a 100755 (executable)
@@ -692,6 +692,34 @@ EOF
 '
 
 
+test_expect_success 'status when bisecting while rebasing' '
+       git reset --hard main &&
+       test_when_finished "git rebase --abort" &&
+       ONTO=$(git rev-parse --short HEAD^) &&
+       FAKE_LINES="break" git rebase -i HEAD^ &&
+       test_when_finished "git checkout -" &&
+       git checkout -b bisect_while_rebasing &&
+       test_when_finished "git bisect reset" &&
+       git bisect start &&
+       cat >expected <<EOF &&
+On branch bisect_while_rebasing
+Last command done (1 command done):
+   break
+No commands remaining.
+You are currently editing a commit while rebasing branch '\''bisect'\'' on '\''$ONTO'\''.
+  (use "git commit --amend" to amend the current commit)
+  (use "git rebase --continue" once you are satisfied with your changes)
+
+You are currently bisecting, started from branch '\''bisect_while_rebasing'\''.
+  (use "git bisect reset" to get back to the original branch)
+
+nothing to commit (use -u to show untracked files)
+EOF
+       git status --untracked-files=no >actual &&
+       test_cmp expected actual
+'
+
+
 test_expect_success 'status when rebase --apply conflicts with statushints disabled' '
        git reset --hard main &&
        git checkout -b statushints_disabled &&
index d2975e6c93a07480e8da4e89bb1bd48faf397cba..94f9f4a1dac5621fbd340b6425d2f2ea7f042016 100755 (executable)
@@ -271,7 +271,7 @@ test_expect_success 'repacking fails when missing .pack actually means missing o
                ls .git/objects/pack/*.pack >before-pack-dir &&
 
                test_must_fail git fsck &&
-               test_must_fail git repack --cruft -d 2>err &&
+               test_must_fail env GIT_COMMIT_GRAPH_PARANOIA=true git repack --cruft -d 2>err &&
                grep "bad object" err &&
 
                # Before failing, the repack did not modify the
index 6d3dbde3feb9a41dc59a42f75ef578b1ebc5b183..348cc40658235239c7e68671738cd030871451ad 100755 (executable)
@@ -1,6 +1,7 @@
 #!/bin/sh
 
 test_description='git column'
+TEST_PASSES_SANITIZE_LEAK=true
 . ./test-lib.sh
 
 test_expect_success 'setup' '
index 32317d6bca5f45314a46082ecd9aa68061853904..e06538b1c854815c40aa43915d844089671cb2bd 100755 (executable)
@@ -27,7 +27,7 @@ cat << EOF
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program; if not, see <http://www.gnu.org/licenses/>.
+# along with this program; if not, see <https://www.gnu.org/licenses/>.
 #
 EOF
 }
index 26c25c0eb2ba57fa90c682950fda4899329474f8..e9a12c18bbd3f8bd43659d0b4eee0e4dfbad30ab 100755 (executable)
@@ -791,4 +791,14 @@ test_expect_success 'fast-export --first-parent outputs all revisions output by
        )
 '
 
+test_expect_success 'fast-export handles --end-of-options' '
+       git update-ref refs/heads/nodash HEAD &&
+       git update-ref refs/heads/--dashes HEAD &&
+       git fast-export --end-of-options nodash >expect &&
+       git fast-export --end-of-options --dashes >actual.raw &&
+       # fix up lines which mention the ref for comparison
+       sed s/--dashes/nodash/ <actual.raw >actual &&
+       test_cmp expect actual
+'
+
 test_done
index 6d753708d2acb6c7bcf47e5a057d99845c1006a3..d8e85482ab2ba7b28cb1e899f07dc1379969d1c1 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 use lib (split(/:/, $ENV{GITPERLLIB}));
 
-use 5.008;
+use 5.008001;
 use warnings;
 use strict;
 
index 73cca0d143d41f219fea625865480dced9df1094..c598011635ac2f44d0764acaf1ba7c53f569514c 100755 (executable)
@@ -466,7 +466,7 @@ test_expect_success 'git p4 clone complex branches with excluded files' '
        )
 '
 
-# From a report in http://stackoverflow.com/questions/11893688
+# From a report in https://stackoverflow.com/questions/11893688
 # where --use-client-spec caused branch prefixes not to be removed;
 # every file in git appeared into a subdirectory of the branch name.
 test_expect_success 'use-client-spec detect-branches setup' '
index 932841003cfc4e3f6273087f8567d6c6a660bb0b..5e904ac80d85226a74296774ef4279369da15d4a 100755 (executable)
@@ -9,7 +9,7 @@ test_expect_success 'start p4d' '
 '
 
 # See
-# http://www.perforce.com/perforce/doc.current/manuals/p4sag/03_superuser.html#1088563
+# https://web.archive.org/web/20150602090517/http://www.perforce.com/perforce/doc.current/manuals/p4sag/chapter.superuser.html#superuser.basic.typemap_locking
 # for suggestions on how to configure "sitewide pessimistic locking"
 # where only one person can have a file open for edit at a time.
 test_expect_success 'init depot' '
index 9c3cf12b268ab5457f2abaf7e9181b1332a5ba96..5eb57914abc493b6cb261b676b27d935f1b919ae 100644 (file)
@@ -14,7 +14,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 
 # The semantics of the editor variables are that of invoking
 # sh -c "$EDITOR \"$@\"" files ...
@@ -1277,7 +1277,7 @@ test_grep () {
        if test $# -lt 2 ||
           { test "x!" = "x$1" && test $# -lt 3 ; }
        then
-               BUG "too few parameters to test_i18ngrep"
+               BUG "too few parameters to test_grep"
        fi
 
        if test "x!" = "x$1"
index 9c5339c577ac3fd50090baf0d84caf6d62df0697..970c6538cba7a8d9465b6774b23e367c4b257d88 100644 (file)
@@ -14,7 +14,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 #
 # The idea is for `test-lib.sh` to source this file when run in GitHub
 # workflows; these functions will then override (empty) functions
index 79c31c788b921baa3118c918f731ed46b450393b..76cbbd3299d64a82276c0aa30241479388014af8 100644 (file)
@@ -15,7 +15,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 #
 # The idea is for `test-lib.sh` to source this file when the user asks
 # for JUnit XML; these functions will then override (empty) functions
index 1656c9eed006bdce115ed6e7673246847319783a..876b99562a323ee351d4afe0fe2afbca34fb46bc 100644 (file)
@@ -13,7 +13,7 @@
 # GNU General Public License for more details.
 #
 # You should have received a copy of the GNU General Public License
-# along with this program.  If not, see http://www.gnu.org/licenses/ .
+# along with this program.  If not, see https://www.gnu.org/licenses/ .
 
 # Test the binaries we have just built.  The tests are kept in
 # t/ subdirectory and are run in 'trash directory' subdirectory.
index 1bcf01a9a42a6147a85db9bb4d82523740a95ad7..3810e9bb43190322cd932d520ace6ab1e874be82 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl
-use 5.008;
+use 5.008001;
 use strict;
 use warnings;
 use IO::Pty;
index e144712c85c055bcf3248ab342592b440a477062..29ed5ee486a4f07c3f0558101ef8efc46f3d6ab7 100755 (executable)
@@ -28,7 +28,7 @@ if [ "$allownonascii" != "true" ] &&
        # Note that the use of brackets around a tr range is ok here, (it's
        # even required, for portability to Solaris 10's /usr/bin/tr), since
        # the square bracket bytes happen to fall in the designated range.
-       test $(git diff --cached --name-only --diff-filter=A -z $against |
+       test $(git diff-index --cached --name-only --diff-filter=A -z $against |
          LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
 then
        cat <<\EOF
index 5f9074ad1c0b063a0cb906c2dc6182357adcd5ee..3509258be53644973ca2b2b04cc0ec5b27ea96c6 100644 (file)
@@ -6,7 +6,6 @@
 #include "environment.h"
 #include "object-file.h"
 #include "path.h"
-#include "sigchain.h"
 #include "string-list.h"
 #include "strbuf.h"
 #include "strvec.h"
diff --git a/trace.c b/trace.c
index 971a68abe84bf02656bf9cd5eab584833f3da9f7..8669ddfca25e8fe91b57d96875f63214e5700a9e 100644 (file)
--- a/trace.c
+++ b/trace.c
@@ -18,7 +18,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, see <http://www.gnu.org/licenses/>.
+ *  along with this program; if not, see <https://www.gnu.org/licenses/>.
  */
 
 #include "git-compat-util.h"
index 6dc74dff4c73205d332a227b0caf2497b71f7538..f1e268bd159ecb3d491721e67c34eabd397a66ea 100644 (file)
--- a/trace2.c
+++ b/trace2.c
@@ -1,12 +1,9 @@
 #include "git-compat-util.h"
 #include "config.h"
-#include "json-writer.h"
-#include "quote.h"
 #include "repository.h"
 #include "run-command.h"
 #include "sigchain.h"
 #include "thread-utils.h"
-#include "version.h"
 #include "trace.h"
 #include "trace2.h"
 #include "trace2/tr2_cfg.h"
@@ -20,6 +17,7 @@
 #include "trace2/tr2_tmr.h"
 
 static int trace2_enabled;
+static int trace2_redact = 1;
 
 static int tr2_next_child_id; /* modify under lock */
 static int tr2_next_exec_id; /* modify under lock */
@@ -227,6 +225,8 @@ void trace2_initialize_fl(const char *file, int line)
        if (!tr2_tgt_want_builtins())
                return;
        trace2_enabled = 1;
+       if (!git_env_bool("GIT_TRACE2_REDACT", 1))
+               trace2_redact = 0;
 
        tr2_sid_get();
 
@@ -247,12 +247,93 @@ int trace2_is_enabled(void)
        return trace2_enabled;
 }
 
+/*
+ * Redacts an argument, i.e. ensures that no password in
+ * https://user:password@host/-style URLs is logged.
+ *
+ * Returns the original if nothing needed to be redacted.
+ * Returns a pointer that needs to be `free()`d otherwise.
+ */
+static const char *redact_arg(const char *arg)
+{
+       const char *p, *colon;
+       size_t at;
+
+       if (!trace2_redact ||
+           (!skip_prefix(arg, "https://", &p) &&
+            !skip_prefix(arg, "http://", &p)))
+               return arg;
+
+       at = strcspn(p, "@/");
+       if (p[at] != '@')
+               return arg;
+
+       colon = memchr(p, ':', at);
+       if (!colon)
+               return arg;
+
+       return xstrfmt("%.*s:<REDACTED>%s", (int)(colon - arg), arg, p + at);
+}
+
+/*
+ * Redacts arguments in an argument list.
+ *
+ * Returns the original if nothing needed to be redacted.
+ * Otherwise, returns a new array that needs to be released
+ * via `free_redacted_argv()`.
+ */
+static const char **redact_argv(const char **argv)
+{
+       int i, j;
+       const char *redacted = NULL;
+       const char **ret;
+
+       if (!trace2_redact)
+               return argv;
+
+       for (i = 0; argv[i]; i++)
+               if ((redacted = redact_arg(argv[i])) != argv[i])
+                       break;
+
+       if (!argv[i])
+               return argv;
+
+       for (j = 0; argv[j]; j++)
+               ; /* keep counting */
+
+       ALLOC_ARRAY(ret, j + 1);
+       ret[j] = NULL;
+
+       for (j = 0; j < i; j++)
+               ret[j] = argv[j];
+       ret[i] = redacted;
+       for (++i; argv[i]; i++) {
+               redacted = redact_arg(argv[i]);
+               ret[i] = redacted ? redacted : argv[i];
+       }
+
+       return ret;
+}
+
+static void free_redacted_argv(const char **redacted, const char **argv)
+{
+       int i;
+
+       if (redacted != argv) {
+               for (i = 0; argv[i]; i++)
+                       if (redacted[i] != argv[i])
+                               free((void *)redacted[i]);
+               free((void *)redacted);
+       }
+}
+
 void trace2_cmd_start_fl(const char *file, int line, const char **argv)
 {
        struct tr2_tgt *tgt_j;
        int j;
        uint64_t us_now;
        uint64_t us_elapsed_absolute;
+       const char **redacted;
 
        if (!trace2_enabled)
                return;
@@ -260,10 +341,14 @@ void trace2_cmd_start_fl(const char *file, int line, const char **argv)
        us_now = getnanotime() / 1000;
        us_elapsed_absolute = tr2tls_absolute_elapsed(us_now);
 
+       redacted = redact_argv(argv);
+
        for_each_wanted_builtin (j, tgt_j)
                if (tgt_j->pfn_start_fl)
                        tgt_j->pfn_start_fl(file, line, us_elapsed_absolute,
-                                           argv);
+                                           redacted);
+
+       free_redacted_argv(redacted, argv);
 }
 
 void trace2_cmd_exit_fl(const char *file, int line, int code)
@@ -409,6 +494,7 @@ void trace2_child_start_fl(const char *file, int line,
        int j;
        uint64_t us_now;
        uint64_t us_elapsed_absolute;
+       const char **orig_argv = cmd->args.v;
 
        if (!trace2_enabled)
                return;
@@ -419,10 +505,24 @@ void trace2_child_start_fl(const char *file, int line,
        cmd->trace2_child_id = tr2tls_locked_increment(&tr2_next_child_id);
        cmd->trace2_child_us_start = us_now;
 
+       /*
+        * The `pfn_child_start_fl` API takes a `struct child_process`
+        * rather than a simple `argv` for the child because some
+        * targets make use of the additional context bits/values. So
+        * temporarily replace the original argv (inside the `strvec`)
+        * with a possibly redacted version.
+        */
+       cmd->args.v = redact_argv(orig_argv);
+
        for_each_wanted_builtin (j, tgt_j)
                if (tgt_j->pfn_child_start_fl)
                        tgt_j->pfn_child_start_fl(file, line,
                                                  us_elapsed_absolute, cmd);
+
+       if (cmd->args.v != orig_argv) {
+               free_redacted_argv(cmd->args.v, orig_argv);
+               cmd->args.v = orig_argv;
+       }
 }
 
 void trace2_child_exit_fl(const char *file, int line, struct child_process *cmd,
@@ -493,6 +593,7 @@ int trace2_exec_fl(const char *file, int line, const char *exe,
        int exec_id;
        uint64_t us_now;
        uint64_t us_elapsed_absolute;
+       const char **redacted;
 
        if (!trace2_enabled)
                return -1;
@@ -502,10 +603,14 @@ int trace2_exec_fl(const char *file, int line, const char *exe,
 
        exec_id = tr2tls_locked_increment(&tr2_next_exec_id);
 
+       redacted = redact_argv(argv);
+
        for_each_wanted_builtin (j, tgt_j)
                if (tgt_j->pfn_exec_fl)
                        tgt_j->pfn_exec_fl(file, line, us_elapsed_absolute,
-                                          exec_id, exe, argv);
+                                          exec_id, exe, redacted);
+
+       free_redacted_argv(redacted, argv);
 
        return exec_id;
 }
@@ -637,13 +742,19 @@ void trace2_def_param_fl(const char *file, int line, const char *param,
 {
        struct tr2_tgt *tgt_j;
        int j;
+       const char *redacted;
 
        if (!trace2_enabled)
                return;
 
+       redacted = redact_arg(value);
+
        for_each_wanted_builtin (j, tgt_j)
                if (tgt_j->pfn_param_fl)
-                       tgt_j->pfn_param_fl(file, line, param, value, kvi);
+                       tgt_j->pfn_param_fl(file, line, param, redacted, kvi);
+
+       if (redacted != value)
+               free((void *)redacted);
 }
 
 void trace2_def_repo_fl(const char *file, int line, struct repository *repo)
index 40d8c2e02a5e50ce4f24bc4bd656498773e0853e..1f0669bbd2d4f0ade2b39960ad89d8e5397cb6b1 100644 (file)
--- a/trace2.h
+++ b/trace2.h
@@ -337,8 +337,8 @@ struct key_value_info;
 void trace2_def_param_fl(const char *file, int line, const char *param,
                         const char *value, const struct key_value_info *kvi);
 
-#define trace2_def_param(param, value) \
-       trace2_def_param_fl(__FILE__, __LINE__, (param), (value))
+#define trace2_def_param(param, value, kvi) \
+       trace2_def_param_fl(__FILE__, __LINE__, (param), (value), (kvi))
 
 /*
  * Tell trace2 about a newly instantiated repo object and assign
index 87cf9034fba4b91b4d569ea4013e13f9d19b4aa9..d3a33715c14b9c83647cc4940da4d1abad30dc63 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "thread-utils.h"
 #include "trace2/tr2_tgt.h"
 #include "trace2/tr2_tls.h"
 #include "trace2/tr2_ctr.h"
index d3ecac27728efe8c06dd78f6e394d789d4c1bc7e..048cdd543830418bfe53957b278ab654ecfdcb66 100644 (file)
@@ -68,6 +68,8 @@ static int tr2_sysenv_cb(const char *key, const char *value,
 
        for (k = 0; k < ARRAY_SIZE(tr2_sysenv_settings); k++) {
                if (!strcmp(key, tr2_sysenv_settings[k].git_config_name)) {
+                       if (!value)
+                               return config_error_nonbool(key);
                        free(tr2_sysenv_settings[k].value);
                        tr2_sysenv_settings[k].value = xstrdup(value);
                        return 0;
index 38d5ebddf65f8061e9d9dbdf18f35c274bc6a31c..baef48aa6989cede1d8bf62837388ab3379e9604 100644 (file)
@@ -2,6 +2,7 @@
 #include "config.h"
 #include "repository.h"
 #include "run-command.h"
+#include "strbuf.h"
 #include "quote.h"
 #include "version.h"
 #include "trace2/tr2_dst.h"
index 601c9e5036fb27a7f88957559f03821c2fffa4a2..4f75392952b6a429682d8989fe7146487ce0cb6a 100644 (file)
@@ -1,4 +1,5 @@
 #include "git-compat-util.h"
+#include "strbuf.h"
 #include "thread-utils.h"
 #include "trace.h"
 #include "trace2/tr2_tls.h"
index f9049805d4dcd6eea6550042a1887357ad85d6fd..3dfe6557fc46129edfa7a121522e9a6d54973f28 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef TR2_TLS_H
 #define TR2_TLS_H
 
-#include "strbuf.h"
 #include "trace2/tr2_ctr.h"
 #include "trace2/tr2_tmr.h"
 
index 31d0e4d1bd1220ea0c9d9b204223766235d81e07..51f564b07a4091a24db71b3a756b4730173cae98 100644 (file)
@@ -1,5 +1,4 @@
 #include "git-compat-util.h"
-#include "thread-utils.h"
 #include "trace2/tr2_tgt.h"
 #include "trace2/tr2_tls.h"
 #include "trace2/tr2_tmr.h"
index b6de5d9cb2dab2c07c26775e62e5bfc40241c9fc..3a0710a4583a4a11fa5a87cda88ef6a3d0610870 100644 (file)
--- a/trailer.c
+++ b/trailer.c
@@ -507,6 +507,8 @@ static int git_trailer_default_config(const char *conf_key, const char *value,
                                warning(_("unknown value '%s' for key '%s'"),
                                        value, conf_key);
                } else if (!strcmp(trailer_item, "separators")) {
+                       if (!value)
+                               return config_error_nonbool(conf_key);
                        separators = xstrdup(value);
                }
        }
@@ -551,16 +553,22 @@ static int git_trailer_config(const char *conf_key, const char *value,
        case TRAILER_KEY:
                if (conf->key)
                        warning(_("more than one %s"), conf_key);
+               if (!value)
+                       return config_error_nonbool(conf_key);
                conf->key = xstrdup(value);
                break;
        case TRAILER_COMMAND:
                if (conf->command)
                        warning(_("more than one %s"), conf_key);
+               if (!value)
+                       return config_error_nonbool(conf_key);
                conf->command = xstrdup(value);
                break;
        case TRAILER_CMD:
                if (conf->cmd)
                        warning(_("more than one %s"), conf_key);
+               if (!value)
+                       return config_error_nonbool(conf_key);
                conf->cmd = xstrdup(value);
                break;
        case TRAILER_WHERE:
@@ -809,28 +817,56 @@ static ssize_t last_line(const char *buf, size_t len)
 }
 
 /*
- * Return the position of the start of the patch or the length of str if there
- * is no patch in the message.
+ * Find the end of the log message as an offset from the start of the input
+ * (where callers of this function are interested in looking for a trailers
+ * block in the same input). We have to consider two categories of content that
+ * can come at the end of the input which we want to ignore (because they don't
+ * belong in the log message):
+ *
+ * (1) the "patch part" which begins with a "---" divider and has patch
+ * information (like the output of git-format-patch), and
+ *
+ * (2) any trailing comment lines, blank lines like in the output of "git
+ * commit -v", or stuff below the "cut" (scissor) line.
+ *
+ * As a formula, the situation looks like this:
+ *
+ *     INPUT = LOG MESSAGE + IGNORED
+ *
+ * where IGNORED can be either of the two categories described above. It may be
+ * that there is nothing to ignore. Now it may be the case that the LOG MESSAGE
+ * contains a trailer block, but that's not the concern of this function.
  */
-static size_t find_patch_start(const char *str)
+static size_t find_end_of_log_message(const char *input, int no_divider)
 {
+       size_t end;
        const char *s;
 
-       for (s = str; *s; s = next_line(s)) {
+       /* Assume the naive end of the input is already what we want. */
+       end = strlen(input);
+
+       if (no_divider)
+               return end;
+
+       /* Optionally skip over any patch part ("---" line and below). */
+       for (s = input; *s; s = next_line(s)) {
                const char *v;
 
-               if (skip_prefix(s, "---", &v) && isspace(*v))
-                       return s - str;
+               if (skip_prefix(s, "---", &v) && isspace(*v)) {
+                       end = s - input;
+                       break;
+               }
        }
 
-       return s - str;
+       /* Skip over other ignorable bits. */
+       return end - ignored_log_message_bytes(input, end);
 }
 
 /*
  * Return the position of the first trailer line or len if there are no
  * trailers.
  */
-static size_t find_trailer_start(const char *buf, size_t len)
+static size_t find_trailer_block_start(const char *buf, size_t len)
 {
        const char *s;
        ssize_t end_of_title, l;
@@ -925,12 +961,6 @@ continue_outer_loop:
        return len;
 }
 
-/* Return the position of the end of the trailers. */
-static size_t find_trailer_end(const char *buf, size_t len)
-{
-       return len - ignore_non_trailer(buf, len);
-}
-
 static int ends_with_blank_line(const char *buf, size_t len)
 {
        ssize_t ll = last_line(buf, len);
@@ -1052,7 +1082,6 @@ void process_trailers(const char *file,
        LIST_HEAD(head);
        struct strbuf sb = STRBUF_INIT;
        struct trailer_info info;
-       size_t trailer_end;
        FILE *outfile = stdout;
 
        ensure_configured();
@@ -1063,11 +1092,10 @@ void process_trailers(const char *file,
                outfile = create_in_place_tempfile(file);
 
        parse_trailers(&info, sb.buf, &head, opts);
-       trailer_end = info.trailer_end - sb.buf;
 
        /* Print the lines before the trailers */
        if (!opts->only_trailers)
-               fwrite(sb.buf, 1, info.trailer_start - sb.buf, outfile);
+               fwrite(sb.buf, 1, info.trailer_block_start, outfile);
 
        if (!opts->only_trailers && !info.blank_line_before_trailer)
                fprintf(outfile, "\n");
@@ -1089,7 +1117,7 @@ void process_trailers(const char *file,
 
        /* Print the lines after the trailers as is */
        if (!opts->only_trailers)
-               fwrite(sb.buf + trailer_end, 1, sb.len - trailer_end, outfile);
+               fwrite(sb.buf + info.trailer_block_end, 1, sb.len - info.trailer_block_end, outfile);
 
        if (opts->in_place)
                if (rename_tempfile(&trailers_tempfile, file))
@@ -1101,7 +1129,7 @@ void process_trailers(const char *file,
 void trailer_info_get(struct trailer_info *info, const char *str,
                      const struct process_trailer_options *opts)
 {
-       int patch_start, trailer_end, trailer_start;
+       size_t end_of_log_message = 0, trailer_block_start = 0;
        struct strbuf **trailer_lines, **ptr;
        char **trailer_strings = NULL;
        size_t nr = 0, alloc = 0;
@@ -1109,16 +1137,11 @@ void trailer_info_get(struct trailer_info *info, const char *str,
 
        ensure_configured();
 
-       if (opts->no_divider)
-               patch_start = strlen(str);
-       else
-               patch_start = find_patch_start(str);
-
-       trailer_end = find_trailer_end(str, patch_start);
-       trailer_start = find_trailer_start(str, trailer_end);
+       end_of_log_message = find_end_of_log_message(str, opts->no_divider);
+       trailer_block_start = find_trailer_block_start(str, end_of_log_message);
 
-       trailer_lines = strbuf_split_buf(str + trailer_start,
-                                        trailer_end - trailer_start,
+       trailer_lines = strbuf_split_buf(str + trailer_block_start,
+                                        end_of_log_message - trailer_block_start,
                                         '\n',
                                         0);
        for (ptr = trailer_lines; *ptr; ptr++) {
@@ -1139,9 +1162,9 @@ void trailer_info_get(struct trailer_info *info, const char *str,
        strbuf_list_free(trailer_lines);
 
        info->blank_line_before_trailer = ends_with_blank_line(str,
-                                                              trailer_start);
-       info->trailer_start = str + trailer_start;
-       info->trailer_end = str + trailer_end;
+                                                              trailer_block_start);
+       info->trailer_block_start = trailer_block_start;
+       info->trailer_block_end = end_of_log_message;
        info->trailers = trailer_strings;
        info->trailer_nr = nr;
 }
@@ -1156,6 +1179,7 @@ void trailer_info_release(struct trailer_info *info)
 
 static void format_trailer_info(struct strbuf *out,
                                const struct trailer_info *info,
+                               const char *msg,
                                const struct process_trailer_options *opts)
 {
        size_t origlen = out->len;
@@ -1165,8 +1189,8 @@ static void format_trailer_info(struct strbuf *out,
        if (!opts->only_trailers && !opts->unfold && !opts->filter &&
            !opts->separator && !opts->key_only && !opts->value_only &&
            !opts->key_value_separator) {
-               strbuf_add(out, info->trailer_start,
-                          info->trailer_end - info->trailer_start);
+               strbuf_add(out, msg + info->trailer_block_start,
+                          info->trailer_block_end - info->trailer_block_start);
                return;
        }
 
@@ -1220,7 +1244,7 @@ void format_trailers_from_commit(struct strbuf *out, const char *msg,
        struct trailer_info info;
 
        trailer_info_get(&info, msg, opts);
-       format_trailer_info(out, &info, opts);
+       format_trailer_info(out, &info, msg, opts);
        trailer_info_release(&info);
 }
 
index ab2cd017567b3f782fa9b342ad03e7e93bc17a37..1644cd05f60d9f3ceb89ffa66fb5c5b3da9e5cd4 100644 (file)
--- a/trailer.h
+++ b/trailer.h
@@ -32,16 +32,16 @@ int trailer_set_if_missing(enum trailer_if_missing *item, const char *value);
 struct trailer_info {
        /*
         * True if there is a blank line before the location pointed to by
-        * trailer_start.
+        * trailer_block_start.
         */
        int blank_line_before_trailer;
 
        /*
-        * Pointers to the start and end of the trailer block found. If there
-        * is no trailer block found, these 2 pointers point to the end of the
-        * input string.
+        * Offsets to the trailer block start and end positions in the input
+        * string. If no trailer block is found, these are both set to the
+        * "true" end of the input (find_end_of_log_message()).
         */
-       const char *trailer_start, *trailer_end;
+       size_t trailer_block_start, trailer_block_end;
 
        /*
         * Array of trailers found.
index 49811ef176dbc5af5e33fe47cf93cf1f57719f5e..e34a8f47cfbf5cba150e1aa7c6267fc2b1c080c0 100644 (file)
@@ -3,13 +3,11 @@
 #include "quote.h"
 #include "run-command.h"
 #include "commit.h"
-#include "diff.h"
 #include "environment.h"
 #include "gettext.h"
 #include "hex.h"
 #include "object-name.h"
 #include "repository.h"
-#include "revision.h"
 #include "remote.h"
 #include "string-list.h"
 #include "thread-utils.h"
index 219af8fd50ed57c0fc0f954965e481b51e7aae72..bd7899e9bf5550b2b333dbbcf85a5b98c7813ad2 100644 (file)
@@ -10,9 +10,7 @@
 #include "remote.h"
 #include "connect.h"
 #include "send-pack.h"
-#include "walker.h"
 #include "bundle.h"
-#include "dir.h"
 #include "gettext.h"
 #include "refs.h"
 #include "refspec.h"
@@ -26,7 +24,6 @@
 #include "transport-internal.h"
 #include "protocol.h"
 #include "object-name.h"
-#include "object-store-ll.h"
 #include "color.h"
 #include "bundle-uri.h"
 
diff --git a/tree.c b/tree.c
index 990f9c9854e6a1a957ed01f74b20e694af07f278..508e5fd76fd5bb588796bb9c51a78557880ba074 100644 (file)
--- a/tree.c
+++ b/tree.c
@@ -1,12 +1,9 @@
 #include "git-compat-util.h"
-#include "cache-tree.h"
 #include "hex.h"
 #include "tree.h"
 #include "object-name.h"
 #include "object-store-ll.h"
-#include "blob.h"
 #include "commit.h"
-#include "tag.h"
 #include "alloc.h"
 #include "tree-walk.h"
 #include "repository.h"
index ea234ab6a4522489c7a70a3cfa6d6449c46013c5..2537affa90762228a19d305be749f410d5afb5dc 100644 (file)
@@ -9,13 +9,10 @@
 #include "repository.h"
 #include "object-store-ll.h"
 #include "oid-array.h"
-#include "tag.h"
 #include "object.h"
 #include "commit.h"
 #include "diff.h"
 #include "revision.h"
-#include "list-objects.h"
-#include "list-objects-filter.h"
 #include "list-objects-filter-options.h"
 #include "run-command.h"
 #include "connect.h"
 #include "string-list.h"
 #include "strvec.h"
 #include "trace2.h"
-#include "prio-queue.h"
 #include "protocol.h"
-#include "quote.h"
 #include "upload-pack.h"
-#include "serve.h"
 #include "commit-graph.h"
 #include "commit-reach.h"
 #include "shallow.h"
diff --git a/utf8.c b/utf8.c
index 6a0dd25b0fe414764f89ae48384f68c959dcafe3..6bfaefa28ebbbfd145b30b58fe0e937ea921ec91 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -2,7 +2,7 @@
 #include "strbuf.h"
 #include "utf8.h"
 
-/* This code is originally from http://www.cl.cam.ac.uk/~mgk25/ucs/ */
+/* This code is originally from https://www.cl.cam.ac.uk/~mgk25/ucs/ */
 
 static const char utf16_be_bom[] = {'\xFE', '\xFF'};
 static const char utf16_le_bom[] = {'\xFF', '\xFE'};
diff --git a/utf8.h b/utf8.h
index b68efef6f4398dae9617e6c5eaa81b0ddcebcb6e..35df76086a6c91a414190f7af8d05f0f0042ecda 100644 (file)
--- a/utf8.h
+++ b/utf8.h
@@ -83,7 +83,7 @@ void strbuf_utf8_align(struct strbuf *buf, align_type position, unsigned int wid
  * BOM must not be used [1]. The same applies for the UTF-32 equivalents.
  * The function returns true if this rule is violated.
  *
- * [1] http://unicode.org/faq/utf_bom.html#bom10
+ * [1] https://unicode.org/faq/utf_bom.html#bom10
  */
 int has_prohibited_utf_bom(const char *enc, const char *data, size_t len);
 
@@ -99,8 +99,8 @@ int has_prohibited_utf_bom(const char *enc, const char *data, size_t len);
  * Therefore, strictly requiring a BOM seems to be the safest option for
  * content in Git.
  *
- * [1] http://unicode.org/faq/utf_bom.html#gen6
- * [2] http://www.unicode.org/versions/Unicode10.0.0/ch03.pdf
+ * [1] https://unicode.org/faq/utf_bom.html#gen6
+ * [2] https://www.unicode.org/versions/Unicode10.0.0/ch03.pdf
  *     Section 3.10, D98, page 132
  * [3] https://encoding.spec.whatwg.org/#utf-16le
  */
index a56a6c2a3d136d31019520fdae68fc46c428194d..1399d452accaa3d0bdadd759c95fa7fd704f0a95 100644 (file)
@@ -395,9 +395,9 @@ int is_worktree_being_bisected(const struct worktree *wt,
 
        memset(&state, 0, sizeof(state));
        found_bisect = wt_status_check_bisect(wt, &state) &&
-                      state.branch &&
+                      state.bisecting_from &&
                       skip_prefix(target, "refs/heads/", &target) &&
-                      !strcmp(state.branch, target);
+                      !strcmp(state.bisecting_from, target);
        wt_status_state_free_buffers(&state);
        return found_bisect;
 }
index 7da15a56da614ce82ca1d6a5c6e2277b444f1063..eeac3741cf1a4e90ceab3bef07028aad632ebfb6 100644 (file)
--- a/wrapper.c
+++ b/wrapper.c
@@ -5,7 +5,6 @@
 #include "abspath.h"
 #include "parse.h"
 #include "gettext.h"
-#include "repository.h"
 #include "strbuf.h"
 #include "trace2.h"
 
index 42a2dc73cd3f18638445780e7fa9aa9b67ba871c..01a9a51fa2fcd758b32ffc8f3e75811710804754 100644 (file)
  */
 void maybe_flush_or_die(FILE *f, const char *desc)
 {
-       static int skip_stdout_flush = -1;
-       struct stat st;
-       char *cp;
-
        if (f == stdout) {
-               if (skip_stdout_flush < 0) {
-                       /* NEEDSWORK: make this a normal Boolean */
-                       cp = getenv("GIT_FLUSH");
-                       if (cp)
-                               skip_stdout_flush = (atoi(cp) == 0);
-                       else if ((fstat(fileno(stdout), &st) == 0) &&
-                                S_ISREG(st.st_mode))
-                               skip_stdout_flush = 1;
-                       else
-                               skip_stdout_flush = 0;
+               static int force_flush_stdout = -1;
+
+               if (force_flush_stdout < 0) {
+                       force_flush_stdout = git_env_bool("GIT_FLUSH", -1);
+                       if (force_flush_stdout < 0) {
+                               struct stat st;
+                               if (fstat(fileno(stdout), &st))
+                                       force_flush_stdout = 1;
+                               else
+                                       force_flush_stdout = !S_ISREG(st.st_mode);
+                       }
                }
-               if (skip_stdout_flush && !ferror(f))
+               if (!force_flush_stdout && !ferror(f))
                        return;
        }
        if (fflush(f)) {
index 9f45bf69490e6fa4939948aadb63e7201d0e868e..9e8c08003b990c44ca17dc1e778bf572eb694786 100644 (file)
@@ -861,6 +861,7 @@ void wt_status_state_free_buffers(struct wt_status_state *state)
        FREE_AND_NULL(state->branch);
        FREE_AND_NULL(state->onto);
        FREE_AND_NULL(state->detached_from);
+       FREE_AND_NULL(state->bisecting_from);
 }
 
 static void wt_longstatus_print_unmerged(struct wt_status *s)
@@ -1569,10 +1570,10 @@ static void show_revert_in_progress(struct wt_status *s,
 static void show_bisect_in_progress(struct wt_status *s,
                                    const char *color)
 {
-       if (s->state.branch)
+       if (s->state.bisecting_from)
                status_printf_ln(s, color,
                                 _("You are currently bisecting, started from branch '%s'."),
-                                s->state.branch);
+                                s->state.bisecting_from);
        else
                status_printf_ln(s, color,
                                 _("You are currently bisecting."));
@@ -1733,7 +1734,7 @@ int wt_status_check_bisect(const struct worktree *wt,
 
        if (!stat(worktree_git_path(wt, "BISECT_LOG"), &st)) {
                state->bisect_in_progress = 1;
-               state->branch = get_branch(wt, "BISECT_START");
+               state->bisecting_from = get_branch(wt, "BISECT_START");
                return 1;
        }
        return 0;
index ab9cc9d8f032b77fbf6bfd5882c45a801a28fa09..819dcad72300c56900ac05f3943d27dd2b9ed7a4 100644 (file)
@@ -94,6 +94,7 @@ struct wt_status_state {
        char *branch;
        char *onto;
        char *detached_from;
+       char *bisecting_from;
        struct object_id detached_oid;
        struct object_id revert_head_oid;
        struct object_id cherry_pick_head_oid;
index adcea109fa9a54eaa96c67c1b5e8a1689af253af..3162f517434353609e1fa45ab67ea3cf4623f8a3 100644 (file)
@@ -1,4 +1,5 @@
 #include "git-compat-util.h"
+#include "gettext.h"
 #include "config.h"
 #include "hex.h"
 #include "object-store-ll.h"
@@ -6,8 +7,6 @@
 #include "xdiff-interface.h"
 #include "xdiff/xtypes.h"
 #include "xdiff/xdiffi.h"
-#include "xdiff/xemit.h"
-#include "xdiff/xmacros.h"
 #include "xdiff/xutils.h"
 
 struct xdiff_emit_state {
@@ -313,7 +312,7 @@ int git_xmerge_config(const char *var, const char *value,
 {
        if (!strcmp(var, "merge.conflictstyle")) {
                if (!value)
-                       die("'%s' is not a boolean", var);
+                       return config_error_nonbool(var);
                if (!strcmp(value, "diff3"))
                        git_xmerge_style = XDL_MERGE_DIFF3;
                else if (!strcmp(value, "zdiff3"))
@@ -325,8 +324,8 @@ int git_xmerge_config(const char *var, const char *value,
                 * git-completion.bash when you add new merge config
                 */
                else
-                       die("unknown style '%s' given for '%s'",
-                           value, var);
+                       return error(_("unknown style '%s' given for '%s'"),
+                                    value, var);
                return 0;
        }
        return git_default_config(var, value, ctx, cb);