Commit graph

67177 commits

Author SHA1 Message Date
Derrick Stolee b9342b3fd6 refs: add array of ref namespaces
Git interprets different meanings to different refs based on their
names. Some meanings are cosmetic, like how refs in  'refs/remotes/*'
are colored differently from refs in 'refs/heads/*'. Others are more
critical, such as how replace refs are interpreted.

Before making behavior changes based on ref namespaces, collect all
known ref namespaces into a array of ref_namespace_info structs. This
array is indexed by the new ref_namespace enum for quick access.

As of this change, this array is purely documentation. Future changes
will add dependencies on this array.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-08-05 14:13:12 -07:00
Derrick Stolee 5797b13919 t4207: test coloring of grafted decorations
The color.decorate.<slot> config option added the 'grafted' slot in
09c4ba410b (log-tree: allow to customize 'grafted' color, 2018-05-26)
but included no tests for this behavior. When modifying some logic
around decorations, this ref namespace was ignored and could have been
lost as a default namespace for 'git log' decorations by default.

Add two tests to t4207 that check that the replaced objects are
correctly decorated. Use "black" as the color since it is distinct from
the other colors already in the test. The first test uses regular
replace-objects while the second creates a commit graft.

Be sure to test both modes with GIT_REPLACE_REF_BASE unset and set to an
alternative base.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-08-05 14:13:11 -07:00
Derrick Stolee b004521aa6 t4207: modernize test
Before adding new tests to t4207-log-decoration-colors.sh, update the
existing test to use modern test conventions. This includes:

1. Use lowercase in test names.

2. Keep all test setup inside the test_expect_success blocks. We need
   to be careful about left whitespace in the broken lines of the input
   file.

3. Do not use 'git' commands on the left side of a pipe.

4. Create a cmp_filtered_decorations helper to perform the 'log', 'sed',
   and test_decode_color manipulations. Move the '--all' option to be an
   argument so we can change that value in future tests.

5. Modify the 'sed' command to use a simpler form that is more
   portable.

The next change will introduce new tests usinge these new conventions.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-08-05 14:13:11 -07:00
Derrick Stolee b877e617e6 refs: allow "HEAD" as decoration filter
The normalize_glob_ref() method was introduced in 65516f586b (log:
add option to choose which refs to decorate, 2017-11-21) to help with
decoration filters such as --decorate-refs=<filter> and
--decorate-refs-exclude=<filter>. The method has not been used anywhere
else.

At the moment, it is impossible to specify HEAD as a decoration filter
since normalize_glob_ref() prepends "refs/" to the filter if it isn't
already there.

Allow adding HEAD as a decoration filter by allowing the exact string
"HEAD" to not be prepended with "refs/". Add a test in t4202-log.sh that
would previously fail since the HEAD decoration would exist in the
output.

