summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* merge-recursive: ensure we write updates for directory-renamed fileen/rename-directory-detectionElijah Newren2018-02-272-4/+2
| | | | | | | | | | | | | | When a file is present in HEAD before the merge and the other side of the merge does not modify that file, we try to avoid re-writing the file and making it stat-dirty. However, when a file is present in HEAD before the merge and was in a directory that was renamed by the other side of the merge, we have to move the file to a new location and re-write it. Update the code that checks whether we can skip the update to also work in the presence of 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>
* merge-recursive: avoid spurious rename/rename conflict from dir renamesElijah Newren2018-02-272-32/+27
| | | | | | | | | | | | | | | If a file on one side of history was renamed, and merely modified on the other side, then applying a directory rename to the modified side gives us a rename/rename(1to2) conflict. We should only apply directory renames to pairs representing either adds or renames. Making this change means that a directory rename testcase that was previously reported as a rename/delete conflict will now be reported as a modify/delete conflict. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* directory rename detection: new testcases showcasing a pair of bugsElijah Newren2018-02-271-0/+296
| | | | | | | | | | | | | | | | Add a testcase showing spurious rename/rename(1to2) conflicts occurring due to directory rename detection. Also add a pair of testcases dealing with moving directory hierarchies around that were suggested by Stefan Beller as "food for thought" during his review of an earlier patch series, but which actually uncovered a bug. Round things out with a test that is a cross between the two testcases that showed existing bugs in order to make sure we aren't merely addressing problems in isolation but in general. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* merge-recursive: fix remaining directory rename + dirty overwrite casesElijah Newren2018-02-272-7/+26
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* merge-recursive: fix overwriting dirty files involved in renamesElijah Newren2018-02-277-24/+77
| | | | | | | | | | | | This fixes an issue that existed before my directory rename detection patches that affects both normal renames and renames implied by directory rename detection. Additional codepaths that only affect overwriting of dirty files that are involved in directory rename detection will be added in a subsequent commit. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* merge-recursive: avoid clobbering untracked files with directory renamesElijah Newren2018-02-272-5/+43
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* merge-recursive: apply necessary modifications for directory renamesElijah Newren2018-02-272-26/+211
| | | | | | | | | | This commit hooks together all the directory rename logic by making the necessary changes to the rename struct, it's dst_entry, and the diff_filepair under consideration. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* merge-recursive: when comparing files, don't include treesElijah Newren2018-02-141-6/+21
| | | | | | | | | | | | | | | | | | | get_renames() would look up stage data that already existed (populated in get_unmerged(), taken from whatever unpack_trees() created), and if it didn't exist, would call insert_stage_data() to create the necessary entry for the given file. The insert_stage_data() fallback becomes much more important for directory rename detection, because that creates a mechanism to have a file in the resulting merge that didn't exist on either side of history. However, insert_stage_data(), due to calling get_tree_entry() loaded up trees as readily as files. We aren't interested in comparing trees to files; the D/F conflict handling is done elsewhere. This code is just concerned with what entries existed for a given path on the different sides of the merge, so create a get_tree_entry_if_blob() helper function and use it. Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* merge-recursive: check for file level conflicts then get new nameElijah Newren2018-02-144-9/+199
| | | | | | | | | | | 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>
* merge-recursive: add computation of collisions due to dir rename & mergingElijah Newren2018-02-142-3/+150
| | | | | | | | | | | 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>
* merge-recursive: check for directory level conflictsElijah Newren2018-02-141-0/+119
| | | | | | | | | | | 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>
* merge-recursive: add get_directory_renames()Elijah Newren2018-02-142-3/+239
| | | | | | | | | | | | | | | | 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>
* merge-recursive: make a helper function for cleanup for handle_renamesElijah Newren2018-02-141-10/+13
| | | | | | | | | | | | 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>
* merge-recursive: split out code for determining diff_filepairsElijah Newren2018-02-141-22/+62
| | | | | | | | | | | 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>
* merge-recursive: make !o->detect_rename codepath more obviousElijah Newren2018-02-141-2/+9
| | | | | | | | | | | 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>
* merge-recursive: fix leaks of allocated renames and diff_filepairsElijah Newren2018-02-141-5/+15
| | | | | | | | | | | | 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>
* merge-recursive: introduce new functions to handle rename logicElijah Newren2018-02-141-10/+33
| | | | | | | | | | | | | | | | | | | | 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>
* merge-recursive: move the get_renames() functionElijah Newren2018-02-141-69/+70
| | | | | | | | | | | 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>
* directory rename detection: tests for handling overwriting dirty filesElijah Newren2018-02-141-0/+458
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* directory rename detection: tests for handling overwriting untracked filesElijah Newren2018-02-141-0/+367
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* directory rename detection: miscellaneous testcases to complete coverageElijah Newren2018-02-141-1/+564
| | | | | | | | | | | | 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>
* directory rename detection: testcases exploring possibly suboptimal mergesElijah Newren2018-02-141-0/+404
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* directory rename detection: more involved edge/corner testcasesElijah Newren2018-02-141-0/+396
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* directory rename detection: testcases checking which side did the renameElijah Newren2018-02-141-0/+336
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* directory rename detection: files/directories in the way of some renamesElijah Newren2018-02-141-0/+330
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* directory rename detection: partially renamed directory testcase/discussionElijah Newren2018-02-141-0/+115
| | | | | | | | | 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>
* directory rename detection: testcases to avoid taking detection too farElijah Newren2018-02-141-0/+153
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* directory rename detection: directory splitting testcasesElijah Newren2018-02-141-0/+143
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* directory rename detection: basic testcasesElijah Newren2018-02-141-0/+442
| | | | | | Reviewed-by: Stefan Beller <sbeller@google.com> Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
* merge-recursive: add explanation for src_entry and dst_entryen/merge-recursive-fixesElijah Newren2018-01-191-0/+19
| | | | | | | | | | | 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>
* merge-recursive: fix logic ordering issueElijah Newren2018-01-191-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* Tighten and correct a few testcases for merging and cherry-pickingElijah Newren2018-01-192-3/+9
| | | | | | | | | | | | | | | | | | | | | | | 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>
* Git 2.16v2.16.0Junio C Hamano2018-01-172-3/+6
| | | | Signed-off-by: Junio C Hamano <gitster@pobox.com>
* Merge tag 'l10n-2.16.0-rnd2' of git://github.com/git-l10n/git-poJunio C Hamano2018-01-1612-20028/+22202
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ...
| * l10n: de.po: translate 72 new messagesRalf Thielow2018-01-151-1934/+2172
| | | | | | | | | | | | | | | | | | 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>
| * l10n: de.po: improve messages when a branch starts to track another refRalf Thielow2018-01-151-8/+8
| | | | | | | | Signed-off-by: Ralf Thielow <ralf.thielow@gmail.com>
| * l10n: bg.po: Updated Bulgarian translation (3288t)Alexander Shopov2018-01-111-181/+203
| | | | | | | | Signed-off-by: Alexander Shopov <ash@kambanaria.org>
| * l10n: TEAMS: add zh_CN team membersJiang Xin2018-01-101-0/+1
| | | | | | | | | | | | Add Fangyi Zhou to zh_CN l10n team members. Signed-off-by: Jiang Xin <worldhello.net@gmail.com>
| * l10n: zh_CN: for git v2.16.0 l10n round 2Jiang Xin2018-01-101-1920/+2144
| | | | | | | | | | | | | | | | 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>
| * Merge branch 'master' of git://github.com/nafmo/git-l10n-svJiang Xin2018-01-101-181/+197
| |\ | | | | | | | | | | | | * 'master' of git://github.com/nafmo/git-l10n-sv: l10n: sv.po: Update Swedish translation (3288t0f0u)
| | * l10n: sv.po: Update Swedish translation (3288t0f0u)Peter Krefting2018-01-091-181/+197
| | | | | | | | | | | | Signed-off-by: Peter Krefting <peter@softwolves.pp.se>
| * | Merge branch 'russian-l10n' of https://github.com/DJm00n/git-po-ruJiang Xin2018-01-101-1918/+2092
| |\ \ | | | | | | | | | | | | | | | | * 'russian-l10n' of https://github.com/DJm00n/git-po-ru: l10n: ru.po: update Russian translation
| | * | l10n: ru.po: update Russian translationDimitriy Ryazantcev2018-01-091-1918/+2092
| | |/ | | | | | | | | | Signed-off-by: Dimitriy Ryazantcev <dimitriy.ryazantcev@gmail.com>
| * | l10n: TEAMS: Add ko team membersChangwoo Ryu2018-01-091-0/+2
| |/ | | | | | | | | | | Add Gwan-gyeong Mun and Sihyeon Jang. Signed-off-by: Changwoo Ryu <cwryu@debian.org>
| * Merge branch 'ko/merge-l10n' of https://github.com/git-l10n-ko/git-l10n-koJiang Xin2018-01-092-1944/+2200
| |\ | | | | | | | | | | | | * 'ko/merge-l10n' of https://github.com/git-l10n-ko/git-l10n-ko: l10n: ko.po: Update Korean translation
| | * l10n: ko.po: Update Korean translationChangwoo Ryu2018-01-082-1944/+2200
| | | | | | | | | | | | | | | | | | | | | Signed-off-by: Changwoo Ryu <cwryu@debian.org> Signed-off-by: Sihyeon Jang <uneedsihyeon@gmail.com> Signed-off-by: Gwan-gyeong Mun <elongbug@gmail.com> Reviewed-by: Changwoo Ryu <cwryu@debian.org>
| * | Merge branch '2.16' of https://github.com/ChrisADR/git-poJiang Xin2018-01-081-181/+197
| |\ \ | | | | | | | | | | | | | | | | * '2.16' of https://github.com/ChrisADR/git-po: l10n: es.po: Spanish translation 2.16.0 round 2
| | * | l10n: es.po: Spanish translation 2.16.0 round 2Christopher Díaz Riveros2018-01-071-181/+197
| | |/ | | | | | | | | | Signed-off-by: Christopher Díaz Riveros <chrisadr@gentoo.org>
| * | Merge branch 'fr_2.16-rc1' of git://github.com/jnavila/gitJiang Xin2018-01-081-192/+225
| |\ \ | | | | | | | | | | | | | | | | * 'fr_2.16-rc1' of git://github.com/jnavila/git: l10n: fr.po 2.16 round 2
| | * | l10n: fr.po 2.16 round 2Jean-Noel Avila2018-01-071-192/+225
| | |/ | | | | | | | | | Signed-off-by: Jean-Noel Avila <jn.avila@free.fr>