1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-22 10:56:10 +02:00
Commit Graph

61481 Commits

Author SHA1 Message Date
Ævar Arnfjörð Bjarmason 2708ce62d2 branch: sort detached HEAD based on a flag
Change the ref-filter sorting of detached HEAD to check the
FILTER_REFS_DETACHED_HEAD flag, instead of relying on the ref
description filled-in by get_head_description() to start with "(",
which in turn we expect to ASCII-sort before any other reference.

For context, we'd like the detached line to appear first at the start
of "git branch -l", e.g.:

    $ git branch -l
    * (HEAD detached at <hash>)
      master

This doesn't change that, but improves on a fix made in
28438e84e0 (ref-filter: sort detached HEAD lines firstly, 2019-06-18)
and gives the Chinese translation the ability to use its preferred
punctuation marks again.

In Chinese the fullwidth versions of punctuation like "()" are
typically written as (U+FF08 fullwidth left parenthesis), (U+FF09
fullwidth right parenthesis) instead[1]. This form is used in both
po/zh_{CN,TW}.po in most cases where "()" is translated in a string.

Aside from that improvement to the Chinese translation, it also just
makes for cleaner code that we mark any special cases in the ref_array
we're sorting with flags and make the sort function aware of them,
instead of piggy-backing on the general-case of strcmp() doing the
right thing.

As seen in the amended tests this made reverse sorting a bit more
consistent. Before this we'd sometimes sort this message in the
middle, now it's consistently at the beginning or end, depending on
whether we're doing a normal or reverse sort. Having it at the end
doesn't make much sense either, but at least it behaves consistently
now. A follow-up commit will make this behavior under reverse sorting
even better.

I'm removing the "TRANSLATORS" comments that were in the old code
while I'm at it. Those were added in d4919bb288 (ref-filter: move
get_head_description() from branch.c, 2017-01-10). I think it's
obvious from context, string and translation memory in typical
translation tools that these are the same or similar string.

1. https://en.wikipedia.org/wiki/Chinese_punctuation#Marks_similar_to_European_punctuation

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-07 15:13:21 -08:00
Ævar Arnfjörð Bjarmason 7c269a7b16 ref-filter: move ref_sorting flags to a bitfield
Change the reverse/ignore_case/version sort flags in the ref_sorting
struct into a bitfield. Having three of them was already a bit
unwieldy, but it would be even more so if another flag needed a
function like ref_sorting_icase_all() introduced in
76f9e569ad (ref-filter: apply --ignore-case to all sorting keys,
2020-05-03).

A follow-up change will introduce such a flag, so let's move this over
to a bitfield. Instead of using the usual '#define' pattern I'm using
the "enum" pattern from builtin/rebase.c's b4c8eb024a (builtin
rebase: support --quiet, 2018-09-04).

Perhaps there's a more idiomatic way of doing the "for each in list
amend mask" pattern than this "mask/on" variable combo. This function
doesn't allow us to e.g. do any arbitrary changes to the bitfield for
multiple flags, but I think in this case that's fine. The common case
is that we're calling this with a list of one.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-07 15:13:21 -08:00
Ævar Arnfjörð Bjarmason d0947483a3 ref-filter: move "cmp_fn" assignment into "else if" arm
Further amend code changed in 7c5045fc18 (ref-filter: apply fallback
refname sort only after all user sorts, 2020-05-03) to move an
assignment only used in the "else if" arm to happen there. Before that
commit the cmp_fn would be used outside of it.

We could also just skip the "cmp_fn" assignment and use
strcasecmp/strcmp directly in a ternary statement here, but this is
probably more readable.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-07 15:13:21 -08:00
Ævar Arnfjörð Bjarmason 75c50e599c ref-filter: add braces to if/else if/else chain
Per the CodingGuidelines add braces to an if/else if/else chain where
only the "else" had braces. This is in preparation for a subsequent
change where the "else if" will have lines added to it.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-07 15:13:21 -08:00
Ævar Arnfjörð Bjarmason 08bf6a8bc3 branch tests: add to --sort tests
Further stress the --sort callback in ref-filter.c. The implementation
uses certain short-circuiting logic, let's make sure it behaves the
same way on e.g. name & version sort. Improves a test added in
aedcb7dc75 (branch.c: use 'ref-filter' APIs, 2015-09-23).