It is sufficient to only cover "HEAD" here and not include other special
refs like REBASE_HEAD. This is because HEAD is the only ref outside of
refs/* that is added to the list of decorations. However, we may want to
special-case these other refs in normalize_glob_ref() in the future.
Leave a NEEDSWORK comment for now.

Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-08-05 14:13:11 -07:00
Junio C Hamano bbea4dcf42 Git 2.37.1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-04 13:45:08 -07:00
Junio C Hamano a631e99807 Merge 'js/add-i-delete' into maint-2.37
Rewrite of "git add -i" in C that appeared in Git 2.25 didn't
correctly record a removed file to the index, which is an old
regression but has become widely known because the C version
has become the default in the latest release.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-07-04 13:40:59 -07:00
Johannes Schindelin 4788e8b256 add --interactive: allow update to stage deleted files
The scripted version of `git add -i` used `git update-index --add
--remove`, but the built-in version implemented only the `--add` part.

This fixes https://github.com/msys2/MSYS2-packages/issues/3066

Reported-by: Christoph Reiter <reiter.christoph@gmail.com>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-28 15:37:50 -07:00
Junio C Hamano 69ab3309e9 Sync with Git 2.36.2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-27 12:41:41 -07:00
Junio C Hamano e4a4b31577 Git 2.37
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-27 09:17:55 -07:00
Junio C Hamano 49c837424a Merge branch 'jc/revert-show-parent-info'
* jc/revert-show-parent-info:
  revert: config documentation fixes
2022-06-27 09:13:41 -07:00
Junio C Hamano 5dba4d6540 l10n-2.37.0-rnd1
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE37vMEzKDqYvVxs51k24VDd1FMtUFAmK4VO0ACgkQk24VDd1F
 MtUgRw/+MID68Dy6ai1WGQh+tFl03UN4zF7B8fyPwDSBQSmwXPr+e+FEvMPvJhqc
 ES9o+W3YvbS/kQrG8c4bXKgyD76VtL2C6Xc5cs/Ga+m4Rzeq3rVvAhqNfP879jXc
 udiLaXHGpRlkgqnoBa3rVGSFoIPa/mXSJwDEEDJYyo/34eTqpk7wapqznXy/SSKk
 qe8HeP7/4m/xemNcKDkghoYZnxdVeKOahRMxt8rF8DMpaCIj/fgRf8cGnfBQ0qJY
 SuLRzes58tYep73gMANdjnzsPAN870OGcnLTuIHaObx1h5GGYxSLSK5iWu9+coyF
 iLaFbJYmBfz5K4P5bHXtey6ez3CpkQGBk/4rAFVgjt9hwgo8wvUU/V2GPeVTWNSx
 Lu6UFLozjDeHIADsdCd0N14pVhAcN5mGlZPlJmQ7MCZs7x6JEvsqx3ccqrtFIjDK
 ymyep0jHaj7iuEzPBpDM3g5vmhWnJKi17BZwTx3Zoa9yoBkXJh/ENKRcHP4kQD+f
 0YXX2IZSSLfzz72RylDlZVdJNBpwPBgbBagnuq09S8vjNbq5StX2Pz7LsOkM74Sw
 6dH7gAQVGHKbg4FSQfUo9noP7EUGPlEY3khTMNyf11E3Fd69ehSAgvTAQfYv6Mcl
 XC7g+nlT4i7IFmUTtUdyWg6otiQfI+9iCMZi8jR6XtmIkm8bluA=
 =jRiL
 -----END PGP SIGNATURE-----

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

l10n-2.37.0-rnd1

* tag 'l10n-2.37.0-rnd1' of https://github.com/git-l10n/git-po:
  l10n: sv.po: Update Swedish translation (5367t0f0u)
  l10n: ru.po: update Russian translation
  l10n: zh_TW: v2.37.0 round 1
  l10n: vi(5367t): Updated translation
  l10n: fr v2.37 round 1
  l10n: Update Catalan translation
  l10n: po-id for 2.37 (first batch)
  l10n: tr: v2.37.0 round #1
  l10n: README: fix typo
  l10n: TEAMS: Change German translation team leader
  l10n: de.po: Update German translation
  l10n: bg.po: Updated Bulgarian translation (5367t)
  l10n: zh_CN: v2.37.0 round 1
  l10n: es: update translation
2022-06-27 08:39:10 -07:00
René Scharfe fc0f8bcd64 revert: config documentation fixes
43966ab315 (revert: optionally refer to commit in the "reference"
format, 2022-05-26) added the documentation file config/revert.txt.
Actually include it in config.txt.

Make is used with a bare infinitive after the object; remove the "to".

Signed-off-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-27 08:37:36 -07:00
Peter Krefting 71e3a31e40 l10n: sv.po: Update Swedish translation (5367t0f0u)
Run msgmerge with --no-location to drop file locations to decrease the
size of future patches. Also removed old translations.

Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2022-06-26 20:38:46 +08:00
Dimitriy Ryazantcev 11d4c8b350 l10n: ru.po: update Russian translation
Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2022-06-26 20:32:33 +08:00
Jiang Xin e7022fcdb5 Merge branch 'l10n/zh_TW/220623' of github.com:l10n-tw/git-po
* 'l10n/zh_TW/220623' of github.com:l10n-tw/git-po:
  l10n: zh_TW: v2.37.0 round 1
2022-06-26 13:54:26 +08:00
Yi-Jyun Pan c9d5deafe2
l10n: zh_TW: v2.37.0 round 1
Signed-off-by: Yi-Jyun Pan <pan93412@gmail.com>
2022-06-25 21:21:57 +08:00
Jiang Xin 0015f897e5 Merge branch 'master' of github.com:vnwildman/git
* 'master' of github.com:vnwildman/git:
  l10n: vi(5367t): Updated translation
2022-06-25 11:01:20 +08:00
Tran Ngoc Quan 84189f4d15 l10n: vi(5367t): Updated translation
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2022-06-25 08:40:42 +07:00
Jean-Noël Avila 305136b4ff l10n: fr v2.37 round 1
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2022-06-24 21:59:53 +02:00
Jordi Mas a54f9fb9f5 l10n: Update Catalan translation
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2022-06-24 13:30:45 +02:00
Junio C Hamano 39c15e4855 Merge branch 'ab/credentials-in-url-more'
* ab/credentials-in-url-more:
  Documentation/config/transfer.txt: fix typo
2022-06-23 13:22:35 -07:00
Taylor Blau bcb6cdfc03 Documentation/config/transfer.txt: fix typo
Commit 7281c196b1 (transfer doc: move fetch.credentialsInUrl to
"transfer" config namespace, 2022-06-15) propagates a typo from
6dcbdc0d66 (remote: create fetch.credentialsInUrl config, 2022-06-06),
where "other" is misspelled as "oher". Fix the typo accordingly.

Signed-off-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-23 12:43:29 -07:00
Jiang Xin 7d7192b91f Merge branch 'po-id' of github.com:bagasme/git-po
* 'po-id' of github.com:bagasme/git-po:
  l10n: po-id for 2.37 (first batch)
2022-06-23 21:01:47 +08:00
Johannes Schindelin fd59c5bdee Git 2.36.2
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-06-23 12:40:44 +02:00
Johannes Schindelin 8f8eea8c3a Sync with 2.35.4
* maint-2.35:
  Git 2.35.4
  Git 2.34.4
  Git 2.33.4
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
2022-06-23 12:36:12 +02:00
Johannes Schindelin 359da658ae Git 2.35.4
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-06-23 12:36:05 +02:00
Johannes Schindelin aef3d5948c Sync with 2.34.4
* maint-2.34:
  Git 2.34.4
  Git 2.33.4
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
2022-06-23 12:36:03 +02:00
Johannes Schindelin f2eed22852 Git 2.34.4
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-06-23 12:35:49 +02:00
Johannes Schindelin 378eaded1a Sync with 2.33.4
* maint-2.33:
  Git 2.33.4
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
2022-06-23 12:35:47 +02:00
Johannes Schindelin 80c525c4ac Git 2.33.4
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-06-23 12:35:41 +02:00
Johannes Schindelin eebfde3f21 Sync with 2.32.3
* maint-2.32:
  Git 2.32.3
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
2022-06-23 12:35:38 +02:00
Johannes Schindelin 656d9a24f6 Git 2.32.3
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-06-23 12:35:32 +02:00
Johannes Schindelin fc0c773028 Sync with 2.31.4
* maint-2.31:
  Git 2.31.4
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
2022-06-23 12:35:30 +02:00
Johannes Schindelin 5b1c746c35 Git 2.31.4
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-06-23 12:35:25 +02:00
Johannes Schindelin 2f8809f9a1 Sync with 2.30.5
* maint-2.30:
  Git 2.30.5
  setup: tighten ownership checks post CVE-2022-24765
  git-compat-util: allow root to access both SUDO_UID and root owned
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo
2022-06-23 12:35:23 +02:00
Johannes Schindelin 88b7be68a4 Git 2.30.5
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-06-23 12:31:05 +02:00
Carlo Marcelo Arenas Belón 3b0bf27049 setup: tighten ownership checks post CVE-2022-24765
8959555cee (setup_git_directory(): add an owner check for the top-level
directory, 2022-03-02), adds a function to check for ownership of
repositories using a directory that is representative of it, and ways to
add exempt a specific repository from said check if needed, but that
check didn't account for owership of the gitdir, or (when used) the
gitfile that points to that gitdir.

An attacker could create a git repository in a directory that they can
write into but that is owned by the victim to work around the fix that
was introduced with CVE-2022-24765 to potentially run code as the
victim.

An example that could result in privilege escalation to root in *NIX would
be to set a repository in a shared tmp directory by doing (for example):

  $ git -C /tmp init

To avoid that, extend the ensure_valid_ownership function to be able to
check for all three paths.

This will have the side effect of tripling the number of stat() calls
when a repository is detected, but the effect is expected to be likely
minimal, as it is done only once during the directory walk in which Git
looks for a repository.

Additionally make sure to resolve the gitfile (if one was used) to find
the relevant gitdir for checking.

While at it change the message printed on failure so it is clear we are
referring to the repository by its worktree (or gitdir if it is bare) and
not to a specific directory.

Helped-by: Junio C Hamano <junio@pobox.com>
Helped-by: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Signed-off-by: Carlo Marcelo Arenas Belón <carenas@gmail.com>
2022-06-23 12:31:05 +02:00
Junio C Hamano b779214eaf Merge branch 'cb/path-owner-check-with-sudo'
With a recent update to refuse access to repositories of other
people by default, "sudo make install" and "sudo git describe"
stopped working.  This series intends to loosen it while keeping
the safety.

* cb/path-owner-check-with-sudo:
  t0034: add negative tests and allow git init to mostly work under sudo
  git-compat-util: avoid failing dir ownership checks if running privileged
  t: regression git needs safe.directory when using sudo

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
2022-06-23 12:31:04 +02:00
Bagas Sanjaya c38261e7d9 l10n: po-id for 2.37 (first batch)
Update following components:

  - apply.c
  - builtin/bisect--helper.c
  - builtin/fetch.c
  - builtin/fsck.c
  - builtin/log.c
  - builtin/notes.c
  - builtin/push.c
  - builtin/submodule--helper.c
  - builtin/worktree.c
  - index-pack.c
  - init-db.c
  - remote.c

Translate following new components:

  - attr.c
  - builtin/name-rev.c
  - builtin/pack-objects.c
  - builtin/pack-refs.c
  - builtin/prune.c
  - builtin/update-server-info.c
  - object-file.c
  - object-name.c
  - object.c
  - pack-bitmap.c
  - pack-mtimes.c
  - pack-revindex.c
  - pack-write.c
  - packfile.c

Besides above, fix minor grammatical issues.

Signed-off-by: Bagas Sanjaya <bagasdotme@gmail.com>
2022-06-23 15:46:02 +07:00
Emir SARI 160071c38f l10n: tr: v2.37.0 round #1
Signed-off-by: Emir SARI <emir_sari@icloud.com>
2022-06-23 09:47:23 +03:00
Jiang Xin aa6bc5c581 Merge branch 'master' of github.com:ruester/git-po-de
* 'master' of github.com:ruester/git-po-de:
  l10n: TEAMS: Change German translation team leader
  l10n: de.po: Update German translation
2022-06-23 10:45:03 +08:00
Jiang Xin 241dd998bf Merge branch 'master' of github.com:alshopov/git-po
* 'master' of github.com:alshopov/git-po:
  l10n: bg.po: Updated Bulgarian translation (5367t)
2022-06-23 10:44:43 +08:00
Jiang Xin bf34edf48c 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.37.0 round 1
2022-06-23 10:44:30 +08:00
Arthur Milchior 1b51ae591e l10n: README: fix typo
This 10-year old typo was introduced at 75b182ae (Update l10n guide:
change the repository URL, etc, 2012-03-02). The word "l10" should be
"l10n".

Signed-off-by: Arthur Milchior <arthur@milchior.fr>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2022-06-23 10:43:17 +08:00
Matthias Rüster 0411e8aa31 l10n: TEAMS: Change German translation team leader
Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2022-06-22 19:19:14 +02:00
Matthias Rüster 13608fdcfb l10n: de.po: Update German translation
Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
2022-06-22 19:19:14 +02:00
Junio C Hamano f770e9f396 Git 2.37-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2022-06-22 09:07:56 -07:00
Junio C Hamano b9e4d89ca4 Merge branch 'tb/cruft-packs'
Docfix.

* tb/cruft-packs:
  gc: simplify --cruft description
2022-06-22 09:06:37 -07:00
Alexander Shopov 4ab814526e l10n: bg.po: Updated Bulgarian translation (5367t)
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2022-06-22 15:45:12 +02:00
Fangyi Zhou db2558009c
l10n: zh_CN: v2.37.0 round 1
Reviewed-by: Jiang Xin <worldhello.net@gmail.com>
Signed-off-by: Fangyi Zhou <me@fangyi.io>
2022-06-22 10:28:36 +01:00