Commit Graph

77950 Commits (v2.51.0-rc0)

Author SHA1 Message Date
Junio C Hamano 92daf08c84 Merge branch 'ly/submodule-update-failure-leakfix'
A memory leak on an error code path has been plugged.

* ly/submodule-update-failure-leakfix:
  builtin/submodule--helper: fix leak when remote_submodule_branch() failed
2025-06-18 13:53:36 -07:00
Junio C Hamano a6cdbc8f8a Merge branch 'jm/bundle-uri-debug-output-to-fp'
Code clean-up.

* jm/bundle-uri-debug-output-to-fp:
  bundle-uri: send debug output to given FILE * stream
2025-06-18 13:53:35 -07:00
Junio C Hamano aa6ab0323f Merge branch 'bs/solaris-10-and-11'
Add settings for Solaris 10 & 11.

* bs/solaris-10-and-11:
  config.mak.uname: update settings for Solaris 10 and 11
2025-06-18 13:53:35 -07:00
Junio C Hamano 19612d0e46 Merge branch 'jw/doc-txt-to-adoc-refs'
Some leftover references to documentation source files that no
longer exist, due to recent ".txt" -> ".adoc" renaming, have been
corrected.

* jw/doc-txt-to-adoc-refs:
  doc: update references to renamed AsciiDoc files
2025-06-18 13:53:35 -07:00
Junio C Hamano 617318cbce Merge branch 'ma/doc-diff-cc-headers'
Doc mark-up update.

* ma/doc-diff-cc-headers:
  diff-generate-patch.adoc: drop spurious backticks
2025-06-18 13:53:34 -07:00
Junio C Hamano f1af195690 Merge branch 'ly/pack-bitmap-root-leakfix'
Memleak fix on an error code path.

* ly/pack-bitmap-root-leakfix:
  pack-bitmap: remove checks before bitmap_free
2025-06-18 13:53:34 -07:00
Junio C Hamano 0d0d56bca4 Merge branch 'ly/commit-buffer-reencode-leakfix'
Leakfix.

* ly/commit-buffer-reencode-leakfix:
  repo_logmsg_reencode: fix memory leak when use repo_logmsg_reencode ()
2025-06-18 13:53:34 -07:00
Junio C Hamano f1a1d79fcf Merge branch 'cf/guideline-documenting-config-vars'
CodingGuidelines update.

* cf/guideline-documenting-config-vars:
  CodingGuidelines: document formatting of similar config variables.
2025-06-18 13:53:33 -07:00
Collin Funk ff67eea529 CodingGuidelines: document formatting of similar config variables.
Document that related `git config` variables should be placed
one-per-line instead of separated by commas.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-18 13:48:11 -07:00
Junio C Hamano d094e05ea5 diff-no-index: do not reference .d_type member of struct dirent
Some platforms like AIX lack .d_type member in "struct dirent"; use
the DTYPE(e) macro instead of a direct reference to e->d_type and
when it yields DT_UNKNOWN, find the real type with get_dtype().

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-18 13:05:29 -07:00
Junio C Hamano f9aa0eedb3 Start 2.51 cycle, the first batch
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-17 10:44:42 -07:00
Junio C Hamano b1dc2e796e Merge branch 'ps/meson-tap-parse'
Meson-based build/test framework now understands TAP output
generated by our tests.

* ps/meson-tap-parse:
  meson: parse TAP output generated by our tests
  meson: introduce kwargs variable for tests
  test-lib: fail on unexpectedly passing tests
  t7815: fix unexpectedly passing test on macOS
  t/test-lib: fix TAP format for BASH_XTRACEFD warning
  t/test-lib: don't print shell traces to stdout
  t983*: use prereq to check for Python-specific git-p4(1) support
  t9822: use prereq to check for ISO-8859-1 support
  t: silence output from `test_create_repo()`
  t: stop announcing prereqs