I don't think all of this output makes sense, but let's test for the
behavior as-is, we can fix bugs in it in a later commit.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-06 15:16:56 -08:00
Ævar Arnfjörð Bjarmason ffdd02a55d branch: change "--local" to "--list" in comment
There has never been a "git branch --local", this is just a typo for
"--list". Fixes a comment added in 23e714df91 (branch: roll
show_detached HEAD into regular ref_list, 2015-09-23).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2021-01-06 15:15:39 -08:00
Junio C Hamano 71ca53e812 Git 2.30
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-27 15:15:23 -08:00
Junio C Hamano f6bf36dc9c Merge branch 'pb/doc-git-linkit-fix'
Docfix.

* pb/doc-git-linkit-fix:
  git.txt: fix typos in 'linkgit' macro invocation
2020-12-27 15:14:32 -08:00
Junio C Hamano 371065cc22 l10n for Git 2.30.0 round 2
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEE37vMEzKDqYvVxs51k24VDd1FMtUFAl/omoIACgkQk24VDd1F
 MtV1nw/9FJKiNTB4Qi7mX1uNSYMr3RxtSSq0w6SsPpXyv/CBRwa4ZLWe8KT5g8JA
 hPOn8XAPFwM5BL+4A62toqZi/758XBTLJNUL8iohfVSt2UeDpRDdC1nq7ufJU+Mm
 9ij0wmzor6KSLLUfor8B5eKf1mCtsoj20SpZcLzLqYMPsCrVePng+nLKb7HBiCpZ
 UUdLYhFN8UYcFaUXqNT/runcZbHEJCk+5G+3wGvKpWhA0ppthD0TTHRTnfvamotb
 q/w47/fFMfkB+7uCvB4ysctCFmhjqdRKVGDV8ZCCTxMURnQ3p1MC9IWTxkFfaWgN
 9ZwcEUYhKByhGNU1M4lcr7pWGfdXULa8/kIuXg2rHRKUeGQPmREKE8hOmOadFzlX
 vBlHKbKC0oZ8xVHY8IxkaKhEdUJ4q4WW6CYF1VCfbcEXWP4Y6/FTqG2ok2YgofNz
 DjB/jvLO9kqD1THLYY4aOOm1z6citLSMMrUG0TsVgJenb4bywZPEFuj1OzOZgaOF
 l/FfQqJVI9kqS8J17QLsrevItEwRnnFihLPg5Oh4MIp0MNmGNpnfiZwKT7/QjSEm
 bxtmNv3QFNlfie1Wvoq5L/cpmvdTsJHExfZAvhq3h2GYRXvB62uxaLI81Uz/VZZ4
 +SwGtoFeiqO2HWI0Iivx9NCMWfaj7vQiJMnohJViET+wLuXSDxY=
 =W3Ab
 -----END PGP SIGNATURE-----

Merge tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-po

l10n for Git 2.30.0 round 2

* tag 'l10n-2.30.0-rnd2' of https://github.com/git-l10n/git-po:
  l10n: zh_CN: for git v2.30.0 l10n round 1 and 2
  l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)
  l10n: pl.po: add translation and set team leader
  l10n: pl.po: started Polish translation
  l10n: de.po: Update German translation for Git 2.30.0
  l10n: Update Catalan translation
  l10n: bg.po: Updated Bulgarian translation (5037t)
  l10n: fr.po v2.30.0 rnd 2
  l10n: tr: v2.30.0-r2
  l10n: sv.po: Update Swedish translation (5037t0f0u)
  l10n: vi.po(5037t): v2.30.0 rnd 2
  l10n: git.pot: v2.30.0 round 2 (1 new, 2 removed)
  l10n: Update Catalan translation
  l10n: fr.po: v2.30.0 rnd 1
  l10n: fr.po Fix a typo
  l10n: fr fix misleading message
  l10n: tr: v2.30.0-r1
  l10n: sv.po: Update Swedish translation (5038t0f0u)
  l10n: git.pot: v2.30.0 round 1 (70 new, 45 removed)
2020-12-27 15:01:16 -08:00
Jiang Xin d13389bf27 l10n: zh_CN: for git v2.30.0 l10n round 1 and 2
Translate 71 new messages (5037t0f0u) for git 2.30.0.

Reviewed-by: 依云 <lilydjwg@gmail.com>
Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2020-12-27 19:23:27 +08:00
Jiang Xin ecc0c5841b Merge branch 'l10n/zh_TW/201223' of github.com:l10n-tw/git-po
* 'l10n/zh_TW/201223' of github.com:l10n-tw/git-po:
  l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)
