summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2023-05-17worktree add: add --orphan flagJacob Abel3-12/+129
Add support for creating an orphan branch when adding a new worktree. The functionality of this flag is equivalent to git switch's --orphan option. Current Behavior: % git -C foo.git --no-pager branch -l + main % git -C foo.git worktree add main/ Preparing worktree (new branch 'main') HEAD is now at 6c93a75 a commit % % git init bar.git Initialized empty Git repository in /path/to/bar.git/ % git -C bar.git --no-pager branch -l % git -C bar.git worktree add main/ Preparing worktree (new branch 'main') fatal: not a valid object name: 'HEAD' % New Behavior: % git -C foo.git --no-pager branch -l + main % git -C foo.git worktree add main/ Preparing worktree (new branch 'main') HEAD is now at 6c93a75 a commit % % git init --bare bar.git Initialized empty Git repository in /path/to/bar.git/ % git -C bar.git --no-pager branch -l % git -C bar.git worktree add main/ Preparing worktree (new branch 'main') fatal: invalid reference: HEAD % git -C bar.git worktree add --orphan -b main/ Preparing worktree (new branch 'main') % git -C bar.git worktree add --orphan -b newbranch worktreedir/ Preparing worktree (new branch 'newbranch') % Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17t2400: add tests to verify --quietJacob Abel1-0/+36
Add tests to verify that the command performs operations the same with `--quiet` as without it. Additionally verifies that all non-fatal output is suppressed. Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17t2400: refactor "worktree add" opt exclusion testsJacob Abel1-10/+13
Pull duplicate test code into a function so that additional opt combinations can be tested succinctly. Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17t2400: cleanup created worktree in testJacob Abel1-0/+1
Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17worktree add: include -B in usage docsJacob Abel2-2/+2
Document `-B` next to where `-b` is already documented to bring the usage docs in line with other commands such as git checkout. Signed-off-by: Jacob Abel <jacobabel@nullpo.dev> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17l10n: update uk localizationArkadii Yakovets1-1129/+1869
Co-authored-by: Kate Golovanova <kate@kgthreads.com> Signed-off-by: Arkadii Yakovets <ark@cho.red> Signed-off-by: Kate Golovanova <kate@kgthreads.com>
2023-05-17send-email: clear the $message_id after validationJunio C Hamano2-1/+18
Recently git-send-email started parsing the same message twice, once to validate _all_ the message before sending even the first one, and then after the validation hook is happy and each message gets sent, to read the contents to find out where to send to etc. Unfortunately, the effect of reading the messages for validation lingered even after the validation is done. Namely $message_id gets assigned if exists in the input files but the variable is global, and it is not cleared before pre_process_file runs. This causes reading a message without a message-id followed by reading a message with a message-id to misbehave---the sub reports as if the message had the same id as the previously written one. Clear the variable before starting to read the headers in pre_process_file. Tested-by: Douglas Anderson <dianders@chromium.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17upload-pack: advertise capabilities when cloning empty reposbrian m. carlson3-7/+73
When cloning an empty repository, protocol versions 0 and 1 currently offer nothing but the header and flush packets for the /info/refs endpoint. This means that no capabilities are provided, so the client side doesn't know what capabilities are present. However, this does pose a problem when working with SHA-256 repositories, since we use the capabilities to know the remote side's object format (hash algorithm). As of 8b214c2e9d ("clone: propagate object-format when cloning from void", 2023-04-05), this has been fixed for protocol v2, since there we always read the hash algorithm from the remote. Fortunately, the push version of the protocol already indicates a clue for how to solve this. When the /info/refs endpoint is accessed for a push and the remote is empty, we include a dummy "capabilities^{}" ref pointing to the all-zeros object ID. The protocol documentation already indicates this should _always_ be sent, even for fetches and clones, so let's just do that, which means we'll properly announce the hash algorithm as part of the capabilities. This just works with the existing code because we share the same ref code for fetches and clones, and libgit2, JGit, and dulwich do as well. There is one minor issue to fix, though. If we called send_ref with namespaces, we would return NULL with the capabilities entry, which would cause a crash. Instead, let's refactor out a function to print just the ref itself without stripping the namespace and use it for our special capabilities entry. Add several sets of tests for HTTP as well as for local clones. The behavior can be slightly different for HTTP versus a local or SSH clone because of the stateless-rpc functionality, so it's worth testing both. Signed-off-by: brian m. carlson <bk2204@github.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17A bit more before -rc1Junio C Hamano1-1/+5
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17Merge branch 'jc/attr-source-tree'Junio C Hamano16-29/+140
"git --attr-source=<tree> cmd $args" is a new way to have any command to read attributes not from the working tree but from the given tree object. * jc/attr-source-tree: attr: teach "--attr-source=<tree>" global option to "git"
2023-05-17fetch: use `fetch_config` to store "submodule.fetchJobs" valuePatrick Steinhardt1-5/+6
Move the parsed "submodule.fetchJobs" config value into the `fetch_config` structure. This reduces our reliance on global variables and further unifies the way we parse the configuration in git-fetch(1). Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17fetch: use `fetch_config` to store "fetch.parallel" valuePatrick Steinhardt1-7/+8
Move the parsed "fetch.parallel" config value into the `fetch_config` structure. This reduces our reliance on global variables and further unifies the way we parse the configuration in git-fetch(1). Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17fetch: use `fetch_config` to store "fetch.recurseSubmodules" valuePatrick Steinhardt1-15/+16
Move the parsed "fetch.recurseSubmodules" config value into the `fetch_config` structure. This reduces our reliance on global variables and further unifies the way we parse the configuration in git-fetch(1). Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17fetch: use `fetch_config` to store "fetch.showForcedUpdates" valuePatrick Steinhardt1-14/+21
Move the parsed "fetch.showForcedUpdaets" config value into the `fetch_config` structure. This reduces our reliance on global variables and further unifies the way we parse the configuration in git-fetch(1). Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17fetch: use `fetch_config` to store "fetch.pruneTags" valuePatrick Steinhardt1-4/+5
Move the parsed "fetch.pruneTags" config value into the `fetch_config` structure. This reduces our reliance on global variables and further unifies the way we parse the configuration in git-fetch(1). Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17fetch: use `fetch_config` to store "fetch.prune" valuePatrick Steinhardt1-4/+5
Move the parsed "fetch.prune" config value into the `fetch_config` structure. This reduces our reliance on global variables and further unifies the way we parse the configuration in git-fetch(1). Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17fetch: pass through `fetch_config` directlyPatrick Steinhardt1-15/+16
The `fetch_config` structure currently only has a single member, which is the `display_format`. We're about extend it to contain all parsed config values and will thus need it available in most of the code. Prepare for this change by passing through the `fetch_config` directly instead of only passing its single member. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17fetch: drop unneeded NULL-check for `remote_ref`Patrick Steinhardt1-3/+2
Drop the `NULL` check for `remote_ref` in `update_local_ref()`. The function only has a single caller, and that caller always passes in a non-`NULL` value. This fixes a false positive in Coverity. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17fetch: drop unused DISPLAY_FORMAT_UNKNOWN enum valuePatrick Steinhardt1-1/+0
With 50957937f9 (fetch: introduce `display_format` enum, 2023-05-10), a new enumeration was introduced to determine the display format that is to be used by git-fetch(1). The `DISPLAY_FORMAT_UNKNOWN` value isn't ever used though, and neither do we rely on the explicit `0` value for initialization anywhere. Remove the enum value. Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-17imap-send: include strbuf.hChristian Hesse1-0/+1
We make liberal use of the strbuf API functions and types, but the inclusion of <strbuf.h> comes indirectly by including <http.h>, which does not happen if you build with NO_CURL. Signed-off-by: Christian Hesse <mail@eworm.de> Helped-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-16run-command.c: fix missing include under `NO_PTHREADS`Taylor Blau1-0/+1
Git 2.41-rc0 fails to compile run-command.c with `NO_PTHREADS` defined, i.e. $ make NO_PTHREADS=1 run-command.o as `ALLOC_GROW()` macro is used in the `atexit()` emulation but the macro definition is not available. This bisects to 36bf195890 (alloc.h: move ALLOC_GROW() functions from cache.h, 2023-02-24), which replaced includes of <cache.h> with <alloc.h>, which is the new home of `ALLOC_GROW()` (and `ALLOC_GROW_BY()`). We can see that run-command.c is the only one that try to use these macros without including <alloc.h>. $ git grep -l -e '[^_]ALLOC_GROW(' -e 'ALLOC_GROW_BY(' \*.c | sort >/tmp/1 $ git grep -l 'alloc\.h' \*.c | sort >/tmp/2 $ comm -23 /tmp/[12] compat/simple-ipc/ipc-unix-socket.c run-command.c The "compat/" file only talks about the macro in the comment, and is not broken. We could fix this by conditionally including "alloc.h" when `NO_PTHREADS` is defined. But we have relatively few examples of conditional includes throughout the tree[^1]. Instead, include "alloc.h" unconditionally in run-command.c to allow it to successfully compile even when NO_PTHREADS is defined. [^1]: With `git grep -E -A1 '#if(n)?def' -- **/*.c | grep '#include' -B1`. Reported-by: Randall S. Becker <randall.becker@nexbridge.ca> Co-authored-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-16tag: keep the message file in case ref transaction failsKristoffer Haugsbakk2-9/+25
The ref transaction can fail after the user has written their tag message. In particular, if there exists a tag `foo/bar` and `git tag -a foo` is said then the command will only fail once it tries to write `refs/tags/foo`, which is after the file has been unlinked. Hold on to the message file for a little longer so that it is not unlinked before the fatal error occurs. Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-16t/t7004-tag: add regression test for successful tag creationKristoffer Haugsbakk1-0/+9
The standard tag message file is unlinked if the tag is created. Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-16doc: tag: document `TAG_EDITMSG`Kristoffer Haugsbakk1-0/+10
Document `TAG_EDITMSG` which we have told the user about on unsuccessful command invocations since commit 3927bbe9a4 (tag: delete TAG_EDITMSG only on successful tag, 2008-12-06). Introduce this documentation since we are going to add tests for the lifetime of this file in the case of command failure and success. Use the documentation for `COMMIT_EDITMSG` from `git-commit.txt` as a template since these two files share the same purpose.[1] † 1: from commit 3927bbe9a4: “ This matches the behavior of COMMIT_EDITMSG, which stays around in case of error. Suggested-by: Junio C Hamano <gitster@pobox.com> Signed-off-by: Kristoffer Haugsbakk <code@khaugsbakk.name> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-16test: do not negate test_path_is_* to assert absenseJunio C Hamano2-3/+3
These tests use "! test_path_is_dir" or "! test_path_is_file" to ensure that the path is not recursively checked out or "submodule update" did not touch the working tree. Use "test_path_is_missing" to assert that the path does not exist, instead of negating test_path_is_* helpers; they are designed to be loud in wrong occasions. Besides, negating "test_path_is_dir" would mean we would be happy if a file exists there, which is not the case for these tests. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-16t2021: do not negate test_path_is_dirJunio C Hamano1-1/+1
In this test, a path (some_dir) that is originally a directory is to be removed and then to be replaced with a file of the same name. The expectation is that the path becomes a file at the end. However, "! test_path_is_dir some_dir" is used to catch a breakage that leaves the path as a directory. But as with all the "test_path_is..." helpers, this use of the helper makes it loud when the expectation (i.e. it is a directory) is met, and otherwise is silent when it is not---this does not help debugging. Be more explicit and state that we expect the path to become a file. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-16tests: do not negate test_path_existsJunio C Hamano2-3/+3
As a way to assert the path 'foo' is missing, "! test_path_exists foo" is a poor way to do so, as the helper is designed to complain when 'foo' is missing, but the intention of the author who used negated form was to make sure it does not exist. This does not help debugging the tests. Use test_path_is_missing instead, which is a more appropriate helper. Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-16Merge tag 'v2.41.0-rc0'Jiang Xin804-7028/+14309
Git 2.41-rc0 * tag 'v2.41.0-rc0': (508 commits) Git 2.41-rc0 t5583: fix shebang line merge-tree: load default git config fetch: introduce machine-parseable "porcelain" output format fetch: move option related variables into main function fetch: lift up parsing of "fetch.output" config variable fetch: introduce `display_format` enum fetch: refactor calculation of the display table width fetch: print left-hand side when fetching HEAD:foo fetch: add a test to exercise invalid output formats fetch: split out tests for output format fetch: fix `--no-recurse-submodules` with multi-remote fetches The eighteenth batch The seventeenth batch diff-files: integrate with sparse index t1092: add tests for `git diff-files` test: rev-parse-upstream: add missing cmp t: drop "verbose" helper function t7001: use "ls-files --format" instead of "cut" t7001: avoid git on upstream of pipe ...
2023-05-15Git 2.41-rc0v2.41.0-rc0Junio C Hamano1-0/+43
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2023-05-15Merge branch 'ps/fetch-output-format'Junio C Hamano6-250/+607
"git fetch" learned the "--porcelain" option that emits what it did in a machine-parseable format. * ps/fetch-output-format: fetch: introduce machine-parseable "porcelain" output format fetch: move option related variables into main function fetch: lift up parsing of "fetch.output" config variable fetch: introduce `display_format` enum fetch: refactor calculation of the display table width fetch: print left-hand side when fetching HEAD:foo fetch: add a test to exercise invalid output formats fetch: split out tests for output format fetch: fix `--no-recurse-submodules` with multi-remote fetches
2023-05-15Merge branch 'sg/retire-unused-cocci'Junio C Hamano3-170/+0
Retire a rather expensive-to-run Coccinelle check patch. * sg/retire-unused-cocci: cocci: remove 'unused.cocci'
2023-05-15Merge branch 'sl/diff-files-sparse'Junio C Hamano3-2/+70
Teach "diff-files" not to expand sparse-index unless needed. * sl/diff-files-sparse: diff-files: integrate with sparse index t1092: add tests for `git diff-files`
2023-05-15Merge branch 'ds/merge-tree-use-config'Junio C Hamano2-0/+21
Allow git forges to disable replace-refs feature while running "git merge-tree". * ds/merge-tree-use-config: merge-tree: load default git config
2023-05-15Merge branch 'js/subtree-fully-spelt-quiet-and-debug-options'Junio C Hamano1-2/+2
"git subtree" (in contrib/) update. * js/subtree-fully-spelt-quiet-and-debug-options: subtree: support long global flags
2023-05-15Merge branch 'ar/test-cleanup-unused-file-creation'Junio C Hamano1-1/+2
Test fix. * ar/test-cleanup-unused-file-creation: test: rev-parse-upstream: add missing cmp
2023-05-15Merge branch 'jk/test-verbose-no-more'Junio C Hamano12-81/+77
Retire "verbose" helper function from the test framework. * jk/test-verbose-no-more: t: drop "verbose" helper function t7001: use "ls-files --format" instead of "cut" t7001: avoid git on upstream of pipe
2023-05-15Merge branch 'tl/push-branches-is-an-alias-for-all'Junio C Hamano5-7/+135
"git push --all" gained an alias "git push --branches". * tl/push-branches-is-an-alias-for-all: t5583: fix shebang line push: introduce '--branches' option
2023-05-15Merge branch 'jc/name-rev-deprecate-stdin-further'Junio C Hamano2-8/+9
The "--stdin" option of "git name-rev" has been replaced with the "--annotate-stdin" option more than a year ago. We stop advertising it in the "git name-rev -h" output. * jc/name-rev-deprecate-stdin-further: name-rev: make --stdin hidden
2023-05-15Merge branch 'jc/t9800-fix-use-of-show-s-raw'Junio C Hamano1-1/+1
A test fix. * jc/t9800-fix-use-of-show-s-raw: t9800: correct misuse of 'show -s --raw' in a test
2023-05-15Merge branch 'jc/dirstat-plug-leaks'Junio C Hamano2-14/+22
"git diff --dirstat" leaked memory, which has been plugged. * jc/dirstat-plug-leaks: diff: plug leaks in dirstat diff: refactor common tail part of dirstat computation
2023-05-15Merge branch 'ds/fsck-bitmap'Junio C Hamano4-3/+98
"git fsck" learned to detect bit-flip breakages in the reachability bitmap files. * ds/fsck-bitmap: fsck: use local repository fsck: verify checksums of all .bitmap files
2023-05-15Merge branch 'js/gitk-fixes-from-gfw'Junio C Hamano1-5/+31
Gitk updates from GfW project. * js/gitk-fixes-from-gfw: gitk: escape file paths before piping to git log gitk: prevent overly long command lines
2023-05-15Merge branch 'fc/doc-use-datestamp-in-commit'Junio C Hamano1-1/+1
An earlier change broke "doc-diff", which has been corrected. * fc/doc-use-datestamp-in-commit: doc-diff: drop SOURCE_DATE_EPOCH override doc: doc-diff: specify date
2023-05-15Merge branch 'ar/config-count-tests-updates'Junio C Hamano1-11/+22
Test updates. * ar/config-count-tests-updates: t1300: add tests for missing keys t1300: check stderr for "ignores pairs" tests t1300: drop duplicate test
2023-05-15Merge branch 'kh/doc-interpret-trailers-updates'Junio C Hamano1-42/+55
Doc update. * kh/doc-interpret-trailers-updates: doc: interpret-trailers: fix example doc: interpret-trailers: don’t use deprecated config doc: interpret-trailers: use input redirection doc: interpret-trailers: don’t use heredoc in examples
2023-05-15Merge branch 'gc/trace-bare-repo-setup'Junio C Hamano2-7/+26
The tracing mechanism learned to notice and report when auto-discovered bare repositories are being used, as allowing so without explicitly stating the user intends to do so (with setting GIT_DIR for example) can be used with social engineering as an attack vector. * gc/trace-bare-repo-setup: setup: trace bare repository setups
2023-05-15Merge branch 'mc/send-email-header-cmd'Junio C Hamano4-20/+151
"git send-email" learned "--header-cmd=<cmd>" that can inject arbitrary e-mail header lines to the outgoing messages. * mc/send-email-header-cmd: send-email: detect empty blank lines in command output send-email: add --header-cmd, --no-header-cmd options send-email: extract execute_cmd from recipients_cmd
2023-05-15Merge branch 'jc/doc-clarify-git-default-hash-variable'Junio C Hamano1-3/+3
The documentation was misleading about the interaction between GIT_DEFAULT_HASH and "git clone", which has been clarified to stress that the variable is to be ignored by the command. * jc/doc-clarify-git-default-hash-variable: doc: GIT_DEFAULT_HASH is and will be ignored during "clone"
2023-05-15Merge branch 'rj/branch-unborn-in-other-worktrees'Junio C Hamano5-48/+105
Error messages given when working on an unborn branch that is checked out in another worktree have been improved. * rj/branch-unborn-in-other-worktrees: branch: avoid unnecessary worktrees traversals branch: rename orphan branches in any worktree branch: description for orphan branch errors branch: use get_worktrees() in copy_or_rename_branch() branch: test for failures while renaming branches
2023-05-14doc/git-config: add unit for http.lowSpeedLimitCorentin Garcia1-2/+3
Add the unit (bytes per second) for http.lowSpeedLimit in the documentation. Signed-off-by: Corentin Garcia <corenting@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>