2025-06-17 10:44:42 -07:00
Junio C Hamano 2024ab3d97 Merge branch 'jk/diff-no-index-with-pathspec'
"git diff --no-index dirA dirB" can limit the comparison with
pathspec at the end of the command line, just like normal "git
diff".

* jk/diff-no-index-with-pathspec:
  diff --no-index: support limiting by pathspec
  pathspec: add flag to indicate operation without repository
  pathspec: add match_leading_pathspec variant
2025-06-17 10:44:42 -07:00
Junio C Hamano 5e22d03832 Merge branch 'ly/fetch-pack-leakfix'
A memory-leak in an error code path has been plugged.

* ly/fetch-pack-leakfix:
  builtin/fetch-pack: cleanup before return error
2025-06-17 10:44:41 -07:00
Junio C Hamano b5a135b1f7 Merge branch 'ly/commit-graph-graph-write-leakfix'
A memory-leak in an error code path has been plugged.

* ly/commit-graph-graph-write-leakfix:
  commit-graph: fix start_delayed_progress() leak
2025-06-17 10:44:41 -07:00
Junio C Hamano 1f622bb0ab Merge branch 'ly/do-not-localize-bug-messages'
Code clean-up.

* ly/do-not-localize-bug-messages:
  BUG(): remove leading underscore of the format string
2025-06-17 10:44:40 -07:00
Junio C Hamano 870a0421c4 Merge branch 'ly/sequencer-update-squash-is-fixup-only'
Code clean-up.

* ly/sequencer-update-squash-is-fixup-only:
  sequencer: replace error() with BUG() in update_squash_messages ()
2025-06-17 10:44:40 -07:00
Junio C Hamano 4fd5b1ddc7 Merge branch 'vd/cat-file-objectmode-update'
"git cat-file --batch" learns to understand %(objectmode) atom to
allow the caller to tell missing objects (due to repository
corruption) and submodules (whose commit objects are OK to be
missing) apart.

* vd/cat-file-objectmode-update:
  cat-file.c: add batch handling for submodules
  cat-file: add %(objectmode) atom
  t1006: update 'run_tests' to test generic object specifiers
2025-06-17 10:44:39 -07:00
Junio C Hamano 5b124e7c16 Merge branch 'ag/send-email-docs'
Documentation for "git send-email" has been updated with a bit more
credential helper and OAuth information.

* ag/send-email-docs:
  docs: make the purpose of using app password for Gmail more clear in send-email
  docs: remove credential helper links for emails from gitcredentials
  docs: improve formatting in git-send-email documentation
  docs: add credential helper for yahoo and link Google's sendgmail tool
2025-06-17 10:44:39 -07:00
Junio C Hamano 01148cafa4 Merge branch 'rc/userdiff-r'
Userdiff patterns for the R language.

* rc/userdiff-r:
  userdiff: add support for R programming language
2025-06-17 10:44:39 -07:00
Junio C Hamano 88134a8417 Merge branch 'ds/path-walk-2'
"git pack-objects" learns to find delta bases from blobs at the
same path, using the --path-walk API.

* ds/path-walk-2:
  pack-objects: allow --shallow and --path-walk
  path-walk: add new 'edge_aggressive' option
  pack-objects: thread the path-based compression
  pack-objects: refactor path-walk delta phase
  scalar: enable path-walk during push via config
  pack-objects: enable --path-walk via config
  repack: add --path-walk option
  t5538: add tests to confirm deltas in shallow pushes
  pack-objects: introduce GIT_TEST_PACK_PATH_WALK
  p5313: add performance tests for --path-walk
  pack-objects: update usage to match docs
  pack-objects: add --path-walk option
  pack-objects: extract should_attempt_deltas()
2025-06-17 10:44:38 -07:00
Junio C Hamano 60f9bc3e30 Merge branch 'lo/my-first-ow-doc-update'
Doc update to the more recent world order.

* lo/my-first-ow-doc-update:
  MyFirstContribution: add walken.c to meson.build
  MyFirstContribution: use struct repository in examples