2020-12-25 15:12:02 +08:00
pan93412 6806dd88f3 l10n: zh_TW.po: v2.30.0 round 2 (1 untranslated)
Signed-off-by: pan93412 <pan93412@gmail.com>
2020-12-25 12:16:13 +08:00
Arusekk b77b318bd2 l10n: pl.po: add translation and set team leader
Signed-off-by: Arusekk <arek_koz@o2.pl>
2020-12-23 23:51:43 +01:00
Junio C Hamano 4a0de43f49 Git 2.30-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-23 13:59:46 -08:00
Junio C Hamano 73583204d9 Merge branch 'nk/refspecs-negative-fix'
Hotfix for recent regression.

* nk/refspecs-negative-fix:
  negative-refspec: improve comment on query_matches_negative_refspec
  negative-refspec: fix segfault on : refspec
2020-12-23 13:59:46 -08:00
Junio C Hamano 7a50265295 Merge branch 'ma/maintenance-crontab-fix'
Hotfix for a topic of this cycle.

* ma/maintenance-crontab-fix:
  t7900-maintenance: test for magic markers
  gc: fix handling of crontab magic markers
  git-maintenance.txt: add missing word
2020-12-23 13:59:46 -08:00
Junio C Hamano 04cd999638 Merge branch 'dl/checkout-p-merge-base'
Fix to a regression introduced during this cycle.

* dl/checkout-p-merge-base:
  checkout -p: handle tree arguments correctly again
2020-12-23 13:59:46 -08:00
Junio C Hamano d076224363 Merge branch 'js/no-more-prepare-for-main-in-test'
Test coverage fix.

* js/no-more-prepare-for-main-in-test:
  tests: drop the `PREPARE_FOR_MAIN_BRANCH` prereq
  t9902: use `main` as initial branch name
  t6302: use `main` as initial branch name
  t5703: use `main` as initial branch name
  t5510: use `main` as initial branch name
  t5505: finalize transitioning to using the branch name `main`
  t3205: finalize transitioning to using the branch name `main`
  t3203: complete the transition to using the branch name `main`
  t3201: finalize transitioning to using the branch name `main`
  t3200: finish transitioning to the initial branch name `main`
  t1400: use `main` as initial branch name
2020-12-23 13:59:46 -08:00
Junio C Hamano c46f849f8a Merge branch 'jx/pack-redundant-on-single-pack'
"git pack-redandant" when there is only one packfile used to crash,
which has been corrected.

* jx/pack-redundant-on-single-pack:
  pack-redundant: fix crash when one packfile in repo
2020-12-23 13:59:46 -08:00
m4sk1n f6d254c157 l10n: pl.po: started Polish translation
Signed-off-by: Arusekk <arek_koz@o2.pl>
2020-12-23 22:51:30 +01:00
Matthias Rüster 6fe3d27d00 l10n: de.po: Update German translation for Git 2.30.0
Reviewed-by: Ralf Thielow <ralf.thielow@gmail.com>
Reviewed-by: Phillip Szelat <phillip.szelat@gmail.com>
Signed-off-by: Matthias Rüster <matthias.ruester@gmail.com>
2020-12-23 13:41:53 +01:00
Jiang Xin 4953317e6b Merge branch 'master' of github.com:Softcatala/git-po
* 'master' of github.com:Softcatala/git-po:
  l10n: Update Catalan translation
2020-12-23 08:44:44 +08:00
Philippe Blain 5bed7f66c4 git.txt: fix typos in 'linkgit' macro invocation
The 'linkgit' Asciidoc macro is misspelled as 'linkit' in the
description of 'GIT_SEQUENCE_EDITOR' since the addition of that variable
to git(1) in 902a126eca (doc: mention GIT_SEQUENCE_EDITOR and
'sequence.editor' more, 2020-08-31). Also, it uses two colons instead of
one.

