Commit graph

49959 commits

Author SHA1 Message Date
Elijah Newren 79d49b7d8c merge-recursive: check for file level conflicts then get new name
Before trying to apply directory renames to paths within the given
directories, we want to make sure that there aren't conflicts at the
file level either.  If there aren't any, then get the new name from
any directory renames.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:53 -08:00
Elijah Newren ea625cb027 merge-recursive: add computation of collisions due to dir rename & merging
directory renaming and merging can cause one or more files to be moved to
where an existing file is, or to cause several files to all be moved to
the same (otherwise vacant) location.  Add checking and reporting for such
cases, falling back to no-directory-rename handling for such paths.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:53 -08:00
Elijah Newren 53e32d4652 merge-recursive: check for directory level conflicts
Before trying to apply directory renames to paths within the given
directories, we want to make sure that there aren't conflicts at the
directory level.  There will be additional checks at the individual
file level too, which will be added later.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:52 -08:00
Elijah Newren 8383408dc7 merge-recursive: add get_directory_renames()
This populates a set of directory renames for us.  The set of directory
renames is not yet used, but will be in subsequent commits.

Note that the use of a string_list for possible_new_dirs in the new
dir_rename_entry struct implies an O(n^2) algorithm; however, in practice
I expect the number of distinct directories that files were renamed into
from a single original directory to be O(1).  My guess is that n has a
mode of 1 and a mean of less than 2, so, for now, string_list seems good
enough for possible_new_dirs.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:52 -08:00
Elijah Newren 84a548dedd merge-recursive: make a helper function for cleanup for handle_renames
In anticipation of more involved cleanup to come, make a helper function
for doing the cleanup at the end of handle_renames.  Rename the already
existing cleanup_rename[s]() to final_cleanup_rename[s](), name the new
helper initial_cleanup_rename(), and leave the big comment in the code
about why we can't do all the cleanup at once.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:52 -08:00
Elijah Newren 3f646871a3 merge-recursive: split out code for determining diff_filepairs
Create a new function, get_diffpairs() to compute the diff_filepairs
between two trees.  While these are currently only used in
get_renames(), I want them to be available to some new functions.  No
actual logic changes yet.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:52 -08:00
Elijah Newren e7f04a3aaf merge-recursive: make !o->detect_rename codepath more obvious
Previously, if !o->detect_rename then get_renames() would return an
empty string_list, and then process_renames() would have nothing to
iterate over.  It seems more straightforward to simply avoid calling
either function in that case.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:52 -08:00
Elijah Newren 9622f8af8c merge-recursive: fix leaks of allocated renames and diff_filepairs
get_renames() has always zero'ed out diff_queued_diff.nr while only
manually free'ing diff_filepairs that did not correspond to renames.
Further, it allocated struct renames that were tucked away in the
return string_list.  Make sure all of these are deallocated when we
are done with them.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:52 -08:00
Elijah Newren 2dd6f8aa84 merge-recursive: introduce new functions to handle rename logic
The amount of logic in merge_trees() relative to renames was just a few
lines, but split it out into new handle_renames() and cleanup_renames()
functions to prepare for additional logic to be added to each.  No code or
logic changes, just a new place to put stuff for when the rename detection
gains additional checks.

Note that process_renames() records pointers to various information (such
as diff_filepairs) into rename_conflict_info structs.  Even though the
rename string_lists are not directly used once handle_renames() completes,
we should not immediately free the lists at the end of that function
because they store the information referenced in the rename_conflict_info,
which is used later in process_entry().  Thus the reason for a separate
cleanup_renames().

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:52 -08:00
Elijah Newren a706e8f6fc merge-recursive: move the get_renames() function
Move this function so it can re-use some others (without either
moving all of them or adding an annoying split between function
declarations and definitions).  Cheat slightly by adding a blank line
for readability, and in order to silence checkpatch.pl.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:52 -08:00
Elijah Newren e04d4a23d8 directory rename detection: tests for handling overwriting dirty files
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:52 -08:00
Elijah Newren 1619442e7b directory rename detection: tests for handling overwriting untracked files
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:51 -08:00
Elijah Newren 9746b8bb8d directory rename detection: miscellaneous testcases to complete coverage
I came up with the testcases in the first eight sections before coding up
the implementation.  The testcases in this section were mostly ones I
thought of while coding/debugging, and which I was too lazy to insert
into the previous sections because I didn't want to re-label with all the
testcase references.  :-)

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:51 -08:00
Elijah Newren a53ab7eef2 directory rename detection: testcases exploring possibly suboptimal merges
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:51 -08:00
Elijah Newren faac7addb4 directory rename detection: more involved edge/corner testcases
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:51 -08:00
Elijah Newren 4f4180624c directory rename detection: testcases checking which side did the rename
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:51 -08:00
Elijah Newren 65fa3556bd directory rename detection: files/directories in the way of some renames
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:51 -08:00
Elijah Newren 881e48bafd directory rename detection: partially renamed directory testcase/discussion
Add a long note about why we are not considering "partial directory
renames" for the current directory rename detection implementation.

Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:51 -08:00
Elijah Newren cea6be0683 directory rename detection: testcases to avoid taking detection too far
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:51 -08:00
Elijah Newren 740e4bdac6 directory rename detection: directory splitting testcases
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:51 -08:00
Elijah Newren eabbebfbe0 directory rename detection: basic testcases
Reviewed-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-02-14 13:02:50 -08:00
Elijah Newren 379fc37866 merge-recursive: add explanation for src_entry and dst_entry
If I have to walk through the debugger and inspect the values found in
here in order to figure out their meaning, despite having known these
things inside and out some years back, then they probably need a comment
for the casual reader to explain their purpose.