2025-06-17 10:44:38 -07:00
Rodrigo Michelassi 855cfc65ae t2400: replace 'test -[efd]' with 'test_path_is_*'
'test_path_is_file', 'test_path_is_dir' and 'test_file_is_missing'
are test helpers used in Git's development, that emit useful
diagnostic information when they detect a failing condition, while
test -[efd] does not.

Replace the basic shell commands 'test -f', 'test -d' and 'test -e',
with these test helpers.

Co-authored-by: Isabella Caselli <icaselli@usp.br>
Signed-off-by: Isabella Caselli <icaselli@usp.br>
Signed-off-by: Rodrigo Michelassi <rodmichelassi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-16 21:49:05 -07:00
Lidong Yan 2939494284 git.c: remove the_repository dependence in run_builtin()
run_builtin() takes a repo parameter, so the use of the_repository
is no longer necessary. Removed the usage of the_repository.

Signed-off-by: Lidong Yan <502024330056@smail.nju.edu.cn>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-16 08:17:12 -07:00
Junio C Hamano d82adb61ba Git 2.50.1 2025-06-15 21:57:08 -07:00
Junio C Hamano e1775c0646 Sync with 2.49.1 2025-06-15 21:54:23 -07:00
Junio C Hamano 16bd9f20a4 Git 2.50
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-15 21:17:21 -07:00
Jinyao Guo ff73f375bb mailinfo.c: fix memory leak in function handle_content_type()
The function handle_content_type allocates memory for boundary
using xmalloc(sizeof(struct strbuf)). If (++mi->content_top >=
&mi->content[MAX_BOUNDARIES]) is true, the function returns
without freeing boundary.

Signed-off-by: Jinyao Guo <guo846@purdue.edu>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-14 09:42:14 -07:00
Junio C Hamano f1ca98f609 Hopefully final bits before 2.50
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-13 13:29:15 -07:00
Junio C Hamano 7bd3e5397d Merge branch 'js/github-ci-win-coverity-fix'
Fixes for GitHub Actions Coverity job.

* js/github-ci-win-coverity-fix:
  ci(coverity): output the build log upon error
  ci(coverity): fix building on Windows
2025-06-13 13:29:15 -07:00
Junio C Hamano e1f335f3d4 Merge branch 'ss/revert-builtin-bswap-stuff'
Revert a botched bswap.h change that broke ntohll() functions on
big-endian systems with __builtin_bswap32/64().

* ss/revert-builtin-bswap-stuff:
  Revert "bswap.h: add support for built-in bswap functions"
2025-06-13 13:29:14 -07:00
Junio C Hamano f2a6a1e596 Merge branch 'jc/sed-build-fixes'
Build fix.

* jc/sed-build-fixes:
  build: sed portability fixes
2025-06-13 13:29:14 -07:00
Junio C Hamano c8b4805897 merge/pull: extend merge.stat configuration variable to cover --compact-summary
Existing `merge.stat` configuration variable is a Boolean that
defaults to `true` to control `git merge --[no-]stat` behaviour.

Extend it to be "Boolean or text", that takes false, true, or
"compact", with the last one triggering the --compact-summary option
introduced earlier.  Any other values are taken as the same as true,
instead of signaling an error---it is not a grave enough offence to
stop their merge.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-13 11:54:14 -07:00
Junio C Hamano 3a54f5bd5d merge/pull: add the "--compact-summary" option
"git merge" and "git pull" shows "git diff --stat --summary @{1}"
when they finish to indicate the extent of the changes brought into
the history by default.  While it gives a good overview, it becomes
annoying when there are very many created or deleted paths.