Fix that.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-22 12:02:29 -08:00
Jordi Mas 9d82565c2e l10n: Update Catalan translation
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2020-12-22 18:04:53 +01:00
Alexander Shopov da0e79d6fa l10n: bg.po: Updated Bulgarian translation (5037t)
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2020-12-22 17:49:18 +01:00
Nipunn Koorapati 773c694142 negative-refspec: improve comment on query_matches_negative_refspec
Comment did not adequately explain how the two loops work
together to achieve the goal of querying for matching of any
negative refspec.

Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21 22:49:36 -08:00
Nipunn Koorapati 18f9c98845 negative-refspec: fix segfault on : refspec
The logic added to check for negative pathspec match by c0192df630
(refspec: add support for negative refspecs, 2020-09-30) looks at
refspec->src assuming it is never NULL, however when
remote.origin.push is set to ":", then refspec->src is NULL,
causing a segfault within strcmp.

Tell git to handle matching refspec by adding the needle to the
set of positively matched refspecs, since matching ":" refspecs
match anything as src.

Add test for matching refspec pushes fetch-negative-refspec
both individually and in combination with a negative refspec.

Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21 22:49:36 -08:00
Jiang Xin 44840426ec Merge branch 'fr_2.30_rnd2' of github.com:jnavila/git
* 'fr_2.30_rnd2' of github.com:jnavila/git:
  l10n: fr.po v2.30.0 rnd 2
2020-12-22 08:46:17 +08:00
Martin Ågren a52df25a54 t7900-maintenance: test for magic markers
When we insert our "BEGIN" and "END" markers into the cron table, it's
so that a Git version from many years into the future would be able to
identify this region in the cron table. Let's add a test to make sure
that these markers don't ever change.

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21 14:33:09 -08:00
Martin Ågren 66dc0a3625 gc: fix handling of crontab magic markers
On `git maintenance start`, we add a few entries to the user's cron
table. We wrap our entries using two magic markers, "# BEGIN GIT
MAINTENANCE SCHEDULE" and "# END GIT MAINTENANCE SCHEDULE". At a later
`git maintenance stop`, we will go through the table and remove these
lines. Or rather, we will remove the "BEGIN" marker, the "END" marker
and everything between them.

Alas, we have a bug in how we detect the "END" marker: we don't. As we
loop through all the lines of the crontab, if we are in the "old
region", i.e., the region we're aiming to remove, we make an early
`continue` and don't get as far as checking for the "END" marker. Thus,
once we've seen our "BEGIN", we remove everything until the end of the
file.

Rewrite the logic for identifying these markers. There are four cases
that are mutually exclusive: The current line starts a region or it ends
it, or it's firmly within the region, or it's outside of it (and should
be printed).

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21 14:33:08 -08:00
Martin Ågren 83fcadd636 git-maintenance.txt: add missing word
Add a missing "a" before "bunch".

Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Acked-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21 14:33:08 -08:00
Johannes Schindelin 5c29f19cda checkout -p: handle tree arguments correctly again
This fixes a segmentation fault.

The bug is caused by dereferencing `new_branch_info->commit` when it is
`NULL`, which is the case when the tree-ish argument is actually a tree,
not a commit-ish. This was introduced in 5602b500c3 (builtin/checkout:
fix `git checkout -p HEAD...` bug, 2020-10-07), where we tried to ensure
that the special tree-ish `HEAD...` is handled correctly.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21 14:06:09 -08:00
Jean-Noël Avila aa13df664e l10n: fr.po v2.30.0 rnd 2
Signed-off-by: Jean-Noël Avila <jn.avila@free.fr>
2020-12-21 18:53:19 +01:00
Emir Sarı cc2a21c415 l10n: tr: v2.30.0-r2
Signed-off-by: Emir Sarı <bitigchi@me.com>
2020-12-21 12:32:52 +03:00
Peter Krefting 035b991fae l10n: sv.po: Update Swedish translation (5037t0f0u)
Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
2020-12-21 08:10:43 +01:00
Tran Ngoc Quan 2a48769ec2 l10n: vi.po(5037t): v2.30.0 rnd 2
Signed-off-by: Tran Ngoc Quan <vnwildman@gmail.com>
2020-12-21 08:45:38 +07:00
Jiang Xin d0b62a5259 l10n: git.pot: v2.30.0 round 2 (1 new, 2 removed)
Generate po/git.pot from v2.30.0-rc1 for git v2.30.0 l10n round 2.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2020-12-21 07:11:59 +08:00
Jiang Xin 3104153d5e Merge remote-tracking branch 'github/master' into git-po-master
* github/master: (42 commits)
  Git 2.30-rc1
  git-gui: use gray background for inactive text widgets
  Another batch before 2.30-rc1
  git-gui: Fix selected text colors
  Makefile: conditionally include GIT-VERSION-FILE
  git-gui: fix colored label backgrounds when using themed widgets
  config.mak.uname: remove old NonStop compatibility settings
  diff: correct interaction between --exit-code and -I<pattern>
  t/perf: fix test_export() failure with BSD `sed`
  style: do not "break" in switch() after "return"
  compat-util: pretend that stub setitimer() always succeeds
  strmap: make callers of strmap_remove() to call it in void context
  doc: mention Python 3.x supports
  index-format.txt: document v2 format of file system monitor extension
  docs: multi-pack-index: remove note about future 'verify' work
  init: provide useful advice about init.defaultBranch
  get_default_branch_name(): prepare for showing some advice
  branch -m: allow renaming a yet-unborn branch
  init: document `init.defaultBranch` better
  t7900: use --fixed-value in git-maintenance tests
  ...