Reviewed-By: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-19 14:44:18 -08:00
Elijah Newren 6c8647da5c merge-recursive: fix logic ordering issue
merge_trees() did a variety of work, including:
  * Calling get_unmerged() to get unmerged entries
  * Calling record_df_conflict_files() with all unmerged entries to
    do some work to ensure we could handle D/F conflicts correctly
  * Calling get_renames() to check for renames.

An easily overlooked issue is that get_renames() can create more
unmerged entries and add them to the list, which have the possibility of
being involved in D/F conflicts.  So the call to
record_df_conflict_files() should really be moved after all the rename
detection.  I didn't come up with any testcases demonstrating any bugs
with the old ordering, but I suspect there were some for both normal
renames and for directory renames.  Fix the ordering.

Reviewed-By: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-19 14:44:18 -08:00
Elijah Newren 7c5585ff48 Tighten and correct a few testcases for merging and cherry-picking
t3501 had a testcase originally added in 05f2dfb965 (cherry-pick:
demonstrate a segmentation fault, 2016-11-26) to ensure cherry-pick
wouldn't segfault when working with a dirty file involved in a rename.
While the segfault was fixed, there was another problem this test
demonstrated: namely, that git would overwrite a dirty file involved in a
rename.  Further, the test encoded a "successful merge" and overwriting of
this file as correct behavior.  Modify the test so that it would still
catch the segfault, but to require the correct behavior.  Mark it as
test_expect_failure for now too, since this second bug is not yet fixed.

t7607 had a test added in 30fd3a5425 (merge overwrites unstaged changes in
renamed file, 2012-04-15) specific to looking for a merge overwriting a
dirty file involved in a rename, but it too actually encoded what I would
term incorrect behavior: it expected the merge to succeed.  Fix that, and
add a few more checks to make sure that the merge really does produce the
expected results.

Reviewed-By: Stefan Beller <sbeller@google.com>
Signed-off-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-19 14:44:18 -08:00
Junio C Hamano 2512f15446 Git 2.16
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-17 13:06:51 -08:00
Junio C Hamano e0d575025a l10n for Git 2.16.0 round 2
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQIcBAABAgAGBQJaXL0xAAoJEMek6Rt1RHooLqEQAKGM08R7sWxLR1rc+O/DX/LR
 R+ea+jGXe9Fy88d4zRj4+Dw+PxAxR/gNvGlRMppO/Ig4VuUAjaloCQiDpmttxX3l
 oEX2FKF/Fy2VI2QXoYH7KF1+aHtE/XHfWkndHNexjXYGCq/uHTPQe+kHf8b+h5S/
 rUsCx6U6fvXoWJaGQbXgywI/aCAq/dEAdw0wbWyhNxpeTuQnIuZpeZ9mhArKeN+k
 2daVMD8H9rTDrxMiqybPXbYJwSjyBVgRMwSLUv79GE+KD1G79yTLjbTJsfnjpKIj
 PHF9IgmRdrjppGXlU3MDfaFY14CzX8LxHCFUA+fVYPI/m/0UN57cfi8yOMfiAhEs
 fGc7LU5dt6vOr4n/S3nULPJlfPujLK/hsPAfvmgh6wKECVOs/lcXpjlnnC5YcflG
 jb5B1YpmxsA6aoCgQC5HR3cx6ox6oOnCeEucH/Xg/uYoG0wOB2P5f5R4/Lfj0rfy
 vshZlmQXmbDUvTKrzz3fYaiPqSelmibrlk+ihzsoV7KbvH907G1xcU2RTVSvmrUt
 kVTaqJMoDcRvp0RkT/uZHEfJJHNdoMyuDOhCLtxQ2R6xCe+sW4KZwe//ngju11iO
 4E6730hGmjBcFhE03gdY84ojD9hgEzgwGIdN53h+1y9RF8v5kiN7NZwM4lCsA6Ag
 IbNLQ4V7LIPW64yRZoht
 =Dbk1
 -----END PGP SIGNATURE-----

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