Introduce "--compact-summary" option to these two commands that
tells it to instead show "git diff --compact-summary @{1}", which
gives the same information in a lot more compact form in such a
situation.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-13 11:50:37 -07:00
Siddharth Asthana abf94a283f cat-file: fix mailmap application for different author and committer
The git cat-file command with --mailmap option fails to apply mailmap
transformations to the committer field when the author and committer
identities are different. This occurs due to a missing newline handling
in apply_mailmap_to_header() after processing each identity line.

When rewrite_ident_line() processes an identity, it stops at the end
of the identity data (e.g., "Author Name <email> timestamp"), but
doesn't account for the trailing newline. The current code adds the
identity length to buf_offset but fails to advance past the newline
character. This causes the next iteration to start parsing from the
newline instead of the beginning of the next header line, making it
impossible to match subsequent headers like "committer".

Additionally, rewrite_ident_line() may reallocate the buffer during
its operation. Any code using pointers into the old buffer would be
using invalid memory after such a reallocation.

This bug was introduced in e9c1b0e3 (revision: improve
commit_rewrite_person(), 2022-07-19) when the much simpler version of
commit_rewrite_person() that worked on one "person header" at a time
was rewritten to use the current apply_mailmap_to_header() function.
The original implementation processed author and committer separately,
but the rewrite introduced this loop-based approach that failed to
properly handle the transition between identity lines.

Let's fix this by addressing both issues:
1. After processing an identity line, we now check if we're at a
   newline and advance past it, ensuring the next header line is
   parsed correctly.
2. We recompute the buffer position after rewrite_ident_line() to
   handle potential buffer reallocation.

This ensures that all identity headers in commit and tag objects are
consistently processed regardless of whether the author and committer
are the same person.

Reported-by: Vasilii Iakliushin <viakliushin@gitlab.com>
Reviewed-by: Christian Couder <christian.couder@gmail.com>
Signed-off-by: Siddharth Asthana <siddharthasthana31@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-13 08:54:51 -07:00
Junio C Hamano aadf8ae518 Git 2.49.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-13 07:51:58 -07:00
Junio C Hamano b2bfd317a3 l10n-2.50.0-v2
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE37vMEzKDqYvVxs51k24VDd1FMtUFAmhLZYwACgkQk24VDd1F
 MtUa3xAAuet6WgbUVN16q49Bd+WcK6uWooHlcpUMXANkJGqrjMquGfOCTc6bYXYi
 9JE87YUKxz5gIVP3YgEkJyLRiXuV0uUEfoGuXharQNDzMRfTNuhDmzV5drg7wWSJ
 CM0ErbD1jyHoPcuiusdhBCGAivV1k4WqofZ4OfhCUdapfpD1BnVXzNb6G6g6TemN
 WR5fiiQ2Ks0b8ZdfuXyBddqC44FOHwp4G1qgXBLoOq15matrNntb8y1ihualzTvp
 3M1LHNvh6HHwiD8lGcQiv/9Fjqbx6ypkUuxERiG90a53InKb5iYXA84MeYNbWm92
 rSpEpQOn3pq5ooweBLQWQUFOf/QFzFck6BtwHBdpH74FAkjXvjYs9aBPpH3PNUGW
 aXCTWZsvt2hEaYLMu3w54nrapnKUJMJrDRZn51+s88bk7s2fqY8yhfPduHh+fwu/
 4eVPQ9QgXiMS3sOTkU0tbV5qjw6LZFj9eb3Hg4MPQkwTQfe9x5mOOJC8IUOhwkuI
 bpb/V+PVYOcE4yv67qI51LeFkHt1ozWtxvXNJk3vEjcLSLDm3eBQTHo5t9wlpzsX
 pI3A985Fvzm7CQSr/0XPPGBLR1qnGjWXmOGe4v+N4VETnlPgqlv4nGEiLCFf+c8h
 4zwb/QaoTf7FLVKycEkBuiDohzGkuMUU1CICTTcPOJ7blwbGHjM=
 =2qMi
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.50.0-v2' of https://github.com/git-l10n/git-po

l10n-2.50.0-v2

