Commit Briefs

Stefan Sperling

prevent useless EEXIST errors filling up the global custom error array

While checking out files, do not attempt to create every directory that exists in the repository tree without paying consideration to their existence on disk. Instead, let functions which add files worry about creating any missing parent directories. This shakes out two other bugs in broken symlink installation code which ended up passing an absolute path to add_dir_on_disk() and forgot to report progress in an unreachable code path that is now getting used. Problem reported by + ok naddy@


Josh Rickmar

Make got_worktree_get_base_ref_name static

Nothing appears to benefit from this being non-static, and it was missing from the public API headers as well. ok stsp@


Josh Rickmar

Define apply_umask earlier, without predeclaration

ok op@


Stefan Sperling

make 'got add' more forgiving about unversioned paths on the command line

When users run 'got add *' the shell may pick up already versioned files and trigger errors about paths being in an unexpected status. Expand the check which previously only allowed files in added status to be double-added to cover the following status codes which are all safe to ignore: A M C m This should make bulk additions of files a bit easier in most cases. Problem reported by robert@ ok jamsek


James Cook

Implement fast-forward merges.

Split part of got_worktree_merge_prepare into a new function, got_worktree_merge_write_refs, since that part doesn't make sense in the fast-forward case. ok stsp@


Stefan Sperling

make 'got merge -c' fail even if new changes only affect unrelated paths

Otherwise, 'got merge -c' can silently revert already committed changes. Also fix GOT_ERR_MERGE_COMMIT_OUT_OF_DATE by giving it a value distinct from GOT_ERR_MERGE_STAGED_PATHS. Patch by James Cook


Stefan Sperling

only delete empty directories appearing in arguments to 'got rm'

Make 'got rm' keep empty directories which are not explicitly listed for deletion. Deleting such directories is problematic in several use cases. Avoids deleting the current working directory when the user runs "got rm *" (pointed out by Mikhail), and avoids deletion of an empty directory "foo/" after 'got rm foo/a foo/b' (pointed out by op@). ok jamsek, op


Stefan Sperling

allow no-op merge commits to be created

Requested by James Cook


Stefan Sperling

fix 'got commit' using a bad parent commit ID when worktree is out-of-date

Problem reported by James Cook with reproduction scripts Regression test case by jamsek, as a simplified version of James' scripts fix tested + ok jamsek


Stefan Sperling

when aborting rebase/histedit/merge, unlink files added by merged changes

Otherwise we leave unversioned files behind in the work tree which may interfere with new attempts to rebase or merge the changes again. Problem found by + ok naddy@


Stefan Sperling

style nits from op@, thanks!


Stefan Sperling

make 'got revert' and 'got rm' work on non-existent directories

problem found by robert@ ok jamsek, op


Stefan Sperling

fix rebase/histedit -a leaving some files on the temporary branch

The commands 'got rebase -a' and 'got histedit -a' were checking out files from the wrong commit. Make them check files out from the commit we are switching the work tree to, as intended. Avoids spurious merge conflicts when the work tree is later used for another rebase operation. It also makes 'got update' right after 'rebase -a' a no-op, as it should be. Problem found by naddy@ while rebasing jca's llvm15 branch ok op, jamsek earlier version


Stefan Sperling

update the base commit ID of unmodified files if the blob ID matches

This avoids having to run 'got update' after operations which run checkout_files() and where a file happens to have the same blob ID but its base commit differs from the commit we are updating to. Found while investigating a bug report by naddy@ ok op, jamsek (earlier version)


Stefan Sperling

handle files changing into directories during 'got update'

problem found by naddy@


Stefan Sperling

support histedit fold operations which delete a file and then add it again

problem found by naddy@ ok op@


Omar Polo

rename lib/sha1.c to lib/hash.c

It will soon grow functions to deal with sha256 too. stsp@ agrees.


Omar Polo

include sha2.h too where sha1.h is included

In preparation for wide sha256 support; stsp@ agrees. Change done mechanically with find . -iname \*.[cy] -exec sam {} + X ,x/<sha1\.h>/i/\n#include <sha2.h>


Mark Jamsek

use newly publicised diff_chunk_type() diff API

To skip chunks without newly added lines. ok stsp@


Stefan Sperling

have ignore patterns with trailing slashes match directories only

ok jamsek



Mark Jamsek

use chunk offset to efficiently detect conflict markers

Rather than skip lines, use the new diff APIs to directly seek to each chunk with newly added lines for more efficient conflict marker detection. ok stsp@


Mark Jamsek

optimise parsing of modified files for conflict markers

As per stsp's original design for detecting new conflicts, rather than produce a diff formatted for human consumption, parse the raw diff result to scan only newly added lines for conflict markers. While here, fix a couple related bugs in the original implementation: (1) rewind the versioned file blob so we don't end up with an empty "from" (i.e., LHS of the diff) file; and (2) force an ASCII text diff for so we don't miss conflicts in binary files. ok stsp@


Mark Jamsek

add ci/he/mg/rb -C option to commit unresolved conflicts

As per stsp's suggestion and building on his initial diff, add the -C option to enable creating commits with unresolved conflicts to the commit, histedit, merge, and rebase commands to allow continuing the operation despite files in conflict status. Also, only search for conflict markers in newly added lines to enable working with files already under version control that may have conflict markers embedded verbatim. lots of tweaks, improvements, and initial diff + ok stsp@