lib/worktree.c


Log

Author Commit Date CI Message
Christian Weisgerber abc59930 2021-09-05T19:41:03 indentation fixes
Stefan Sperling 69de9dd4 2021-09-03T09:02:06 limit checks for merge conflicts to files affected by the merge Performance problems reported by naddy
Stefan Sperling 5546d466 2021-09-02T19:39:14 plug a memory leak in check_merge_ok()
Stefan Sperling 243a13f5 2021-09-02T19:13:50 fix bogus error when 'got cherrypick' merges changes into a locally added file reported by + ok naddy
Stefan Sperling 6c13b005 2021-09-02T13:57:34 Update comment regarding the merged_paths list used by rebase and histedit with insight I obtained while trying to make this idea work, and failing...
Stefan Sperling dae2a678 2021-09-01T20:31:46 backout 7280143edc2d689b1f57d5a46d376e48cdae64a2; not needed after all
Stefan Sperling 0e33f8e0 2021-09-01T14:34:33 disable ignore lists during status walks used by rebase and histedit Fixes rebase of gotwebd branch which added a new directory which is also matched by .gitignore rules on the branch.
Stefan Sperling 7280143e 2021-09-01T11:56:31 refactor collect_commitables() to make it easier to call from elsewhere later
Stefan Sperling ff56836b 2021-07-08T10:30:10 Make 'got add' always require the -I option in order to add ignored files.
Stefan Sperling 2c41dce7 2021-06-27T15:30:08 allow obstructed files skipped by 'got update' to be updated again
Stefan Sperling a769b60b 2021-06-27T09:22:52 fix a bug where files skipped by 'got update' could not be updated again ok semarie@
Christian Weisgerber dbdddfee 2021-06-23T20:48:35 switch from SIMPLEQ to equivalent STAILQ macros The singly-linked tail queue macros were added to OpenBSD 6.9 and are more widely available on other systems. ok stsp
Stefan Sperling f6343036 2021-06-22T20:00:44 new -I option for 'got status' to show files which match an ignore pattern
Stefan Sperling 1c4cdd89 2021-06-20T21:07:54 fix bogus 'permission denied' error when a file at work tree root is removed ok naddy
Stefan Sperling fdf3c2d3 2021-06-17T09:01:05 use Patience diff for merging during cherrypick/backout/histedit/rebase This has been shown to prevent mis-merges in some cases. It's probably not a final solution. We should look at what Git's "recursive merge" is doing and implement something similar. Keep using Myers during update/unstage. The advantage of Myers is that it produces smaller conflict chunks, and there are no known cases of mis-merges which affect update/unstage.
Stefan Sperling 1d0f4054 2021-06-17T08:56:43 check for close(2) error in got_repo_close() and propagate errors up ok tracey
Stefan Sperling 54d5be07 2021-06-03T13:12:58 fix unrelated changes being merged by got cherrypick/backout/rebase/histedit This was a long-standing and very annoying bug. The two xfail tests in the cherrypick test suite are passing now.
Stefan Sperling 1af628f4 2021-06-03T12:38:42 switch merge_file_cb() to using merge_file() instead of merge_blob()
Stefan Sperling eec2f5a9 2021-06-03T12:14:35 decouple merge_file() parameters for 2nd derived version and merge target file
Stefan Sperling dc082d4a 2021-06-03T11:57:58 in merge_file(), remove allocation of a base_path which is unused
Stefan Sperling 07bb0f93 2021-06-02T09:26:42 move merge_file()'s f_deriv parameter next to the f_orig parameter
Stefan Sperling db590691 2021-06-02T09:24:51 make merge_file() accept FILEs instead of paths for orig and deriv inputs
Stefan Sperling 67a66647 2021-05-31T09:20:56 refactor merge_file() such that it no longer requires a blob object parameter
Stefan Sperling c6e8a826 2021-04-05T17:55:12 do not update symlinks which are already up-to-date This fixes spurious 'U' notifications for symlinks during 'got update' that occurred even when the work tree was fully up-to-date. Observed on a work tree of the FreeBSD src repo and reproduced in our test suite by adding a no-op update at the end of a test which deals with updating symlinks.
Stefan Sperling 0f58026f 2021-04-05T17:51:07 add a missing STATUS_EXISTS notification in update_blob()
Stefan Sperling 4cc1f028 2021-03-23T15:01:29 fix use of an uninitialized stat buffer during work tree status crawl found by naddy ok naddy jrick
Stefan Sperling e600f124 2021-03-21T19:09:35 ensure that old commits remain referenced after rebase and histedit Create automatic "backup" references which ensure that objects from the pre-rebase or pre-histedit state remain in the repository. A new -l option for 'got rebase' and 'got histedit' lists old commits. This makes it easier to recover from botched rebase or histedit operations. Removal of such objects currently requires got ref -d and git-gc. This will be made more convenient in the future. testing and ok jrick
Stefan Sperling 6e210706 2021-01-22T23:49:46 implicitly mark all files in work tree as up-to-date after 'got integrate' Avoids having to run 'got update' for no good reason after 'got integrate'. The same change was made recently for both rebase and histedit in commit a615e0e7796ea1103a6e0d4b5dbb6134597886660 and we forgot about histedit.
Stefan Sperling 60e40e95 2021-01-22T21:53:05 close file handles before freeing other things in got_worktree_close() The work tree's path needs to be valid while constructing error messages.
Stefan Sperling e7abd6b6 2021-01-22T21:47:37 fix missing close(2) error check in got_worktree_close()
Stefan Sperling 08578a35 2021-01-22T11:05:05 make close(2) failure checks consistent; check 'close() == -1' everywhere ok millert, naddy
Stefan Sperling 56b63ca4 2021-01-22T11:04:47 make fclose(3) failure checks consistent; check 'fclose() == EOF' everywhere ok millert, naddy
Stefan Sperling a6b21eef 2021-01-21T19:10:08 add missing braces around multi-line if-statement in got_worktree_close()
Christian Weisgerber a06ff56f 2021-01-21T18:33:50 fix a use after free() ok jrick stsp
Christian Weisgerber 9bdd68dd 2021-01-02T20:46:01 replace fparseln(3) with getline(3), for better portability ok stsp
Stefan Sperling a615e0e7 2020-12-16T00:08:58 implicitly mark all files in work tree as up-to-date after rebase/histedit This should always be correct, since rebase and histedit start out with a clean and single-base-commit worktree, and end up committing all changes across the entire work tree when they are successful. tested by jrick and myself
Yang Zhong 437adc9d 2020-12-10T08:29:04 add fd field to got_worktree, modify got_fileindex_entry_update to use fds These changes are intended to make got more compatible with FreeBSD's Capsicum. ok stsp
Stefan Sperling 64453f7e 2020-11-21T13:35:00 handle binary files in got/tog diff commands; add -a options to force text
Stefan Sperling fe621944 2020-11-10T22:54:37 merge new diff implementation from the git.gameoftrees.org diff.git repository This new diff implementation was started by Neels Hofmeyr during the u2k20 hackathon and now replaces diffreg.c code lifted from the OpenBSD base system. The integration of this code into Got was done by me. Got now uses the patience diff algorithm by default. The diff.git repository will remain the primary repository for the diff code, which already compiles and runs on other operating systems such as Linux. Any fixes and improvements for files inherited from the diff.git repository should be written against that repository and synced to got.git afterwards.
Stefan Sperling f6d8c0ac 2020-11-09T16:04:18 fix replacing symlinks with files And add a test case which verifies that the inverse also works, i.e. a symlink being replaced with a regular file. problem reported and fix tested by jrick
Stefan Sperling 63df146d 2020-11-09T16:03:35 fix missing unlink(tmppath) in error cases of install_blob()
Stefan Sperling 2ac8aa02 2020-11-09T16:02:12 clear staged file type in file index entries whenever staged status is cleared
Stefan Sperling 727173c3 2020-11-06T00:20:05 initialize sb.st_mode after stat(2) failure in got_worktree_resolve_path()
Stefan Sperling 01740607 2020-11-04T20:18:53 avoid got_repo_map_path() in 'got blame' 'got blame' does not need access to the work tree. So far the work tree was completely hidden with unveil(). We must now expose the work tree while resolving the path, so unveil() calls are shuffled around slightly. Failing realpath() calls would mess with path resolution otherwise. There's a bug in got_worktree_resolve_path() where it failed to canonicalize a path constructed from a user-specified path that does not exist on disk. Note that this path falls into strncmp() a few lines down. I am fixing this by adding canonicalization. Generally, joining paths with asprintf() and comparing paths with strncmp() is fragile. A more general solution might be needed but I am leaving that for another day. ok naddy
Christian Weisgerber 3818e3c4 2020-11-01T16:28:46 convert all remaining instances of chmod(2) to fchmod(2) ok stsp
Christian Weisgerber 62d463ca 2020-10-20T22:43:59 indentation fixes
Stefan Sperling 2513f20a 2020-10-20T21:09:01 plug memory leaks in error paths; found by naddy
Stefan Sperling 20a2ad1c 2020-10-20T21:09:01 use got_path_dirname() in schedule_for_deletion(); avoids const dirname(3) ok naddy
Stefan Sperling fddefe3b 2020-10-20T21:09:01 use got_path_dirname() in remove_ondisk_file(); avoids const dirname(3) ok naddy
Stefan Sperling f5375317 2020-10-20T21:09:01 use got_path_dirname() in install_blob() to avoid const dirname(3) ok naddy
Stefan Sperling f4994adc 2020-10-20T21:09:01 use got_path_dirname() in install_symlink() to avoid const dirname(3) ok naddy
Stefan Sperling ce031e9e 2020-10-20T21:09:01 use got_path_dirname() in is_bad_symlink_target() ok naddy
Stefan Sperling ed6b5030 2020-10-20T21:09:01 use got_path_dirname() in merge_blob() instead of assuming const dirname(3) ok naddy
Stefan Sperling 3524bbf9 2020-10-20T21:09:01 make merge_file() use got_path_dirname() instead of assuming const dirname(3) ok naddy
Stefan Sperling aedea96d 2020-10-20T21:09:01 adapt got_open_worktree to non-const dirname(3) ok naddy
Stefan Sperling d34b633e 2020-10-19T23:14:59 use got_path_basename() in match_deleted_or_modified_ct() ok millert
Stefan Sperling 102b254e 2020-10-19T23:14:59 switch to got_path_basename() in alloc_added_blob_tree_entry() ok millert
Stefan Sperling 1233e6b6 2020-10-19T23:14:59 switch to got_path_basename in revert_file ok millert
Stefan Sperling 4a26d3f8 2020-10-07T22:37:48 fix a bug where 'got status' showed an unchanged empty file as changed
Stefan Sperling 0a22ca1a 2020-09-23T22:31:00 make 'got histedit' collapse folded add+delete operations into a no-op If a merged commit wants to delete a locally added file, and this locally added file matches the content which was deleted in the commit being merged, we can go ahead with the deletion because there is no risk of data loss. fixes the histedit problem reported by jrick on freenode
Stefan Sperling 50b0790e 2020-09-11T17:04:57 add per-worktree got.conf(5) file in the .got directory; ok millert
Christian Weisgerber 0823ffc2 2020-09-10T20:44:40 use modern POSIX timestamp fields in struct stat ok stsp
Stefan Sperling 766841c2 2020-08-13T19:12:57 add -s option to 'got remove' which deletes files in a particular status This makes it easy to deal with files that were deleted from disk by external tooling which modified the work tree. Such files are left in missing (!) status and can now be marked for deletion in bulk via 'got rm -s\! -R .' For consistency, modified (M) files can now be removed with 'got rm -s M' which implies 'got rm -f'. Prompted by feedback from krw@
Stefan Sperling f2b0a8b0 2020-07-31T12:54:34 fix committing file additions from a work tree with a path prefix New files were added under the wrong tree in the repository if the work tree has a path prefix. Fix this problem and catch it in the existing commit_with_path_prefix regression test.
Stefan Sperling 69d57f3d 2020-07-31T11:19:29 fix spurious 'got cherrypick' error with a path prefix and an empty tree If the work tree's path prefix does not exist in the first of the two trees, then 'got cherrypick' failed with "no such entry found in tree". But this is a legitimate situation, as shown in the new test added here. The first tree could be the empty tree, for example, which should result in 'got cherrypick' adding all files from the second tree instead of complaining about a non-existent path-prefix directory in the first tree.
Stefan Sperling b66cd6f3 2020-07-31T10:33:34 display more context info in "no such entry found in tree" error messages
Stefan Sperling b2118c49 2020-07-28T20:17:19 Add a 'got info' command which displays work tree meta-data. Remove the alias 'got in' for 'got init'. The 'in' alias was too close to either 'init' or 'info'. ok tracey, millert
Stefan Sperling 283102fc 2020-07-23T14:22:41 remove the symlink conflict header feature; it causes noise for little benefit
Stefan Sperling f9eec9d5 2020-07-23T14:22:40 rename get_symlink_status() to get_symlink_modification_status() for clarity
Stefan Sperling f179e66d 2020-07-23T14:22:40 use a shortcut in get_file_status() for detecting symlinks appearing on disk
Stefan Sperling fda8017d 2020-07-23T14:22:40 move deeply indented code from unstage_path() to a new unstage_hunks() helper
Stefan Sperling 36bf999c 2020-07-23T14:22:40 make 'got unstage -p' work with symlinks
Stefan Sperling dfe9fba0 2020-07-23T14:22:40 remove merge_blob() fallback from merge_symlink(); let callers handle this
Stefan Sperling 75f0a0fb 2020-07-23T14:22:39 stop reinstalling symlinks after commit; 'got update' can handle that
Stefan Sperling 35213c7c 2020-07-23T14:22:39 forbid bad symlinks; add -S option to 'got commit' and 'got stage' to allow them
Stefan Sperling 3c1ec782 2020-07-23T14:22:38 put checks for bad symlink target paths into a dedicated function
Stefan Sperling ea7786be 2020-07-23T14:22:38 make 'got unstage' work with symlinks
Stefan Sperling b7422a2f 2020-07-23T14:22:38 stop using realpath(3) to resolve a symlink target in install_symlink() We should not resolve a symlink target path recursively when installing a symlink in the work tree. We want to handle this symlink's target, not the end result of following a chain of symlinks in case such links already exist.
Stefan Sperling 369fd7e5 2020-07-23T14:22:38 add support for symlinks to 'got revert -p'
Stefan Sperling fa3cef63 2020-07-23T14:22:37 make 'got stage -p' work with symlinks
Stefan Sperling b448fd00 2020-07-23T14:22:37 fix wrong function name in an error message
Stefan Sperling 0aeb8099 2020-07-23T14:22:37 set a staged file type and handle it separately from the on-disk file type
Stefan Sperling c631b115 2020-07-23T14:22:36 make staging of symlinks work
Stefan Sperling 6131ab45 2020-07-23T14:22:36 remove pointless error checking in got_fileindex_entry_filetype_set()
Stefan Sperling 6e1eade5 2020-07-23T14:22:35 fix 'got revert' progress output for symlinks
Stefan Sperling 3b9f0f87 2020-07-23T14:22:35 handle additional symlink conflicts and report skipping of unversioned files
Stefan Sperling c90c8ce3 2020-07-23T14:22:35 preserve unversioned files when merging added symlinks
Stefan Sperling 65b05cec 2020-07-23T14:22:35 add an output argument to create_fileindex_entry() Avoids a pointless search of the file index in the case the caller needs to use the newly created file entry.
Stefan Sperling 2e1fa222 2020-07-23T14:22:34 give bad symlinks a dedicated file type in the file index
Stefan Sperling b88d214a 2020-07-23T14:22:34 use default file permissions when installing "bad" symlinks
Stefan Sperling 960094b4 2020-07-23T14:22:34 resolve an XXX remark in merge_file_cb()
Stefan Sperling d219f183 2020-07-23T14:22:34 test_cherrypick_symlink_conflicts forgot to run 'got add' on a file; fix this
Stefan Sperling 993e2a1b 2020-07-23T14:21:31 handle symlink deletion and symlink conflicts during 'got update'
Stefan Sperling 56d815a9 2020-07-23T14:21:31 We must null-terminate the result of readlink(3) in merge_symlink().
Stefan Sperling 11cc08c1 2020-07-23T14:21:31 handle symlink conflicts by installing a file that contains conflict markers
Stefan Sperling 526a746f 2020-07-23T14:21:31 handle newly added symlinks during 'got cherrypick'
Stefan Sperling 5a1fbc73 2020-07-23T14:21:30 make it possible to fix "bad" symlinks with ln -sfh + got commit + got update
Stefan Sperling bd6aa359 2020-07-23T14:21:30 convert bad symlinks to regular files during 'got commit'
Stefan Sperling 3d9a4ec4 2020-07-23T14:21:30 add symlink support to 'got commit'
Stefan Sperling af57b12a 2020-07-23T14:21:30 add symlink support to 'got cherrypick'; test non-conflict cases only for now