* tag 'l10n-2.50.0-v2' of https://github.com/git-l10n/git-po:
  l10n: zh_TW: update translation for Git 2.50
2025-06-12 17:31:42 -07:00
Junio C Hamano a97f313784 Sync with 2.48.2
* maint-2.48:
  Git 2.48.2
  Git 2.47.3
  Git 2.46.4
  Git 2.45.4
  Git 2.44.4
  Git 2.43.7
  wincred: avoid buffer overflow in wcsncat()
  bundle-uri: fix arbitrary file writes via parameter injection
  config: quote values containing CR character
  git-gui: sanitize 'exec' arguments: convert new 'cygpath' calls
  git-gui: do not mistake command arguments as redirection operators
  git-gui: introduce function git_redir for git calls with redirections
  git-gui: pass redirections as separate argument to git_read
  git-gui: pass redirections as separate argument to _open_stdout_stderr
  git-gui: convert git_read*, git_write to be non-variadic
  git-gui: override exec and open only on Windows
  gitk: sanitize 'open' arguments: revisit recently updated 'open' calls
  git-gui: use git_read in githook_read
  git-gui: sanitize $PATH on all platforms
  git-gui: break out a separate function git_read_nice
  git-gui: assure PATH has only absolute elements.
  git-gui: remove option --stderr from git_read
  git-gui: cleanup git-bash menu item
  git-gui: sanitize 'exec' arguments: background
  git-gui: avoid auto_execok in do_windows_shortcut
  git-gui: sanitize 'exec' arguments: simple cases
  git-gui: avoid auto_execok for git-bash menu item
  git-gui: treat file names beginning with "|" as relative paths
  git-gui: remove unused proc is_shellscript
  git-gui: remove git config --list handling for git < 1.5.3
  git-gui: remove special treatment of Windows from open_cmd_pipe
  git-gui: remove HEAD detachment implementation for git < 1.5.3
  git-gui: use only the configured shell
  git-gui: remove Tcl 8.4 workaround on 2>@1 redirection
  git-gui: make _shellpath usable on startup
  git-gui: use [is_Windows], not bad _shellpath
  git-gui: _which, only add .exe suffix if not present
  gitk: encode arguments correctly with "open"
  gitk: sanitize 'open' arguments: command pipeline
  gitk: collect construction of blameargs into a single conditional
  gitk: sanitize 'open' arguments: simple commands, readable and writable
  gitk: sanitize 'open' arguments: simple commands with redirections
  gitk: sanitize 'open' arguments: simple commands
  gitk: sanitize 'exec' arguments: redirect to process
  gitk: sanitize 'exec' arguments: redirections and background
  gitk: sanitize 'exec' arguments: redirections
  gitk: sanitize 'exec' arguments: 'eval exec'
  gitk: sanitize 'exec' arguments: simple cases
  gitk: have callers of diffcmd supply pipe symbol when necessary
  gitk: treat file names beginning with "|" as relative paths

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-12 17:13:35 -07:00
Junio C Hamano 9edff09aec Merge branch 'kh/maintenance-missing-tasks-docfix'
Doc mark-up fix for a topic that has graduated to 'master'.

* kh/maintenance-missing-tasks-docfix:
  doc: maintenance: fix linkgit syntax
2025-06-12 14:19:10 -07:00
Junio C Hamano 5acfacc2a1 build: sed portability fixes
Recently generating the version-def.h file and the config-list.h
file have been updated, which broke versions of "sed" that do not
want to be fed a file that ends with an incomplete line, and/or that
do not understand the more recent "-E" option to use extended
regular expression.

Fix them in response to a build-failure reported on Solaris boxes.

cf. https://lore.kernel.org/git/09f954b8-d9c3-418f-ad4b-9cb9b063f4ae@comstyle.com/

