1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-24 03:46:12 +02:00
Commit Graph

61726 Commits

Author SHA1 Message Date
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
Eric Sunshine cf76baea41 worktree: teach `repair` to fix multi-directional breakage
`git worktree repair` knows how to repair the two-way links between the
repository and a worktree as long as a link in one or the other
direction is sound. For instance, if a linked worktree is moved (without
using `git worktree move`), repair is possible because the worktree
still knows the location of the repository even though the repository no
longer knows where the worktree is. Similarly, if the repository is
moved, repair is possible since the repository still knows the locations
of the worktrees even though the worktrees no longer know where the
repository is.

However, if both the repository and the worktrees are moved, then links
are severed in both directions, and no repair is possible. This is the
case even when the new worktree locations are specified as arguments to
`git worktree repair`. The reason for this limitation is twofold. First,
when `repair` consults the worktree's gitfile (/path/to/worktree/.git)
to determine the corresponding <repo>/worktrees/<id>/gitdir file to fix,
<repo> is the old path to the repository, thus it is unable to fix the
`gitdir` file at its new location since it doesn't know where it is.
Second, when `repair` consults <repo>/worktrees/<id>/gitdir to find the
location of the worktree's gitfile (/path/to/worktree/.git), the path
recorded in `gitdir` is the old location of the worktree's gitfile, thus
it is unable to repair the gitfile since it doesn't know where it is.

Fix these shortcomings by teaching `repair` to attempt to infer the new
location of the <repo>/worktrees/<id>/gitdir file when the location
recorded in the worktree's gitfile has become stale but the file is
otherwise well-formed. The inference is intentionally simple-minded.
For each worktree path specified as an argument, `git worktree repair`
manually reads the ".git" gitfile at that location and, if it is
well-formed, extracts the <id>. It then searches for a corresponding
<id> in <repo>/worktrees/ and, if found, concludes that there is a
reasonable match and updates <repo>/worktrees/<id>/gitdir to point at
the specified worktree path. In order for <repo> to be known, `git
worktree repair` must be run in the main worktree or bare repository.

`git worktree repair` first attempts to repair each incoming
/path/to/worktree/.git gitfile to point at the repository, and then
attempts to repair outgoing <repo>/worktrees/<id>/gitdir files to point
at the worktrees. This sequence was chosen arbitrarily when originally
implemented since the order of fixes is immaterial as long as one side
of the two-way link between the repository and a worktree is sound.
However, for this new repair technique to work, the order must be
reversed. This is because the new inference mechanism, when it is
successful, allows the outgoing <repo>/worktrees/<id>/gitdir file to be
repaired, thus fixing one side of the two-way link. Once that side is
fixed, the other side can be fixed by the existing repair mechanism,
hence the order of repairs is now significant.

Two safeguards are employed to avoid hijacking a worktree from a
different repository if the user accidentally specifies a foreign
worktree as an argument. The first, as described above, is that it
requires an <id> match between the repository and the worktree. That
itself is not foolproof for preventing hijack, so the second safeguard
is that the inference will only kick in if the worktree's
/path/to/worktree/.git gitfile does not point at a repository.

Signed-off-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21 13:44:28 -08:00
Felipe Contreras 33fc56253b test: bisect-porcelain: fix location of files
Commit ba7eafe146 (t6030: explicitly test for bisection cleanup,
2017-09-29) introduced checks for files in the $GIT_DIR directory, but
that variable is not always defined, and in this test file it's not.

Therefore these checks always passed regardless of the presence of these
files (unless the user has some /BISECT_LOG file, for some reason).

Let's check the files in the correct location.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-21 13:08:39 -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
Stefan Haller da4d86da97 git-gui: use gray background for inactive text widgets
This makes it easier to see at a glance which of the four main views has the
keyboard focus.

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
2020-12-19 01:00:17 +05:30
Junio C Hamano ba2aa15129 Another batch before 2.30-rc1
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-17 15:06:42 -08:00
Junio C Hamano 7bceb83bfe Merge branch 'jh/index-v2-doc-on-fsmn'
Doc update.

* jh/index-v2-doc-on-fsmn:
  index-format.txt: document v2 format of file system monitor extension
2020-12-17 15:06:42 -08:00
Junio C Hamano 94dc98d1d2 Merge branch 'jb/midx-doc-update'
Doc update.

* jb/midx-doc-update:
  docs: multi-pack-index: remove note about future 'verify' work
2020-12-17 15:06:41 -08:00
Junio C Hamano f0c592dcfd Merge branch 'rj/make-clean'
Build optimization.

* rj/make-clean:
  Makefile: don't use a versioned temp distribution directory
  Makefile: don't try to clean old debian build product
  gitweb/Makefile: conditionally include ../GIT-VERSION-FILE
  Documentation/Makefile: conditionally include ../GIT-VERSION-FILE
  Documentation/Makefile: conditionally include doc.dep
2020-12-17 15:06:40 -08:00
Junio C Hamano 689010ca3c Merge branch 'js/t7064-master-to-initial'
Test update.