l10n for Git 2.16.0 round 2

* tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-po: (24 commits)
  l10n: de.po: translate 72 new messages
  l10n: de.po: improve messages when a branch starts to track another ref
  l10n: bg.po: Updated Bulgarian translation (3288t)
  l10n: TEAMS: add zh_CN team members
  l10n: zh_CN: for git v2.16.0 l10n round 2
  l10n: sv.po: Update Swedish translation (3288t0f0u)
  l10n: ru.po: update Russian translation
  l10n: TEAMS: Add ko team members
  l10n: ko.po: Update Korean translation
  l10n: fr.po 2.16 round 2
  l10n: es.po: Spanish translation 2.16.0 round 2
  l10n: vi.po(3288t): Updated Vietnamese translation for v2.16.0 round 2
  l10n: git.pot: v2.16.0 round 2 (8 new, 4 removed)
  l10n: es.po: Update Spanish Translation v2.16.0
  l10n: fr.po v2.16.0 round 1
  l10n: bg.po: Updated Bulgarian translation (3284t)
  l10n: sv.po: Update Swedish translation (3284t0f0u)
  l10n: fr.po: "worktree list" mistranslated as prune
  l10n: git.pot: v2.16.0 round 1 (64 new, 25 removed)
  l10n: fixes to German translation
  ...
2018-01-16 14:49:58 -08:00
Ralf Thielow c9741bb98e l10n: de.po: translate 72 new messages
Translate 72 new messages came from git.pot update in 18a907225 (l10n:
git.pot: v2.16.0 round 1 (64 new, 25 removed)) and 005c62fe4 (l10n:
git.pot: v2.16.0 round 2 (8 new, 4 removed)).

Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Acked-by: Matthias Rüster <matthias.ruester@gmail.com>
2018-01-15 07:47:30 +01:00
Ralf Thielow 31eaa14e81 l10n: de.po: improve messages when a branch starts to track another ref
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
2018-01-15 07:47:30 +01:00
SZEDER Gábor 0c37383f2e RelNotes: minor typofix
Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-12 10:40:42 -08:00
Junio C Hamano c6c75c93aa Git 2.16-rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-11 13:20:41 -08:00
Junio C Hamano ba82fdaea3 Merge branch 'jh/object-filtering'
Hotfix for a topic already in 'master'.

* jh/object-filtering:
  oidset: don't return value from oidset_init
2018-01-11 13:16:37 -08:00
Junio C Hamano 453f3fec59 Merge branch 'tg/worktree-create-tracking'
Doc hotfix.

* tg/worktree-create-tracking:
  Documentation/git-worktree.txt: add missing `
2018-01-11 13:16:36 -08:00
Junio C Hamano 91ec08a078 Merge branch 'js/test-with-ws-in-path'
Hot fix to a test.

* js/test-with-ws-in-path:
  t3900: add some more quotes
2018-01-11 13:16:36 -08:00
Alexander Shopov 1b6d5e83b6 l10n: bg.po: Updated Bulgarian translation (3288t)
Signed-off-by: Alexander Shopov <ash@kambanaria.org>
2018-01-11 22:02:02 +01:00
Ralf Thielow 50fdf7b1b1 Documentation/git-worktree.txt: add missing `
Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-11 12:19:40 -08:00
Beat Bolli 36a6f49cc3 t3900: add some more quotes
In 89a70b80 ("t0302 & t3900: add forgotten quotes", 2018-01-03), quotes
were added to protect against spaces in $HOME. In the test_when_finished
command, two files are deleted which must be quoted individually.