Reported-by: Brad Smith <brad@comstyle.com>
Reviewed-by: Collin Funk <collin.funk1@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-12 13:44:10 -07:00
Junio C Hamano 9b662a5d21 l10n-2.50.0-rnd1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE37vMEzKDqYvVxs51k24VDd1FMtUFAmhK28EACgkQk24VDd1F
 MtU1GA/8CmvPedvJVqnaikUJTKRxrlyiqKkI8fAKqvqulubD36yI7QjDP4PhDKHA
 hK0uvJ16n4v4xp2aIATnD4E3AH3ocrjU5xzK1pqd26cYWdObKZeDpio/FQrEcJI2
 uPp+BHRnOVwg32gMHOEhry8rGtFlsZyCtoRSLPVPAN6Oy+NI4MfqJcN+FCtyWg5p
 oSTSwwbCXwUiuFXBjFgsCzq8Of/WRYr5cSfq/XCjz+0Gk57aLaVjnsVExxO6VwwB
 F5cdqbwuwbR7eGr3WJSGerNTfs4qKbVqbsxNDMLllI5OW/Kzm07nOdxNe4daoSbj
 9+DsNuOAe5mOdi09wx09B3QAMFiHOD8gJcTT4RbRXV+Fi3OZg782jIEzGKFmqccF
 7g7m74qsjk5GlswSXI8/l1l1mSPhBk4s6fcUkgF4aqO3F2QMIlCorEz5KE1J9H9R
 Xu+sMm46jLdCeVuz5obirE9XKOpdTlH1FQk02guskJgvCrXrmtzIBX6eYIUxewCO
 jyE4MYrVeY0PnIIMHMDJ1L+mg0hs6zyPjXiU7BQWHyYgLOQTp7q71slIYarpkj9o
 Md23cJwBhJV/lUqwuLCu6SwMBZlinYEN6QunRDbzl2oMBJjwz9VmrXbLzfqXujz4
 +ycA+efgGCN3JBU7qrvBME+jkT8dxn+4zoPFzwjfaXK2W9xXwbM=
 =O2DU
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.50.0-rnd1' of https://github.com/git-l10n/git-po

l10n-2.50.0-rnd1

* tag 'l10n-2.50.0-rnd1' of https://github.com/git-l10n/git-po:
  l10n: zh_CN: updated translation for 2.50
  l10n: Update German translation
  l10n: uk: add 2.50 translation
  l10n: po-id for 2.50
  l10n: bg.po: Updated Bulgarian translation (5819t)
  l10n: tr: Update Turkish translations for 2.50
  l10n: fr: v2.50 round 1
  l10n: Add full Irish translation (ga.po)
2025-06-12 13:35:08 -07:00
brian m. carlson bc303718cc builtin/stash: provide a way to import stashes from a ref
Now that we have a way to export stashes to a ref, let's provide a way
to import them from such a ref back to the stash.  This works much the
way the export code does, except that we strip off the first parent
chain commit and then store each resulting commit back to the stash.

We don't clear the stash first and instead add the specified stashes to
the top of the stash.  This is because users may want to export just a
few stashes, such as to share a small amount of work in progress with a
colleague, and it would be undesirable for the receiving user to lose
all of their data.  For users who do want to replace the stash, it's
easy to do to: simply run "git stash clear" first.

We specifically rely on the fact that we'll produce identical stash
commits on both sides in our tests.  This provides a cheap,
straightforward check for our tests and also makes it easy for users to
see if they already have the same data in both repositories.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-12 13:32:18 -07:00
brian m. carlson 27c0be9a3f builtin/stash: provide a way to export stashes to a ref
A common user problem is how to sync in-progress work to another
machine.  Users currently must use some sort of transfer of the working
tree, which poses security risks and also necessarily causes the index
to become dirty.  The experience is suboptimal and frustrating for
users.

A reasonable idea is to use the stash for this purpose, but the stash is
stored in the reflog, not in a ref, and as such it cannot be pushed or
pulled.  This also means that it cannot be saved into a bundle or
preserved elsewhere, which is a problem when using throwaway development
environments.