* js/t7064-master-to-initial:
  t7064: avoid relying on a specific default branch name
2020-12-17 15:06:40 -08:00
Junio C Hamano f4fb219a97 Merge branch 'js/t6300-hardcode-main'
Test update.

* js/t6300-hardcode-main:
  t6300: avoid using the default name of the initial branch
2020-12-17 15:06:40 -08:00
Junio C Hamano e5ace7167a Merge branch 'jk/oid-array-cleanup'
Code clean-up.

* jk/oid-array-cleanup:
  commit-graph: use size_t for array allocation and indexing
  commit-graph: replace packed_oid_list with oid_array
  commit-graph: drop count_distinct_commits() function
  oid-array: provide a for-loop iterator
  oid-array: make sort function public
  cache.h: move hash/oid functions to hash.h
  t0064: make duplicate tests more robust
  t0064: drop sha1 mention from filename
  oid-array.h: drop sha1 mention from header guard
2020-12-17 15:06:40 -08:00
Junio C Hamano 21127fa982 Merge branch 'tb/partial-clone-filters-fix'
Fix potential server side resource deallocation issues when
responding to a partial clone request.

* tb/partial-clone-filters-fix:
  upload-pack.c: don't free allowed_filters util pointers
  builtin/clone.c: don't ignore transport_fetch_refs() errors
2020-12-17 15:06:40 -08:00
Junio C Hamano 9feed4e2a6 Merge branch 'js/t7900-protect-pwd-in-config-get'
Hotfix for test breakage.

* js/t7900-protect-pwd-in-config-get:
  t7900: use --fixed-value in git-maintenance tests
2020-12-17 15:06:39 -08:00
Pratyush Yadav 62aed982fd Merge branch 'st/selected-text-colors'
Set colors for selected text properly.

* st/selected-text-colors:
  git-gui: Fix selected text colors
2020-12-18 01:52:26 +05:30
Serg Tereshchenko 4d22c0505f git-gui: Fix selected text colors
Added selected state colors for text widget.

Same colors for active and inactive selection, to match previous
behaviour.

Signed-off-by: Serg Tereshchenko <serg.partizan@gmail.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
2020-12-18 01:49:18 +05:30
Pratyush Yadav 796f6525b1 Merge branch 'rj/clean-speedup'
Speed up 'make clean' on Cygwin.

* rj/clean-speedup:
  Makefile: conditionally include GIT-VERSION-FILE
