]> git.ipfire.org Git - thirdparty/git.git/log
thirdparty/git.git
14 months agoenvironment.h: move declarations for environment.c functions from cache.h
Elijah Newren [Tue, 21 Mar 2023 06:26:03 +0000 (06:26 +0000)] 
environment.h: move declarations for environment.c functions from cache.h

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agotreewide: remove unnecessary includes of cache.h
Elijah Newren [Tue, 21 Mar 2023 06:26:02 +0000 (06:26 +0000)] 
treewide: remove unnecessary includes of cache.h

The last several commits were geared at replacing the include of cache.h
in strbuf.c with an include of git-compat-util.h.  Unfortunately, I had
to drop a patch moving some functions from cache.h to object-name.h, due
to excessive conflicts with other in-flight topics.

However, even without that patch, the series of patches so far allows us
to modify a number of C files to replace an include of cache.h with
git-compat-util.h.  Do that to reduce our dependencies.

(If we could have kept our object-name.h patch in this series, it would
have also let us reduce the includes in checkout.c and fmt-merge-msg.c
in addition to strbuf.c).

Just to ensure that nothing else was bringing in cache.h, all of the
affected files have been checked to ensure that
    gcc -E -I. $SOURCE_FILE | grep '"cache.h"'
found no hits and that
    make DEVELOPER=1 ${OBJECT_FILE_FOR_SOURCE_FILE}
successfully compiles without warnings.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agowrapper.h: move declarations for wrapper.c functions from cache.h
Elijah Newren [Tue, 21 Mar 2023 06:26:01 +0000 (06:26 +0000)] 
wrapper.h: move declarations for wrapper.c functions from cache.h

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agopath.h: move function declarations for path.c functions from cache.h
Elijah Newren [Tue, 21 Mar 2023 06:26:00 +0000 (06:26 +0000)] 
path.h: move function declarations for path.c functions from cache.h

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agocache.h: remove expand_user_path()
Elijah Newren [Tue, 21 Mar 2023 06:25:59 +0000 (06:25 +0000)] 
cache.h: remove expand_user_path()

expand_user_path() was renamed to interpolate_path() back in mid-2021,
but reinstated with a #define and a NEEDSWORK comment that we would
eventually want to get rid of it.  Do so now.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoabspath.h: move absolute path functions from cache.h
Elijah Newren [Tue, 21 Mar 2023 06:25:58 +0000 (06:25 +0000)] 
abspath.h: move absolute path functions from cache.h

This is another step towards letting us remove the include of cache.h in
strbuf.c.  It does mean that we also need to add includes of abspath.h
in a number of C files.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoenvironment: move comment_line_char from cache.h
Elijah Newren [Tue, 21 Mar 2023 06:25:57 +0000 (06:25 +0000)] 
environment: move comment_line_char from cache.h

This is one step towards making strbuf.c not depend upon cache.h.
Additional steps will follow in subsequent commits.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agotreewide: remove unnecessary cache.h inclusion from several sources
Elijah Newren [Tue, 21 Mar 2023 06:25:56 +0000 (06:25 +0000)] 
treewide: remove unnecessary cache.h inclusion from several sources

A number of files were apparently including cache.h solely to get
gettext.h.  By making those files explicitly include gettext.h, we can
already drop the include of cache.h in these files.  On top of that,
there were some files using cache.h that didn't need to for any reason.
Remove these unnecessary includes.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agotreewide: remove unnecessary inclusion of gettext.h
Elijah Newren [Tue, 21 Mar 2023 06:25:55 +0000 (06:25 +0000)] 
treewide: remove unnecessary inclusion of gettext.h

Looking at things from the opposite angle of the last patch, we had a
few files that were including gettext.h and perhaps needed it at some
point in history, but no longer require it.  Remove the include.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agotreewide: be explicit about dependence on gettext.h
Elijah Newren [Tue, 21 Mar 2023 06:25:54 +0000 (06:25 +0000)] 
treewide: be explicit about dependence on gettext.h

Dozens of files made use of gettext functions, without explicitly
including gettext.h.  This made it more difficult to find which files
could remove a dependence on cache.h.  Make C files explicitly include
gettext.h if they are using it.

However, while compat/fsmonitor/fsm-ipc-darwin.c should also gain an
include of gettext.h, it was left out to avoid conflicting with an
in-flight topic.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agotreewide: remove unnecessary cache.h inclusion from a few headers
Elijah Newren [Tue, 21 Mar 2023 06:25:53 +0000 (06:25 +0000)] 
treewide: remove unnecessary cache.h inclusion from a few headers