In addition, users often want to replicate stashes across machines, such
as when they must use multiple machines or when they use throwaway dev
environments, such as those based on the Devcontainer spec, where they
might otherwise lose various in-progress work.

Let's solve this problem by allowing the user to export the stash to a
ref (or, to just write it into the repository and print the hash, à la
git commit-tree).  Introduce git stash export, which writes a chain of
commits where the first parent is always a chain to the previous stash,
or to a single, empty commit (for the final item) and the second is the
stash commit normally written to the reflog.

Iterate over each stash from top to bottom, looking up the data for each
one, and then create the chain from the single empty commit back up in
reverse order.  Generate a predictable empty commit so our behavior is
reproducible.  Create a useful commit message, preserving the author and
committer information, to help users identify stash commits when viewing
them as normal commits.

If the user has specified specific stashes they'd like to export
instead, use those instead of iterating over all of the stashes.

As part of this, specifically request quiet behavior when looking up the
OID for a revision because we will eventually hit a revision that
doesn't exist and we don't want to die when that occurs.

When exporting stashes, be sure to verify that they look like valid
stashes and don't contain invalid data.  This will help avoid failures
on import or problems due to attempting to export invalid refs that are
not stashes.

Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk>
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-12 13:32:17 -07:00
brian m. carlson 7572e59b3d builtin/stash: factor out revision parsing into a function
We allow several special forms of stash names in this code.  In the
future, we'll want to allow these same forms without parsing a stash
commit, so let's refactor this code out into a function for reuse.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-12 13:32:17 -07:00
brian m. carlson 393bbb21c9 object-name: make get_oid quietly return an error
A reasonable person looking at the signature and usage of get_oid and
friends might conclude that in the event of an error, it always returns
-1.  However, this is not the case.  Instead, get_oid_basic dies if we
go too far back into the history of a reflog (or, when quiet, simply
exits).

This is not especially useful, since in many cases, we might want to
handle this error differently.  Let's add a flag here to make it just
return -1 like elsewhere in these code paths.

Note that we cannot make this behavior the default, since we have many
other codepaths that rely on the existing behavior, including in tests.

Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-12 13:32:17 -07:00
Junio C Hamano 1944e0717f Merge branch 'ss/revert-builtin-bswap-stuff' into ss/compat-bswap-revamp
* ss/revert-builtin-bswap-stuff:
  Revert "bswap.h: add support for built-in bswap functions"
2025-06-12 13:31:22 -07:00
Sebastian Andrzej Siewior 1c62df0abe Revert "bswap.h: add support for built-in bswap functions"
Since 6547d1c9 (bswap.h: add support for built-in bswap
functions, 2025-04-23) tweaked the way the bswap32/64 macros are
defined, on platforms with __builtin_bswap32/64 supported, the
bswap32/64 macros are defined even on big endian platforms.

However the rest of this file assumes that bswap32/64() are defined
ONLY on little endian machines and uses that assumption to redefine
ntohl/ntohll macros. The said commit broke t4014-format-patch.sh test,
among many others on s390x.

Revert the commit.

Signed-off-by: Sebastian Andrzej Siewior <sebastian@breakpoint.cc>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2025-06-12 13:23:39 -07:00
Yi-Jyun Pan cbf346a996
l10n: zh_TW: update translation for Git 2.50
Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
2025-06-12 22:29:32 +08:00
Teng Long 925035958b l10n: zh_CN: updated translation for 2.50
Helped-by: 依云 <lilydjwg@gmail.com>
Helped-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Teng Long <dyroneteng@gmail.com>
2025-06-12 21:47:46 +08:00
Jiang Xin 36cbedb7cf Merge branch '2.50-uk-update' of https://github.com/arkid15r/git-ukrainian-l10n
* '2.50-uk-update' of https://github.com/arkid15r/git-ukrainian-l10n:
  l10n: uk: add 2.50 translation
2025-06-12 09:53:04 +08:00