2020-12-21 07:10:19 +08:00
Jordi Mas da5bf7b515 l10n: Update Catalan translation
Signed-off-by: Jordi Mas <jmas@softcatala.org>
2020-12-19 23:52:12 +01:00
Junio C Hamano 6d3ef5b467 Git 2.30-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-18 15:15:18 -08:00
Junio C Hamano 59fcf746f5 Merge branch 'jc/diff-I-status-fix'
"git diff -I<pattern> -exit-code" should exit with 0 status when
all the changes match the ignored pattern, but it didn't.

* jc/diff-I-status-fix:
  diff: correct interaction between --exit-code and -I<pattern>
2020-12-18 15:15:18 -08:00
Junio C Hamano d4187bd4d5 Merge branch 'es/perf-export-fix'
Dev-support fix for BSD.

* es/perf-export-fix:
  t/perf: fix test_export() failure with BSD `sed`
2020-12-18 15:15:18 -08:00
Junio C Hamano 21fa5bb972 Merge branch 'rb/nonstop-config-mak-uname-update'
Build update.

* rb/nonstop-config-mak-uname-update:
  config.mak.uname: remove old NonStop compatibility settings
2020-12-18 15:15:18 -08:00
Junio C Hamano 3517022568 Merge branch 'ab/unreachable-break'
Code clean-up.

* ab/unreachable-break:
  style: do not "break" in switch() after "return"
2020-12-18 15:15:18 -08:00
Junio C Hamano e0f58c9b3e Merge branch 'jc/strmap-remove-typefix'
C-std compliance fix.

* jc/strmap-remove-typefix:
  strmap: make callers of strmap_remove() to call it in void context
2020-12-18 15:15:17 -08:00
Junio C Hamano ecfc02df85 Merge branch 'jc/compat-util-setitimer-fix'
Fix a recent bug in a rarely used replacement code.

* jc/compat-util-setitimer-fix:
  compat-util: pretend that stub setitimer() always succeeds
2020-12-18 15:15:17 -08:00
Junio C Hamano 263dc03b82 Merge branch 'dd/doc-p4-requirements-update'
Doc update.

* dd/doc-p4-requirements-update:
  doc: mention Python 3.x supports
2020-12-18 15:15:17 -08:00
Junio C Hamano 772bdcd429 Merge branch 'js/init-defaultbranch-advice'
Our users are going to be trained to prepare for future change of
init.defaultBranch configuration variable.

* js/init-defaultbranch-advice:
  init: provide useful advice about init.defaultBranch
  get_default_branch_name(): prepare for showing some advice
  branch -m: allow renaming a yet-unborn branch
  init: document `init.defaultBranch` better
2020-12-18 15:15:17 -08:00
Junio C Hamano f4d8e19123 Merge https://github.com/prati0100/git-gui
* https://github.com/prati0100/git-gui:
  git-gui: use gray background for inactive text widgets
  git-gui: Fix selected text colors
  Makefile: conditionally include GIT-VERSION-FILE
  git-gui: fix colored label backgrounds when using themed widgets
  git-gui: ssh-askpass: add a checkbox to show the input text
  git-gui: update Russian translation
  git-gui: use commit message template
  git-gui: Only touch GITGUI_MSG when needed
2020-12-18 15:07:10 -08:00
Pratyush Yadav 7b0cfe156e Merge branch 'sh/inactive-background'
Set a different background color for selections in inactive widgets.
This inactive color is calculated from the current theme colors to make
sure it works for all themes.

* sh/inactive-background:
  git-gui: use gray background for inactive text widgets
2020-12-19 01:02:34 +05:30