Ever since a64215b6cd ("object.h: stop depending on cache.h; make
cache.h depend on object.h", 2023-02-24), we have a few headers that
could have replaced their include of cache.h with an include of
object.h.  Make that change now.

Some C files had to start including cache.h after this change (or some
smaller header it had brought in), because the C files were depending
on things from cache.h but were only formerly implicitly getting
cache.h through one of these headers being modified in this patch.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoThe second batch
Junio C Hamano [Sun, 19 Mar 2023 22:03:22 +0000 (15:03 -0700)] 
The second batch

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoMerge branch 'jk/add-p-unmerged-fix'
Junio C Hamano [Sun, 19 Mar 2023 22:03:13 +0000 (15:03 -0700)] 
Merge branch 'jk/add-p-unmerged-fix'

"git add -p" while the index is unmerged sometimes failed to parse
the diff output it internally produces and died, which has been
corrected.

* jk/add-p-unmerged-fix:
  add-patch: handle "* Unmerged path" lines

14 months agoMerge branch 'ew/fetch-no-write-fetch-head-fix'
Junio C Hamano [Sun, 19 Mar 2023 22:03:13 +0000 (15:03 -0700)] 
Merge branch 'ew/fetch-no-write-fetch-head-fix'

* ew/fetch-no-write-fetch-head-fix:
  fetch: pass --no-write-fetch-head to subprocesses

14 months agoMerge branch 'fc/advice-diverged-history'
Junio C Hamano [Sun, 19 Mar 2023 22:03:12 +0000 (15:03 -0700)] 
Merge branch 'fc/advice-diverged-history'

After "git pull" that is configured with pull.rebase=false
merge.ff=only fails due to our end having our own development, give
advice messages to get out of the "Not possible to fast-forward"
state.

* fc/advice-diverged-history:
  advice: add diverging advice for novices

14 months agoMerge branch 'ab/fix-strategy-opts-parsing'
Junio C Hamano [Sun, 19 Mar 2023 22:03:12 +0000 (15:03 -0700)] 
Merge branch 'ab/fix-strategy-opts-parsing'

The code to parse "git rebase -X<opt>" was not prepared to see an
unparsable option string, which has been corrected.

* ab/fix-strategy-opts-parsing:
  sequencer.c: fix overflow & segfault in parse_strategy_opts()

14 months agoMerge branch 'ds/reprepare-alternates-when-repreparing-packfiles'
Junio C Hamano [Sun, 19 Mar 2023 22:03:12 +0000 (15:03 -0700)] 
Merge branch 'ds/reprepare-alternates-when-repreparing-packfiles'

Once we start running, we assumed that the list of alternate object
databases would never change.  Hook into the machinery used to
update the list of packfiles during runtime to update this list as
well.

* ds/reprepare-alternates-when-repreparing-packfiles:
  object-file: reprepare alternates when necessary

14 months agoMerge branch 'jk/format-patch-change-format-for-empty-commits'
Junio C Hamano [Sun, 19 Mar 2023 22:03:12 +0000 (15:03 -0700)] 
Merge branch 'jk/format-patch-change-format-for-empty-commits'

"git format-patch" learned to write a log-message only output file
for empty commits.

* jk/format-patch-change-format-for-empty-commits:
  format-patch: output header for empty commits

14 months agoMerge branch 'jk/bundle-use-dash-for-stdfiles'
Junio C Hamano [Sun, 19 Mar 2023 22:03:12 +0000 (15:03 -0700)] 
Merge branch 'jk/bundle-use-dash-for-stdfiles'

"git bundle" learned that "-" is a common way to say that the input
comes from the standard input and/or the output goes to the
standard output.  It used to work only for output and only from the
root level of the working tree.

* jk/bundle-use-dash-for-stdfiles:
  parse-options: use prefix_filename_except_for_dash() helper
  parse-options: consistently allocate memory in fix_filename()
  bundle: don't blindly apply prefix_filename() to "-"
  bundle: document handling of "-" as stdin
  bundle: let "-" mean stdin for reading operations

14 months agoMerge branch 'jk/bundle-progress'
Junio C Hamano [Sun, 19 Mar 2023 22:03:11 +0000 (15:03 -0700)] 
Merge branch 'jk/bundle-progress'

Simplify UI to control progress meter given by "git bundle" command.

* jk/bundle-progress:
  bundle: turn on --all-progress-implied by default

14 months agoMerge branch 'as/doc-markup-fix'
Junio C Hamano [Sun, 19 Mar 2023 22:03:11 +0000 (15:03 -0700)] 
Merge branch 'as/doc-markup-fix'

Fix for a mis-mark-up in doc made in Git 2.39 days.

* as/doc-markup-fix:
  git-merge-tree.txt: replace spurious HTML entity

14 months agoMerge branch 'rj/avoid-switching-to-already-used-branch'
Junio C Hamano [Sun, 19 Mar 2023 22:03:11 +0000 (15:03 -0700)] 
Merge branch 'rj/avoid-switching-to-already-used-branch'

A few subcommands have been taught to stop users from working on a
branch that is being used in another worktree linked to the same
repository.

* rj/avoid-switching-to-already-used-branch:
  switch: reject if the branch is already checked out elsewhere (test)
  rebase: refuse to switch to a branch already checked out elsewhere (test)
  branch: fix die_if_checked_out() when ignore_current_worktree
  worktree: introduce is_shared_symref()

14 months agoMerge branch 'rj/bisect-already-used-branch'
Junio C Hamano [Sun, 19 Mar 2023 22:03:11 +0000 (15:03 -0700)] 
Merge branch 'rj/bisect-already-used-branch'

Allow "git bisect reset" to check out the original branch when the
branch is already checked out in a different worktree linked to the
same repository.

* rj/bisect-already-used-branch:
  bisect: fix "reset" when branch is checked out elsewhere

14 months agoMerge branch 'zh/push-to-delete-onelevel-ref'
Junio C Hamano [Sun, 19 Mar 2023 22:03:10 +0000 (15:03 -0700)] 
Merge branch 'zh/push-to-delete-onelevel-ref'

"git push" has been taught to allow deletion of refs with one-level
names to help repairing a repository who acquired such a ref by
mistake.  In general, we don't encourage use of such a ref, and
creation or update to such a ref is rejected as before.

* zh/push-to-delete-onelevel-ref:
  push: allow delete single-level ref
  receive-pack: fix funny ref error messsage

14 months agoMerge branch 'ak/restore-both-incompatible-with-conflicts'
Junio C Hamano [Sun, 19 Mar 2023 22:03:10 +0000 (15:03 -0700)] 
Merge branch 'ak/restore-both-incompatible-with-conflicts'

"git restore" supports options like "--ours" that are only
meaningful during a conflicted merge, but these options are only
meaningful when updating the working tree files.  These options are
marked to be incompatible when both "--staged" and "--worktree" are
in effect.

* ak/restore-both-incompatible-with-conflicts:
  restore: fault --staged --worktree with merge opts

14 months agoMerge branch 'ew/commit-reach-clean-up-flags-fix'
Junio C Hamano [Sun, 19 Mar 2023 22:03:10 +0000 (15:03 -0700)] 
Merge branch 'ew/commit-reach-clean-up-flags-fix'

Fix a segfaulting loop.  The function and its caller may need
further clean-up.

* ew/commit-reach-clean-up-flags-fix:
  commit-reach: avoid NULL dereference

14 months agoMerge branch 'ab/avoid-losing-exit-codes-in-tests'
Junio C Hamano [Sun, 19 Mar 2023 22:03:10 +0000 (15:03 -0700)] 
Merge branch 'ab/avoid-losing-exit-codes-in-tests'

Test clean-up.

* ab/avoid-losing-exit-codes-in-tests:
  tests: don't lose misc "git" exit codes
  tests: don't lose exit status with "test <op> $(git ...)"
  tests: don't lose "git" exit codes in "! ( git ... | grep )"
  tests: don't lose exit status with "(cd ...; test <op> $(git ...))"
  t/lib-patch-mode.sh: fix ignored exit codes
  auto-crlf tests: don't lose exit code in loops and outside tests

14 months agoStart the 2.41 cycle
Junio C Hamano [Fri, 17 Mar 2023 21:03:20 +0000 (14:03 -0700)] 
Start the 2.41 cycle

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoMerge branch 'fz/rebase-msg-update'
Junio C Hamano [Fri, 17 Mar 2023 21:03:10 +0000 (14:03 -0700)] 
Merge branch 'fz/rebase-msg-update'

Message update.

* fz/rebase-msg-update:
  rebase: fix capitalisation autoSquash in i18n string

14 months agoMerge branch 'ew/fetch-hiderefs'
Junio C Hamano [Fri, 17 Mar 2023 21:03:10 +0000 (14:03 -0700)] 
Merge branch 'ew/fetch-hiderefs'

A new "fetch.hideRefs" option can be used to exclude specified refs
from "rev-list --objects --stdin --not --all" traversal for
checking object connectivity, most useful when there are many
unrelated histories in a single repository.

* ew/fetch-hiderefs:
  fetch: support hideRefs to speed up connectivity checks

14 months agoMerge branch 'mc/credential-helper-www-authenticate'
Junio C Hamano [Fri, 17 Mar 2023 21:03:10 +0000 (14:03 -0700)] 
Merge branch 'mc/credential-helper-www-authenticate'

Allow information carried on the WWW-AUthenticate header to be
passed to the credential helpers.

* mc/credential-helper-www-authenticate:
  credential: add WWW-Authenticate header to cred requests
  http: read HTTP WWW-Authenticate response headers
  t5563: add tests for basic and anoymous HTTP access

14 months agoMerge branch 'jc/gpg-lazy-init'
Junio C Hamano [Fri, 17 Mar 2023 21:03:10 +0000 (14:03 -0700)] 
Merge branch 'jc/gpg-lazy-init'

Instead of forcing each command to choose to honor GPG related
configuration variables, make the subsystem lazily initialize
itself.

* jc/gpg-lazy-init:
  drop pure pass-through config callbacks
  gpg-interface: lazily initialize and read the configuration

14 months agoMerge branch 'jk/unused-post-2.39-part2'
Junio C Hamano [Fri, 17 Mar 2023 21:03:09 +0000 (14:03 -0700)] 
Merge branch 'jk/unused-post-2.39-part2'

More work towards -Wunused.

* jk/unused-post-2.39-part2: (21 commits)
  help: mark unused parameter in git_unknown_cmd_config()
  run_processes_parallel: mark unused callback parameters
  userformat_want_item(): mark unused parameter
  for_each_commit_graft(): mark unused callback parameter
  rewrite_parents(): mark unused callback parameter
  fetch-pack: mark unused parameter in callback function
  notes: mark unused callback parameters
  prio-queue: mark unused parameters in comparison functions
  for_each_object: mark unused callback parameters
  list-objects: mark unused callback parameters
  mark unused parameters in signal handlers
  run-command: mark error routine parameters as unused
  mark "pointless" data pointers in callbacks
  ref-filter: mark unused callback parameters
  http-backend: mark unused parameters in virtual functions
  http-backend: mark argc/argv unused
  object-name: mark unused parameters in disambiguate callbacks
  serve: mark unused parameters in virtual functions
  serve: use repository pointer to get config
  ls-refs: drop config caching
  ...

14 months agoMerge branch 'en/header-cleanup'
Junio C Hamano [Fri, 17 Mar 2023 21:03:08 +0000 (14:03 -0700)] 
Merge branch 'en/header-cleanup'

Code clean-up to clarify the rule that "git-compat-util.h" must be
the first to be included.

* en/header-cleanup:
  diff.h: remove unnecessary include of object.h
  Remove unnecessary includes of builtin.h
  treewide: replace cache.h with more direct headers, where possible
  replace-object.h: move read_replace_refs declaration from cache.h to here
  object-store.h: move struct object_info from cache.h
  dir.h: refactor to no longer need to include cache.h
  object.h: stop depending on cache.h; make cache.h depend on object.h
  ident.h: move ident-related declarations out of cache.h
  pretty.h: move has_non_ascii() declaration from commit.h
  cache.h: remove dependence on hex.h; make other files include it explicitly
  hex.h: move some hex-related declarations from cache.h
  hash.h: move some oid-related declarations from cache.h
  alloc.h: move ALLOC_GROW() functions from cache.h
  treewide: remove unnecessary cache.h includes in source files
  treewide: remove unnecessary cache.h includes
  treewide: remove unnecessary git-compat-util.h includes in headers
  treewide: ensure one of the appropriate headers is sourced first

14 months agoMerge branch 'en/dir-api-cleanup'
Junio C Hamano [Fri, 17 Mar 2023 21:03:08 +0000 (14:03 -0700)] 
Merge branch 'en/dir-api-cleanup'

Code clean-up to clarify directory traversal API.

* en/dir-api-cleanup:
  unpack-trees: add usage notices around df_conflict_entry
  unpack-trees: special case read-tree debugging as internal usage
  unpack-trees: rewrap a few overlong lines from previous patch
  unpack-trees: mark fields only used internally as internal
  unpack_trees: start splitting internal fields from public API
  sparse-checkout: avoid using internal API of unpack-trees, take 2
  sparse-checkout: avoid using internal API of unpack-trees
  unpack-trees: clean up some flow control
  dir: mark output only fields of dir_struct as such
  dir: add a usage note to exclude_per_dir
  dir: separate public from internal portion of dir_struct
  unpack-trees: heed requests to overwrite ignored files
  t2021: fix platform-specific leftover cruft

14 months agoMerge branch 'jk/fsck-indices-in-worktrees'
Junio C Hamano [Fri, 17 Mar 2023 21:03:08 +0000 (14:03 -0700)] 
Merge branch 'jk/fsck-indices-in-worktrees'

"git fsck" learned to check the index files in other worktrees,
just like "git gc" honors them as anchoring points.

* jk/fsck-indices-in-worktrees:
  fsck: check even zero-entry index files
  fsck: mention file path for index errors
  fsck: check index files in all worktrees
  fsck: factor out index fsck

14 months agoGit 2.40 v2.40.0
Junio C Hamano [Sun, 12 Mar 2023 21:34:41 +0000 (14:34 -0700)] 
Git 2.40

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoMerge tag 'l10n-2.40.0-rnd1' of https://github.com/git-l10n/git-po
Junio C Hamano [Sun, 12 Mar 2023 21:33:14 +0000 (14:33 -0700)] 
Merge tag 'l10n-2.40.0-rnd1' of https://github.com/git-l10n/git-po

l10n-2.40.0-rnd1

* tag 'l10n-2.40.0-rnd1' of https://github.com/git-l10n/git-po:
  l10n: zh_CN v2.40.0 round 1
  l10n: update German translation
  l10n: tr: Update Turkish translations for v.2.40.0
  l10n: fr: v2.40.0 rnd 2
  l10n: fr: v2.40.0 rnd 1
  l10n: fr: fix some typos
  l10n: po-id for 2.40 (round 1)
  l10n: sv.po: Update Swedish translation (5490t0f0u)
  l10n: bg.po: Updated Bulgarian translation (5490t)
  l10n: Update Catalan translation

14 months agoMerge branch 'fz/po-zh_CN' of github.com:fangyi-zhou/git-po
Jiang Xin [Fri, 10 Mar 2023 14:50:14 +0000 (22:50 +0800)] 
Merge branch 'fz/po-zh_CN' of github.com:fangyi-zhou/git-po

* 'fz/po-zh_CN' of github.com:fangyi-zhou/git-po:
  l10n: zh_CN v2.40.0 round 1

14 months agoobject-file: reprepare alternates when necessary
Derrick Stolee [Wed, 8 Mar 2023 18:47:32 +0000 (18:47 +0000)] 
object-file: reprepare alternates when necessary

When an object is not found in a repository's object store, we sometimes
call reprepare_packed_git() to see if the object was temporarily moved
into a new pack-file (and its old pack-file or loose object was
deleted). This process does a scan of each pack directory within each
odb, but does not reevaluate if the odb list needs updating.

Extend reprepare_packed_git() to also reprepare the alternate odb list
by setting loaded_alternates to zero and calling prepare_alt_odb(). This
will add newly-discoverd odbs to the linked list, but will not duplicate
existing ones nor will it remove existing ones that are no longer listed
in the alternates file. Do this under the object read lock to avoid
readers from interacting with a potentially incomplete odb being added
to the odb list.

If the alternates file was edited to _remove_ some alternates during the
course of the Git process, Git will continue to see alternates that were
ever valid for that repository. ODBs are not removed from the list, the
same as the existing behavior before this change. Git already has
protections against an alternate directory disappearing from the
filesystem during the lifetime of a process, and those are still in
effect.

This change is specifically for concurrent changes to the repository, so
it is difficult to create a test that guarantees this behavior is
correct. I manually verified by introducing a reprepare_packed_git() call
into get_revision() and stepped into that call in a debugger with a
parent 'git log' process. Multiple runs of prepare_alt_odb() kept
the_repository->objects->odb as a single-item chain until I added a
.git/objects/info/alternates file in a different process. The next run
added the new odb to the chain and subsequent runs did not add to the
chain.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agofetch: pass --no-write-fetch-head to subprocesses
Eric Wong [Wed, 8 Mar 2023 22:22:05 +0000 (22:22 +0000)] 
fetch: pass --no-write-fetch-head to subprocesses

It seems a user would expect this option would work regardless
of whether it's fetching from a single remote, many remotes,
or recursing into submodules.

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoadd-patch: handle "* Unmerged path" lines
Jeff King [Thu, 9 Mar 2023 08:58:16 +0000 (03:58 -0500)] 
add-patch: handle "* Unmerged path" lines

When we generate a diff with --cached, unmerged entries have no oid for
their index entry:

  $ git diff-index --abbrev --cached HEAD
  :100644 000000 f719efd 0000000 U my-conflict

So when we are asked to produce a patch, since we only have one side, we
just emit a special message:

  $ git diff-index --cached -p HEAD
  * Unmerged path my-conflict

This confuses interactive-patch modes that look at cached diffs. For
example:

  $ git reset -p
  BUG: add-patch.c:498: diff starts with unexpected line:
  * Unmerged path my-conflict

Making things even more confusing, you'll get that error only if the
unmerged entry is alphabetically the first changed file. Otherwise, we
simply stick the unrecognized line to the end of the previous hunk.
There it's mostly harmless, as it eventually gets fed back to "git
apply", which happily ignores it. But it's still shown to the user
attached to the hunk, which is wrong.

So let's handle these lines as a noop. There's not really anything
useful to do with a conflicted merge in this case, and that's what we do
for other cases like "add -p". There we get a "diff --cc" line, which we
accept as starting a new file, but we refuse to use any of its hunks
(their headers start with "@@@" and not "@@ ", so we silently ignore
them).

It seems like simply recognizing the line and continuing in our parsing
loop would work. But we actually need to run the rest of the loop body
to handle matching up our colored/filtered output. But that code assumes
that we have some active file_diff we're working on. So instead, we'll
just insert a dummy entry into our array. This ends up the same as if we
saw a "diff --cc" line (a file with no hunks).

Reported-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agosequencer.c: fix overflow & segfault in parse_strategy_opts()
Ævar Arnfjörð Bjarmason [Tue, 7 Mar 2023 18:21:59 +0000 (19:21 +0100)] 
sequencer.c: fix overflow & segfault in parse_strategy_opts()

The split_cmdline() function introduced in [1] returns an "int". If
it's negative it signifies an error. The option parsing in [2] didn't
account for this, and assigned the value directly to the "size_t
xopts_nr". We'd then attempt to loop over all of these elements, and
access uninitialized memory.

There's a few things that use this for option parsing, but one way to
trigger it is with a bad value to "-X <strategy-option>", e.g:

git rebase -X"bad argument\""

In another context this might be a security issue, but in this case
someone who's already able to inject arguments directly to our
commands would be past other defenses, making this potential
escalation a moot point.

As the example above & test case shows the error reporting leaves
something to be desired. The function will loop over the
whitespace-split values, but when it encounters an error we'll only
report the first element, which is OK, not the second "argument\""
whose quote is unbalanced.

This is an inherent limitation of the current API, and the issue
affects other API users. Let's not attempt to fix that now. If and
when that happens these tests will need to be adjusted to assert the
new output.

1. 2b11e3170e9 (If you have a config containing something like this:,
   2006-06-05)
2. ca6c6b45dd9 (sequencer (rebase -i): respect strategy/strategy_opts
   settings, 2017-01-02)

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoadvice: add diverging advice for novices
Felipe Contreras [Wed, 8 Mar 2023 02:48:33 +0000 (20:48 -0600)] 
advice: add diverging advice for novices

The user might not necessarily know why ff only was configured, maybe an
admin did it, or the installer (Git for Windows), or perhaps they just
followed some online advice.

This can happen not only on pull.ff=only, but merge.ff=only too.

Even worse if the user has configured pull.rebase=false and
merge.ff=only, because in those cases a diverging merge will constantly
keep failing. There's no trivial way to get out of this other than
`git merge --no-ff`.

Let's not assume our users are experts in git who completely understand
all their configurations.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Acked-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoMerge branch 'l10n-de-2.40' of github.com:ralfth/git
Jiang Xin [Wed, 8 Mar 2023 01:10:20 +0000 (09:10 +0800)] 
Merge branch 'l10n-de-2.40' of github.com:ralfth/git

* 'l10n-de-2.40' of github.com:ralfth/git:
  l10n: update German translation

14 months agoMerge branch 'po-id' of github.com:bagasme/git-po
Jiang Xin [Wed, 8 Mar 2023 00:28:02 +0000 (08:28 +0800)] 
Merge branch 'po-id' of github.com:bagasme/git-po

* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.40 (round 1)

14 months agoMerge branch 'catalan' of github.com:Softcatala/git-po
Jiang Xin [Wed, 8 Mar 2023 00:27:07 +0000 (08:27 +0800)] 
Merge branch 'catalan' of github.com:Softcatala/git-po

* 'catalan' of github.com:Softcatala/git-po:
  l10n: Update Catalan translation

14 months agoMerge branch 'fr_2.40.0_rnd1' of github.com:jnavila/git
Jiang Xin [Wed, 8 Mar 2023 00:26:00 +0000 (08:26 +0800)] 
Merge branch 'fr_2.40.0_rnd1' of github.com:jnavila/git

* 'fr_2.40.0_rnd1' of github.com:jnavila/git:
  l10n: fr: v2.40.0 rnd 2
  l10n: fr: v2.40.0 rnd 1
  l10n: fr: fix some typos

14 months agoMerge branch 'master' of github.com:nafmo/git-l10n-sv
Jiang Xin [Wed, 8 Mar 2023 00:25:07 +0000 (08:25 +0800)] 
Merge branch 'master' of github.com:nafmo/git-l10n-sv

* 'master' of github.com:nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (5490t0f0u)

14 months agoMerge branch 'master' of github.com:alshopov/git-po
Jiang Xin [Wed, 8 Mar 2023 00:23:16 +0000 (08:23 +0800)] 
Merge branch 'master' of github.com:alshopov/git-po

* 'master' of github.com:alshopov/git-po:
  l10n: bg.po: Updated Bulgarian translation (5490t)

14 months agoMerge branch 'turkish' of github.com:bitigchi/git-po
Jiang Xin [Wed, 8 Mar 2023 00:22:01 +0000 (08:22 +0800)] 
Merge branch 'turkish' of github.com:bitigchi/git-po

* 'turkish' of github.com:bitigchi/git-po:
  l10n: tr: Update Turkish translations for v.2.40.0

14 months agol10n: zh_CN v2.40.0 round 1
Fangyi Zhou [Tue, 7 Mar 2023 23:42:30 +0000 (23:42 +0000)] 
l10n: zh_CN v2.40.0 round 1

Reviewed-by: 依云 <lilydjwg@gmail.com>
Signed-off-by: Fangyi Zhou <me@fangyi.io>
14 months agoGit 2.40-rc2 v2.40.0-rc2
Junio C Hamano [Tue, 7 Mar 2023 05:53:11 +0000 (21:53 -0800)] 
Git 2.40-rc2

Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoMerge branch 'gm/signature-format-doc'
Junio C Hamano [Tue, 7 Mar 2023 05:51:56 +0000 (21:51 -0800)] 
Merge branch 'gm/signature-format-doc'

Doc update.

* gm/signature-format-doc:
  signature-format.txt: note SSH and X.509 signature delimiters

14 months agoparse-options: use prefix_filename_except_for_dash() helper
Jeff King [Sat, 4 Mar 2023 10:31:47 +0000 (05:31 -0500)] 
parse-options: use prefix_filename_except_for_dash() helper

Since our fix_filename()'s only remaining special case is handling "-",
we can use the newly-minted helper function that handles this already.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agoparse-options: consistently allocate memory in fix_filename()
Jeff King [Sat, 4 Mar 2023 10:31:22 +0000 (05:31 -0500)] 
parse-options: consistently allocate memory in fix_filename()

When handling OPT_FILENAME(), we have to stick the "prefix" (if any) in
front of the filename to make up for the fact that Git has chdir()'d to
the top of the repository. We can do this with prefix_filename(), but
there are a few special cases we handle ourselves.

Unfortunately the memory allocation is inconsistent here; if we do make
it to prefix_filename(), we'll allocate a string which the caller must
free to avoid a leak. But if we hit our special cases, we'll return the
string as-is, and a caller which tries to free it will crash. So there's
no way to win.

Let's consistently allocate, so that callers can do the right thing.

There are now three cases to care about in the function (and hence a
three-armed if/else):

  1. we got a NULL input (and should leave it as NULL, though arguably
     this is the sign of a bug; let's keep the status quo for now and we
     can pick at that scab later)

  2. we hit a special case that means we leave the name intact; we
     should duplicate the string. This includes our special "-"
     matching. Prior to this patch, it also included empty prefixes and
     absolute filenames. But we can observe that prefix_filename()
     already handles these, so we don't need to detect them.

  3. everything else goes to prefix_filename()

I've dropped the "const" from the "char **file" parameter to indicate
that we're allocating, though in practice it's not really important.
This is all being shuffled through a void pointer via opt->value before
it hits code which ever looks at the string. And it's even a bit weird,
because we are really taking _in_ a const string and using the same
out-parameter for a non-const string. A better function signature would
be:

  static char *fix_filename(const char *prefix, const char *file);

but that would mean the caller dereferences the double-pointer (and the
NULL check is currently handled inside this function). So I took the
path of least-change here.

Note that we have to fix several callers in this commit, too, or we'll
break the leak-checking tests. These are "new" leaks in the sense that
they are now triggered by the test suite, but these spots have always
been leaky when Git is run in a subdirectory of the repository. I fixed
all of the cases that trigger with GIT_TEST_PASSING_SANITIZE_LEAK. There
may be others in scripts that have other leaks, but we can fix them
later along with those other leaks (and again, you _couldn't_ fix them
before this patch, so this is the necessary first step).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agobundle: don't blindly apply prefix_filename() to "-"
Junio C Hamano [Sat, 4 Mar 2023 10:27:56 +0000 (05:27 -0500)] 
bundle: don't blindly apply prefix_filename() to "-"

A user can specify a filename to a command from the command line,
either as the value given to a command line option, or a command
line argument.  When it is given as a relative filename, in the
user's mind, it is relative to the directory "git" was started from,
but by the time the filename is used, "git" would almost always have
chdir()'ed up to the root level of the working tree.

The given filename, if it is relative, needs to be prefixed with the
path to the current directory, and it typically is done by calling
prefix_filename() helper function.  For commands that can also take
"-" to use the standard input or the standard output, however, this
needs to be done with care.

"git bundle create" uses the next word on the command line as the
output filename, and can take "-" to mean "write to the standard
output".  It blindly called prefix_filename(), so running it in a
subdirectory did not quite work as expected.

Introduce a new helper, prefix_filename_except_for_dash(), and use
it to help "git bundle create" codepath.

Reported-by: Michael Henry
Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agobundle: document handling of "-" as stdin
Jeff King [Sat, 4 Mar 2023 10:26:40 +0000 (05:26 -0500)] 
bundle: document handling of "-" as stdin

We have always allowed "bundle create -" to write to stdout, but it was
never documented. And a recent patch let reading operations like "bundle
list-heads -" read from stdin.

Let's document all of these cases.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agobundle: let "-" mean stdin for reading operations
Jeff King [Sat, 4 Mar 2023 10:26:14 +0000 (05:26 -0500)] 
bundle: let "-" mean stdin for reading operations

For writing, "bundle create -" indicates that the bundle should be
written to stdout. But there's no matching handling of "-" for reading
operations. This is inconsistent, and a little inflexible (though one
can always use "/dev/stdin" on systems that support it).

However, it's easy to change. Once upon a time, the bundle-reading code
required a seekable descriptor, but that was fixed long ago in
e9ee84cf28b (bundle: allowing to read from an unseekable fd,
2011-10-13). So we just need to handle "-" explicitly when opening the
file.

We _could_ do this by handling "-" in read_bundle_header(), which the
reading functions all call already. But that is probably a bad idea.
It's also used by low-level code like the transport functions, and we
may want to be more careful there. We do not know that stdin is even
available to us, and certainly we would not want to get confused by a
configured URL that happens to point to "-".

So instead, let's add a helper to builtin/bundle.c. Since both the
bundle code and some of the callers refer to the bundle by name for
error messages, let's use the string "<stdin>" to make the output a bit
nicer to read.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agogit-merge-tree.txt: replace spurious HTML entity
Andreas Schwab [Sat, 4 Mar 2023 17:00:46 +0000 (18:00 +0100)] 
git-merge-tree.txt: replace spurious HTML entity

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agobundle: turn on --all-progress-implied by default
Jeff King [Sat, 4 Mar 2023 10:55:13 +0000 (05:55 -0500)] 
bundle: turn on --all-progress-implied by default

In 79862b6b77c (bundle-create: progress output control, 2019-11-10),
"bundle create" learned about the --all-progress and
--all-progress-implied options, which were copied from pack-objects.
I think these were a mistake.

In pack-objects, "all-progress-implied" is about switching the behavior
between a regular on-disk "git repack" and the use of pack-objects for
push/fetch (where a fetch does not want progress from the server during
the write stage; the client will print progress as it receives the
data). But there's no such distinction for bundles. Prior to
79862b6b77c, we always printed the write stage. Afterwards, a vanilla:

  git bundle create foo.bundle

omits the write progress, appearing to hang (especially if your
repository is large or your disk is slow). That seems like a regression.

It's possible that the flexibility to disable the write-phase progress
_could_ be useful for bundle. E.g., if you did something like:

  ssh some-host git bundle create foo.bundle |
  git bundle unbundle

But if you are running both in real-time, why are you using bundles in
the first place? You're better off doing a real fetch.

But even if we did want to support that, it should be the exception, and
vanilla "bundle create" should display the full progress. So we'd want
to name the option "--no-write-progress" or something.

The "--all-progress" option itself is even worse. It exists in
pack-objects only for historical reasons. It's a mistake because it
implies "--progress", and we added "--all-progress-implied" to fix that.
There is no reason to propagate that mistake to new commands.

Likewise, the documentation for these options was pulled from
pack-objects. But it doesn't make any sense in this context. It talks
about "--stdout", but that is not even an option that git-bundle
supports.

This patch flips the default for "--all-progress-implied" back to
"true", fixing the regression in 79862b6b77c. This turns that option
into a noop, and means that "--all-progress" is really the same as
"--progress". We _could_ drop them completely, but since they've been
shipped with Git since v2.25.0, it's polite to continue accepting them.

I didn't implement any sort of "--no-write-progress" here. I'm not at
all convinced it's necessary, and the discussion from the original
thread:

  https://lore.kernel.org/git/20191110204126.30553-2-robbat2@gentoo.org/

shows that that the main focus was on getting --progress and --quiet
support, and not any kind of clever "real-time bundle over the network"
feature. But technically this patch is making it impossible to do
something that you _could_ do post-79862b6b77c.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agol10n: update German translation
Ralf Thielow [Fri, 3 Mar 2023 16:23:10 +0000 (17:23 +0100)] 
l10n: update German translation

Reviewed-by: Matthias Rüster <matthias.ruester@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
14 months agoformat-patch: output header for empty commits
John Keeping [Fri, 3 Mar 2023 16:03:01 +0000 (16:03 +0000)] 
format-patch: output header for empty commits

When formatting an empty commit, it is surprising that a totally empty
file is generated.  Set the flag to always print the header, matching
the behaviour of git-log.

Signed-off-by: John Keeping <john@keeping.me.uk>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
14 months agol10n: tr: Update Turkish translations for v.2.40.0
Emir SARI [Sat, 25 Feb 2023 10:53:07 +0000 (13:53 +0300)] 
l10n: tr: Update Turkish translations for v.2.40.0

Signed-off-by: Emir SARI <emir_sari@icloud.com>
15 months agol10n: fr: v2.40.0 rnd 2
Jean-Noël Avila [Thu, 2 Mar 2023 17:45:05 +0000 (18:45 +0100)] 
l10n: fr: v2.40.0 rnd 2

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
15 months agol10n: fr: v2.40.0 rnd 1
Jean-Noël Avila [Mon, 27 Feb 2023 19:58:56 +0000 (20:58 +0100)] 
l10n: fr: v2.40.0 rnd 1

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
15 months agol10n: fr: fix some typos
Jean-Noël Avila [Sat, 31 Dec 2022 15:37:33 +0000 (16:37 +0100)] 
l10n: fr: fix some typos

Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
Reported-by: Andrei Rybak <rybak.a.v@gmail.com>
15 months agol10n: po-id for 2.40 (round 1)
Bagas Sanjaya [Wed, 1 Mar 2023 09:00:12 +0000 (16:00 +0700)] 
l10n: po-id for 2.40 (round 1)

Update following components:

  * archive.c
  * attr.c
  * builtin/add.c
  * builtin/rebase.c
  * bundle.c
  * connect.c
  * sequencer.c
  * t/helper/test-bundle-uri.c
  * transport.c
  * wt-status.c

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
15 months agol10n: sv.po: Update Swedish translation (5490t0f0u)
Peter Krefting [Thu, 2 Mar 2023 08:35:41 +0000 (09:35 +0100)] 
l10n: sv.po: Update Swedish translation (5490t0f0u)

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
15 months agol10n: bg.po: Updated Bulgarian translation (5490t)
Alexander Shopov [Sat, 25 Feb 2023 15:14:56 +0000 (16:14 +0100)] 
l10n: bg.po: Updated Bulgarian translation (5490t)

Signed-off-by: Alexander Shopov <ash@kambanaria.org>
15 months agoMerge branch 'rs/range-diff-custom-abbrev-fix'
Junio C Hamano [Wed, 1 Mar 2023 21:25:24 +0000 (13:25 -0800)] 
Merge branch 'rs/range-diff-custom-abbrev-fix'

Hotfix for a topic that is already in 'master'.

* rs/range-diff-custom-abbrev-fix:
  range-diff: avoid compiler warning when char is unsigned

15 months agol10n: Update Catalan translation
Jordi Mas [Wed, 1 Mar 2023 21:07:24 +0000 (22:07 +0100)] 
l10n: Update Catalan translation

Signed-off-by: Jordi Mas <jmas@softcatala.org>
15 months agoGit 2.40-rc1 v2.40.0-rc1
Junio C Hamano [Wed, 1 Mar 2023 16:13:35 +0000 (08:13 -0800)] 
Git 2.40-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agopush: allow delete single-level ref
ZheNing Hu [Wed, 1 Mar 2023 10:20:29 +0000 (10:20 +0000)] 
push: allow delete single-level ref

We discourage the creation/update of single-level refs
because some upper-layer applications only work in specified
reference namespaces, such as "refs/heads/*" or "refs/tags/*",
these single-level refnames may not be recognized. However,
we still hope users can delete them which have been created
by mistake.

Therefore, when updating branches on the server with
"git receive-pack", by checking whether it is a branch deletion
operation, it will determine whether to allow the update of
a single-level refs. This avoids creating/updating such
single-level refs, but allows them to be deleted.

On the client side, "git push" also does not properly fill in
the old-oid of single-level refs, which causes the server-side
"git receive-pack" to think that the ref's old-oid has changed
when deleting single-level refs, this causes the push to be
rejected. So the solution is to fix the client to be able to
delete single-level refs by properly filling old-oid.

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agoreceive-pack: fix funny ref error messsage
ZheNing Hu [Wed, 1 Mar 2023 10:20:28 +0000 (10:20 +0000)] 
receive-pack: fix funny ref error messsage

When the user deletes the remote one level branch through
"git push origin -d refs/foo", remote will return an error:
"refusing to create funny ref 'refs/foo' remotely", here we
are not creating "refs/foo" instead wants to delete it, so a
better error description here would be: "refusing to update
funny ref 'refs/foo' remotely".

Signed-off-by: ZheNing Hu <adlternative@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agoA bit more before 2.40-rc1
Junio C Hamano [Tue, 28 Feb 2023 23:42:20 +0000 (15:42 -0800)] 
A bit more before 2.40-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agoMerge branch 'ar/test-lib-remove-stale-comment'
Junio C Hamano [Wed, 1 Mar 2023 00:38:47 +0000 (16:38 -0800)] 
Merge branch 'ar/test-lib-remove-stale-comment'

Test library clean-up.

* ar/test-lib-remove-stale-comment:
  test-lib: drop comment about test_description

15 months agoMerge branch 'zy/t9700-style'
Junio C Hamano [Wed, 1 Mar 2023 00:38:47 +0000 (16:38 -0800)] 
Merge branch 'zy/t9700-style'

Test style fixes.

* zy/t9700-style:
  t9700: modernize test scripts

15 months agoMerge branch 'pw/rebase-i-parse-fix'
Junio C Hamano [Wed, 1 Mar 2023 00:38:47 +0000 (16:38 -0800)] 
Merge branch 'pw/rebase-i-parse-fix'

Fixes to code that parses the todo file used in "rebase -i".

* pw/rebase-i-parse-fix:
  rebase -i: fix parsing of "fixup -C<commit>"
  rebase -i: match whole word in is_command()

15 months agoMerge branch 'jk/http-test-fixes'
Junio C Hamano [Wed, 1 Mar 2023 00:38:47 +0000 (16:38 -0800)] 
Merge branch 'jk/http-test-fixes'

Various fix-ups on HTTP tests.

* jk/http-test-fixes:
  t5559: make SSL/TLS the default
  t5559: fix test failures with LIB_HTTPD_SSL
  t/lib-httpd: enable HTTP/2 "h2" protocol, not just h2c
  t/lib-httpd: respect $HTTPD_PROTO in expect_askpass()
  t5551: drop curl trace lines without headers
  t5551: handle v2 protocol in cookie test
  t5551: simplify expected cookie file
  t5551: handle v2 protocol in upload-pack service test
  t5551: handle v2 protocol when checking curl trace
  t5551: stop forcing clone to run with v0 protocol
  t5551: handle HTTP/2 when checking curl trace
  t5551: lower-case headers in expected curl trace
  t5551: drop redundant grep for Accept-Language
  t5541: simplify and move "no empty path components" test
  t5541: stop marking "used receive-pack service" test as v0 only
  t5541: run "used receive-pack service" test earlier

15 months agorange-diff: avoid compiler warning when char is unsigned
René Scharfe [Tue, 28 Feb 2023 16:13:27 +0000 (17:13 +0100)] 
range-diff: avoid compiler warning when char is unsigned

Since 2b15969f61 (range-diff: let '--abbrev' option takes effect,
2023-02-20), GCC 11.3 on Ubuntu 22.04 on aarch64 warns (and errors
out if the make variable DEVELOPER is set):

range-diff.c: In function ‘output_pair_header’:
range-diff.c:388:20: error: comparison is always false due to limited range of data type [-Werror=type-limits]
  388 |         if (abbrev < 0)
      |                    ^
cc1: all warnings being treated as errors

That's because char is unsigned on that platform.  Use int instead, just
like in struct diff_options, to copy the value faithfully.

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agosignature-format.txt: note SSH and X.509 signature delimiters
Gwyneth Morgan [Mon, 27 Feb 2023 20:27:18 +0000 (20:27 +0000)] 
signature-format.txt: note SSH and X.509 signature delimiters

This document only explains PGP signatures, but Git now supports X.509
signatures as of 1e7adb9756 (gpg-interface: introduce new signature
format "x509" using gpgsm, 2018-07-17), and SSH signatures as of
29b315778e (ssh signing: add ssh key format and signing code,
2021-09-10).

Additionally, explain that these signature formats are controlled
`gpg.format`, linking to its documentation, and explain in said
`gpg.format` documentation that the underlying signature format is
documented in signature-format.txt.

Signed-off-by: Gwyneth Morgan <gwymor@tilde.club>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agorebase: fix capitalisation autoSquash in i18n string
Fangyi Zhou [Sun, 26 Feb 2023 18:00:29 +0000 (18:00 +0000)] 
rebase: fix capitalisation autoSquash in i18n string

The config option (as documented) for rebase.autoSquash has a capital S,
whereas the command line option has a small case s.

Cf. <20220617100309.3224-1-worldhello.net@gmail.com>

Signed-off-by: Fangyi Zhou <me@fangyi.io>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agocredential: add WWW-Authenticate header to cred requests
Matthew John Cheetham [Mon, 27 Feb 2023 17:20:20 +0000 (17:20 +0000)] 
credential: add WWW-Authenticate header to cred requests

Add the value of the WWW-Authenticate response header to credential
requests. Credential helpers that understand and support HTTP
authentication and authorization can use this standard header (RFC 2616
Section 14.47 [1]) to generate valid credentials.

WWW-Authenticate headers can contain information pertaining to the
authority, authentication mechanism, or extra parameters/scopes that are
required.

The current I/O format for credential helpers only allows for unique
names for properties/attributes, so in order to transmit multiple header
values (with a specific order) we introduce a new convention whereby a
C-style array syntax is used in the property name to denote multiple
ordered values for the same property.

In this case we send multiple `wwwauth[]` properties where the order
that the repeated attributes appear in the conversation reflects the
order that the WWW-Authenticate headers appeared in the HTTP response.

Add a set of tests to exercise the HTTP authentication header parsing
and the interop with credential helpers. Credential helpers will receive
WWW-Authenticate information in credential requests.

[1] https://datatracker.ietf.org/doc/html/rfc2616#section-14.47

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agohttp: read HTTP WWW-Authenticate response headers
Matthew John Cheetham [Mon, 27 Feb 2023 17:20:19 +0000 (17:20 +0000)] 
http: read HTTP WWW-Authenticate response headers

Read and store the HTTP WWW-Authenticate response headers made for
a particular request.

This will allow us to pass important authentication challenge
information to credential helpers or others that would otherwise have
been lost.

libcurl only provides us with the ability to read all headers recieved
for a particular request, including any intermediate redirect requests
or proxies. The lines returned by libcurl include HTTP status lines
delinating any intermediate requests such as "HTTP/1.1 200". We use
these lines to reset the strvec of WWW-Authenticate header values as
we encounter them in order to only capture the final response headers.

The collection of all header values matching the WWW-Authenticate
header is complicated by the fact that it is legal for header fields to
be continued over multiple lines, but libcurl only gives us each
physical line a time, not each logical header. This line folding feature
is deprecated in RFC 7230 [1] but older servers may still emit them, so
we need to handle them.

In the future [2] we may be able to leverage functions to read headers
from libcurl itself, but as of today we must do this ourselves.

[1] https://www.rfc-editor.org/rfc/rfc7230#section-3.2
[2] https://daniel.haxx.se/blog/2022/03/22/a-headers-api-for-libcurl/

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agot5563: add tests for basic and anoymous HTTP access
Matthew John Cheetham [Mon, 27 Feb 2023 17:20:18 +0000 (17:20 +0000)] 
t5563: add tests for basic and anoymous HTTP access

Add a test showing simple anoymous HTTP access to an unprotected
repository, that results in no credential helper invocations.
Also add a test demonstrating simple basic authentication with
simple credential helper support.

Leverage a no-parsed headers (NPH) CGI script so that we can directly
control the HTTP responses to simulate a multitude of good, bad and ugly
remote server implementations around auth.

Signed-off-by: Matthew John Cheetham <mjcheetham@outlook.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agoA bit more before 2.40-rc1
Junio C Hamano [Mon, 27 Feb 2023 18:06:20 +0000 (10:06 -0800)] 
A bit more before 2.40-rc1

Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agoMerge branch 'if/simplify-trace-setup'
Junio C Hamano [Mon, 27 Feb 2023 18:08:57 +0000 (10:08 -0800)] 
Merge branch 'if/simplify-trace-setup'

Code clean-up.

* if/simplify-trace-setup:
  trace.c, git.c: remove unnecessary parameter to trace_repo_setup()

15 months agoMerge branch 'jc/countermand-format-attach'
Junio C Hamano [Mon, 27 Feb 2023 18:08:57 +0000 (10:08 -0800)] 
Merge branch 'jc/countermand-format-attach'

The format.attach configuration variable lacked a way to override a
value defined in a lower-priority configuration file (e.g. the
system one) by redefining it in a higher-priority configuration
file.  Now, setting format.attach to an empty string means show the
patch inline in the e-mail message, without using MIME attachment.

This is a backward incompatible change.

* jc/countermand-format-attach:
  format.attach: allow empty value to disable multi-part messages

15 months agoMerge branch 'jk/shorten-unambiguous-ref-wo-sscanf'
Junio C Hamano [Mon, 27 Feb 2023 18:08:57 +0000 (10:08 -0800)] 
Merge branch 'jk/shorten-unambiguous-ref-wo-sscanf'

sscanf(3) used in "git symbolic-ref --short" implementation found
to be not working reliably on macOS in UTF-8 locales.  Rewrite the
code to avoid sscanf() altogether to work it around.

* jk/shorten-unambiguous-ref-wo-sscanf:
  shorten_unambiguous_ref(): avoid sscanf()
  shorten_unambiguous_ref(): use NUM_REV_PARSE_RULES constant
  shorten_unambiguous_ref(): avoid integer truncation

15 months agoMerge branch 'mh/credential-password-expiry'
Junio C Hamano [Mon, 27 Feb 2023 18:08:57 +0000 (10:08 -0800)] 
Merge branch 'mh/credential-password-expiry'

The credential subsystem learned that a password may have an
explicit expiration.

* mh/credential-password-expiry:
  credential: new attribute password_expiry_utc

15 months agoMerge branch 'rs/archive-mtime'
Junio C Hamano [Mon, 27 Feb 2023 18:08:57 +0000 (10:08 -0800)] 
Merge branch 'rs/archive-mtime'

"git archive HEAD^{tree}" records the paths with the current
timestamp in the archive, making it harder to obtain a stable
output.  The command learned the --mtime option to specify an
arbitrary timestamp (e.g. --mtime="@0 +0000" for the epoch).

* rs/archive-mtime:
  archive: add --mtime

15 months agoMerge branch 'tb/drop-dir-iterator-follow-symlink-bit'
Junio C Hamano [Mon, 27 Feb 2023 18:08:57 +0000 (10:08 -0800)] 
Merge branch 'tb/drop-dir-iterator-follow-symlink-bit'

Remove leftover and unused code.

* tb/drop-dir-iterator-follow-symlink-bit:
  t0066: drop setup of "dir5"
  dir-iterator: drop unused `DIR_ITERATOR_FOLLOW_SYMLINKS`

15 months agoMerge branch 'tl/range-diff-custom-abbrev'
Junio C Hamano [Mon, 27 Feb 2023 18:08:56 +0000 (10:08 -0800)] 
Merge branch 'tl/range-diff-custom-abbrev'

"git range-diff" learned --abbrev=<num> option.

* tl/range-diff-custom-abbrev:
  range-diff: let '--abbrev' option takes effect

15 months agoMerge branch 'ap/t2015-style-update'
Junio C Hamano [Mon, 27 Feb 2023 18:08:56 +0000 (10:08 -0800)] 
Merge branch 'ap/t2015-style-update'

Test clean-up.

* ap/t2015-style-update:
  t2015-checkout-unborn.sh: changes the style for cd

15 months agoMerge branch 'jc/diff-algo-attribute'
Junio C Hamano [Mon, 27 Feb 2023 18:08:56 +0000 (10:08 -0800)] 
Merge branch 'jc/diff-algo-attribute'

The "diff" drivers specified by the "diff" attribute attached to
paths can now specify which algorithm (e.g. histogram) to use.

* jc/diff-algo-attribute:
  diff: teach diff to read algorithm from diff driver
  diff: consolidate diff algorithm option parsing

15 months agoMerge branch 'pw/rebase-i-validate-labels-early'
Junio C Hamano [Mon, 27 Feb 2023 18:08:56 +0000 (10:08 -0800)] 
Merge branch 'pw/rebase-i-validate-labels-early'

An invalid label or ref in the "rebase -i" todo file used to
trigger an runtime error. SUch an error is now diagnosed while the
todo file is parsed.

* pw/rebase-i-validate-labels-early:
  rebase -i: check labels and refs when parsing todo list

15 months agorestore: fault --staged --worktree with merge opts
Andy Koppe [Sun, 26 Feb 2023 18:43:54 +0000 (18:43 +0000)] 
restore: fault --staged --worktree with merge opts

The 'restore' command already rejects the --merge, --conflict, --ours
and --theirs options when combined with --staged, but accepts them when
--worktree is added as well.

Unfortunately that doesn't appear to do anything useful. The --ours and
--theirs options seem to be ignored when both --staged and --worktree
are given, whereas with --merge or --conflict, the command has the same
effect as if the --staged option wasn't present.

So reject those options with '--staged --worktree' as well, using
opts->accept_ref to distinguish restore from checkout.

Add test for both '--staged' and '--staged --worktree'.

Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agofetch: support hideRefs to speed up connectivity checks
Eric Wong [Sun, 12 Feb 2023 09:04:26 +0000 (09:04 +0000)] 
fetch: support hideRefs to speed up connectivity checks

With roughly 800 remotes all fetching into their own
refs/remotes/$REMOTE/* island, the connectivity check[1] gets
expensive for each fetch on systems which lack sufficient RAM to
cache objects.

To do a no-op fetch on one $REMOTE out of hundreds, hideRefs now
allows the no-op fetch to take ~30 seconds instead of ~20 minutes
on a noisy, RAM-constrained machine (localhost, so no network latency):

   git -c fetch.hideRefs=refs \
-c fetch.hideRefs='!refs/remotes/$REMOTE/' \
fetch $REMOTE

[1] `git rev-list --objects --stdin --not --all --quiet --alternate-refs'

Signed-off-by: Eric Wong <e@80x24.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
15 months agotest-lib: drop comment about test_description
Andrei Rybak [Sun, 26 Feb 2023 10:53:03 +0000 (11:53 +0100)] 
test-lib: drop comment about test_description

When a comment describing how each test file should start was added in
commit [1], it was the second comment of t/test-lib.sh.  The comment
describes how variable "test_description" is supposed to be assigned at
the top of each test file and how "test-lib.sh" should be used by
sourcing it.  However, even in [1], the comment was ten lines away from
the usage of the variable by test-lib.sh.  Since then, the comment has
drifted away both from the top of the file and from the usage of the
variable.  The comment just sits in the middle of the initialization of
the test library, surrounded by unrelated code, almost one hundred lines
away from the usage of "test_description".

Nobody has noticed this drift during evolution of test-lib.sh, which
suggests that this comment has outlived its usefulness.  The assignment
of "test_description", sourcing of "test-lib.sh" by tests, and the
process of writing tests in general are described in detail in
"t/README".  So drop the obsolete comment.

An alternative solution could be to move the comment either to the top
of the file, or down to the usage of variable "test_description".

[1] e1970ce43a ("[PATCH 1/2] Test framework take two.", 2005-05-13)

Signed-off-by: Andrei Rybak <rybak.a.v@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>