2020-12-18 00:42:14 +05:30
Ramsay Jones 5bc8b5d5c1 Makefile: conditionally include GIT-VERSION-FILE
The 'clean' target is noticeably slow on cygwin, even for a 'do-nothing'
invocation of 'make clean'. For example, the second 'make clean' given
below:

  $ make clean >/dev/null 2>&1
  $ make clean
  GITGUI_VERSION = 0.21.0.85.g3e5c
  rm -rf git-gui lib/tclIndex po/*.msg
  rm -rf GIT-VERSION-FILE GIT-GUI-VARS
  $

has been timed at 1.934s on my laptop (an old core i5-4200M @ 2.50GHz,
8GB RAM, 1TB HDD).

Notice that the Makefile, as part of processing the 'clean' target, is
updating the 'GIT-VERSION-FILE' file.  This is to ensure that the
$(GITGUI_VERSION) make variable is set, once that file had been included.
However, the 'clean' target does not use the $(GITGUI_VERSION) variable,
so this is wasted effort.

In order to eliminate such wasted effort, use the value of the internal
$(MAKECMDGOALS) variable to only '-include GIT-VERSION-FILE' when the
target is not 'clean'. (This drops the time down to 0.676s, on my laptop,
giving an improvement of 65.05%).

Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
2020-12-18 00:34:15 +05:30
Pratyush Yadav 7d6d21f5b9 Merge branch 'sh/macos-labels'
Fix label background colors on MacOS when ttk is enabled.

* sh/macos-labels:
  git-gui: fix colored label backgrounds when using themed widgets
2020-12-18 00:32:06 +05:30
Stefan Haller f9481b195b git-gui: fix colored label backgrounds when using themed widgets
The aqua theme on Mac doesn't support changing the background color for labels
and frames [1]. Since the red, green, and yellow backgrounds of the labels for
unstaged and staged files and the diff pane are so important design elements of
git gui's main window, it's not acceptable for them to have grey backgrounds on
Mac.

To work around this, simply use non-themed widgets for all labels on Mac. This
is not a big problem because labels don't look extremely different between the
themed and non-themed versions. There are subtle differences, but they are not
as bad as having the wrong background color.

[1] https://stackoverflow.com/a/6723911

Signed-off-by: Stefan Haller <stefan@haller-berlin.de>
Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
2020-12-18 00:30:37 +05:30
Randall S. Becker 731d578b4f config.mak.uname: remove old NonStop compatibility settings
The MKDIR_WO_TRAILING_SLASH and NO_SETITIMER options are no longer
needed on the NonStop platforms as both are now supported by the
oldest supported operating system revision.

Signed-off-by: Randall S. Becker <rsbecker@nexbridge.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 22:06:53 -08:00
Elijah Newren 8119214f4e merge-ort: implement merge_incore_recursive()
Implement merge_incore_recursive(), mostly through the use of a new
helper function, merge_ort_internal(), which itself is based off
merge_recursive_internal() from merge-recursive.c.

This drops the number of failures in the testsuite when run under
GIT_TEST_MERGE_ALGORITHM=ort from around 1500 to 647.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 21:56:39 -08:00
Elijah Newren 43e9c4eecc merge-ort: make clear_internal_opts() aware of partial clearing
In order to handle recursive merges, after merging merge-bases we need
to clear away most of the data we had built up but some of it needs to
be kept -- in particular the "output" field.  Rename the function to
reflect its future change in use.

Further, since "reinitialize" means we'll be reusing the fields
immediately, take advantage of this to only partially clear maps,
leaving the hashtable allocated and pre-sized.  (This may be slightly
out-of-order since the speedups aren't realized until there are far
more strmaps in use, but the patch submission process already went out
of order because of various questions and requests for strmap.  Anyway,
see commit 6ccdfc2a20 ("strmap: enable faster clearing and reusing of
strmaps", 2020-11-05), for performance details about the use of
strmap_partial_clear().)

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 21:56:39 -08:00
Elijah Newren 4296d8f17d merge-ort: copy a few small helper functions from merge-recursive.c
In a subsequent commit, we will implement the traditional recursiveness
that gave merge-recursive its name, namely merging non-unique
merge-bases to come up with a single virtual merge base.  Copy a few
helper functions from merge-recursive.c that we will use in the
implementation.

Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 21:56:39 -08:00
Elijah Newren b0ca120554 commit: move reverse_commit_list() from merge-recursive
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 21:56:39 -08:00
Jiang Xin 0696232390 pack-redundant: fix crash when one packfile in repo
Command `git pack-redundant --all` will crash if there is only one
packfile in the repository.  This is because, if there is only one
packfile in local_packs, `cmp_local_packs` will do nothing and will
leave `pl->unique_objects` as uninitialized.

Also add testcases for repository with no packfile and one packfile
in t5323.

Reported-by: Daniel C. Klauer <daniel.c.klauer@web.de>
Signed-off-by: Jiang Xin <zhiyou.jx@alibaba-inc.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 21:21:06 -08:00
Johannes Schindelin f17c9da2cf tests: drop the `PREPARE_FOR_MAIN_BRANCH` prereq
We no longer use it.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 17:41:41 -08:00
Johannes Schindelin 0007618107 t9902: use `main` as initial branch name
In 8164360fc8 (t9902: prepare a test for the upcoming default branch
name, 2020-10-23), we started adjusting this test script for the default
initial branch name changing to `main`.

However, there is no need to wait for that: let's adjust the test script
to stop relying on a specific initial branch name by setting it
explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq
from one test case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 17:41:41 -08:00
Johannes Schindelin 2dbd00a7a1 t6302: use `main` as initial branch name
In 66713e84e7 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we started adjusting this test script for the default
initial branch name changing to `main`.

However, there is no need to wait for that: let's adjust the test script
to stop relying on a specific initial branch name by setting it
explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq
from six test cases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 17:41:41 -08:00
Johannes Schindelin 72dc172804 t5703: use `main` as initial branch name
In 97cf8d50b5 (t5703: adjust a test case for the upcoming default
branch name, 2020-10-23), we prepared this test script for a world when
the default initial branch name would be `main`.

However, there is no need to wait for that: let's adjust the test script
to stop relying on a specific initial branch name by setting it
explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq
from one test case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 17:41:41 -08:00
Johannes Schindelin 83ecf26ee7 t5510: use `main` as initial branch name
In 66713e84e7 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we prepared this test script for a time when the
default initial branch name would be `main`.

However, there is no need to wait for that: let's adjust the test script
to stop relying on a specific initial branch name by setting it
explicitly. This allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq
from two test cases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 17:41:41 -08:00
Johannes Schindelin 97b913681b t5505: finalize transitioning to using the branch name `main`
In 66713e84e7 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we started that transition, trying to prepare for a
time when `git init` would use that name for the initial branch.

Even if that time has not arrived, we can complete the transition by
making the test script independent of the default branch name. This also
allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from four test
cases.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 17:41:41 -08:00
Johannes Schindelin 654bd7e8a9 t3205: finalize transitioning to using the branch name `main`
In 66713e84e7 (tests: prepare aligned mentions of the default branch
name, 2020-10-23), we started that transition, trying to prepare for a
time when `git init` would use that name for the initial branch.

Even if that time has not arrived, we can complete the transition by
making the test script independent of the default branch name. This also
allows us to drop the `PREPARE_FOR_MAIN_BRANCH` prereq from one test
case.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2020-12-16 17:41:41 -08:00