[jc: with \$HOME in the test_when_finished command quoted, as
pointed out by j6t].

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Helped-by: Johannes Sixt <j6t@kdbg.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-10 15:07:26 -08:00
Junio C Hamano 650b103706 RelNotes update before -rc2
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-10 14:01:50 -08:00
Junio C Hamano fac910641a Merge branch 'js/perl-path-workaround-in-tests'
* js/perl-path-workaround-in-tests:
  mingw: handle GITPERLLIB in t0021 in a Windows-compatible way
2018-01-10 14:01:31 -08:00
Junio C Hamano a466ef018e Merge branch 'ew/empty-merge-with-dirty-index'
"git merge -s recursive" did not correctly abort when the index is
dirty, if the merged tree happened to be the same as the current
HEAD, which has been fixed.

* ew/empty-merge-with-dirty-index:
  merge-recursive: do not look at the index during recursive merge
2018-01-10 14:01:25 -08:00
Junio C Hamano 4cc676c46c Merge branch 'ma/bisect-leakfix'
A hotfix for a recent update that broke 'git bisect'.

* ma/bisect-leakfix:
  bisect: fix a regression causing a segfault
2018-01-10 14:01:25 -08:00
Junio C Hamano bc4efaf103 Merge branch 'js/fix-merge-arg-quoting-in-rebase-p'
"git rebase -p -X<option>" did not propagate the option properly
down to underlying merge strategy backend.

* js/fix-merge-arg-quoting-in-rebase-p:
  rebase -p: fix quoting when calling `git merge`
2018-01-10 14:01:24 -08:00
Johannes Schindelin 3306f6524d mingw: handle GITPERLLIB in t0021 in a Windows-compatible way
Git's assumption that all path lists are colon-separated is not only
wrong on Windows, it is not even an assumption that is compatible with
POSIX.

In the interest of time, let's not try to fix this properly but simply
work around the obvious breakage on Windows, where the MSYS2 Bash used
by Git for Windows to interpret the Git's Unix shell scripts will
automagically convert path lists in the environment to
semicolon-separated lists of Windows paths (with drive letter and the
corresponding colon and all that jazz).

In other words, we simply look whether there is a semicolon in
GITPERLLIB and split by semicolons if found instead of colons. This is
not fool-proof, of course, as the path list could consist of a single
path. But that is not the case in Git for Windows' test suite, there are
always two paths in GITPERLLIB.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-01-10 14:00:54 -08:00
Jiang Xin 0d08328dd8 l10n: TEAMS: add zh_CN team members
Add Fangyi Zhou to zh_CN l10n team members.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
2018-01-10 11:31:55 +08:00
Jiang Xin 5809aa05f7 l10n: zh_CN: for git v2.16.0 l10n round 2
Translate 72 messages (3288t0f0u) for git v2.16.0-rc1.

Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
Reviewed-by: 依云 <lilydjwg@gmail.com>
Reviewed-by: Fangyi Zhou <fangyi.zhou@yuriko.moe>
2018-01-10 11:31:32 +08:00
Jiang Xin dfb5c4c15b Merge branch 'master' of git://github.com/nafmo/git-l10n-sv
* 'master' of git://github.com/nafmo/git-l10n-sv:
  l10n: sv.po: Update Swedish translation (3288t0f0u)
2018-01-10 11:30:04 +08:00
Jiang Xin 45498f08b6 Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ru
* 'russian-l10n' of https://github.com/DJm00n/git-po-ru:
  l10n: ru.po: update Russian translation
2018-01-10 11:28:56 +08:00
Junio C Hamano 6366dd9000 Merge branch 'jk/doc-diff-options'
Doc update.

* jk/doc-diff-options:
  docs/diff-options: clarify scope of diff-filter types
2018-01-09 14:32:57 -08:00
Junio C Hamano 4e51984e82 Merge branch 'bw/protocol-v1'
Test fix for a topic already in 'master'.

* bw/protocol-v1:
  http: fix v1 protocol tests with apache httpd < 2.4
2018-01-09 14:32:56 -08:00
Junio C Hamano 14c84cd55b Merge branch 'sg/travis-check-untracked'
* sg/travis-check-untracked:
  travis-ci: check that all build artifacts are .gitignore-d
  travis-ci: don't store P4 and Git LFS in the working tree
2018-01-09 14:32:55 -08:00
Junio C Hamano d702d5c5bd Merge branch 'js/test-with-ws-in-path'
Test fixes.

* js/test-with-ws-in-path:
  t0302 & t3900: add forgotten quotes
  Allow the test suite to pass in a directory whose name contains spaces
2018-01-09 14:32:55 -08:00