- 23 May, 2013 2 commits
-
-
This adds a couple more tests of different rename scenarios. Also, this fixes a problem with the case where you have two "split" deltas and the left half of one matches the right half of the other. That case was already being handled, but in the wrong order in a way that could result in bad output. Also, if the swap also happened to put the other two halves into the correct place (i.e. two files exchanged places with each other), then the second delta was left with the SPLIT flag set when it really should be cleared.
Russell Belfer committed -
I was accidentally using a value that I had just freed. This moves the clearing of the delta internal flags into a better place.
Russell Belfer committed
-
- 22 May, 2013 1 commit
-
-
This flips rename detection around so instead of creating a forward mapping from deltas to possible rename targets, instead it creates a reverse mapping, looking at possible targets and trying to find a source that they could have been renamed or copied from. This is important because each output can only have a single source, but a given source could map to multiple outputs (in the form of COPIED records). Additionally, this makes a couple of tweaks to the public rename detection APIs, mostly renaming a couple of options that control the behavior to make more sense and to be more like core Git. I walked through the tests looking at the exact results and updated the expectations based on what I saw. The new code is different from the old because it cannot give some nonsense results (like A was renamed to both B and C) which were part of the outputs previously.
Russell Belfer committed
-
- 20 May, 2013 2 commits
-
-
This adds a bunch more rename detection tests including checks vs the working directory, the new exact match options, some more whitespace variants, etc. This also adds a git_futils_writebuffer helper function and uses it in checkout. This is mainly added because I wanted an easy way to write out a git_buf to disk inside my test code.
Russell Belfer committed -
- Add new GIT_DIFF_FIND_EXACT_MATCH_ONLY flag to do similarity matching without using the similarity metric (i.e. only compare the SHA). - Clean up the similarity measurement code to more rigorously distinguish between files that are not similar and files that are not comparable (previously, a 0 could either mean that the files could not be compared or that they were totally different) - When splitting a MODIFIED file into a DELETE/ADD pair, actually make a DELETED/UNTRACKED pair if the right side of the diff is from the working directory. This prevents an odd mix of ADDED and UNTRACKED files on workdir diffs.
Russell Belfer committed
-
- 18 May, 2013 2 commits
-
-
Add --raw output format and (some) options to invoke rename/copy detection on the diff.
Russell Belfer committed -
There are a number of bugs in the rename code that only were obvious when I started testing it against large old repos with more complex patterns. (The code to do that testing is not ready to merge with libgit2, but I do plan to add more thorough tests.) This contains a significant number of changes and also tweaks the public API slightly to make emulating core git easier. Most notably, this separates the GIT_DIFF_FIND_AND_BREAK_REWRITES flag into FIND_REWRITES (which adds a self-similarity score to every modified file) and BREAK_REWRITES (which splits the modified deltas into add/remove pairs in the diff list). When you do a raw output of core git, rewrites show up as M090 or such, not at A and D output, so I wanted to be able to emulate that. Publicly, this also changes the flags to be uint16_t since we don't need values out of that range. Internally, this contains significant changes from a number of small bug fixes (like using the wrong side of the diff to decide if the object could be found in the ODB vs the workdir) to larger issues about which files can and should be compared and how the various edge cases of similarity scores should be treated. Honestly, I don't think this is the last update that will have to be made to this code, but I think this moves us closer to correct behavior and I tried to document the code so it would be easier to follow..
Russell Belfer committed
-
- 17 May, 2013 3 commits
-
-
The delta cmp function needs to choose the correct path for ordering when a delta is ADDED, RENAMED, or COPIED.
Russell Belfer committed -
Makes it easier to emulate the --raw option
Russell Belfer committed -
I frequently want to the the first N digits of an OID formatted as a string and I'd like it to be efficient. This function makes that easy and I could rewrite the OID formatters in terms of it.
Russell Belfer committed
-
- 16 May, 2013 8 commits
-
-
Add cat-file to examples (with some public API improvements)
Vicent Martí committed -
Ensure reuc vector is always valid
Vicent Martí committed -
In theory, if there was a problem reading the REUC data, the read_reuc() routine could have left uninitialized and invalid data in the git_index vector. This moves the line that inserts a new entry into the vector down to the bottom of the routine so we know all the content is already valid. Also, per @linquize, this uses calloc to ensure no uninitialized data.
Russell Belfer committed -
Use calloc() for safety
Russell Belfer committed -
Russell Belfer committed
-
This adds an example implementation that emulates git cat-file. It is a convenient and relatively simple example of getting data out of a repository. Implementing this also revealed that there are a number of APIs that are still not using const pointers to objects that really ought to be. The main cause of this is that `git_vector_bsearch` may need to call `git_vector_sort` before doing the search, so a const pointer to the vector is not allowed. However, for tree objects, with a little care, we can ensure that the vector of tree entries is always sorted and allow lookups to take a const pointer. Also, the missing const in commit objects just looks like an oversight.
Russell Belfer committed -
Linquize committed
-
Fetch should not fail when remote HEAD reference is not present locally
Vicent Martí committed
-
- 15 May, 2013 17 commits
-
-
Index entry dup and free
Vicent Martí committed -
Move the git_index_entry to the very top, since it provides the main structure that needs to be understood by the reader, then move the bitmasks for the flags and the flags_extended under that since they are details for looking at particular fields of the structure.
Russell Belfer committed -
This removes the functions to duplicate and free copies of a git_index_entry and updates the comments to explain that you should just use the public definition of the struct as needed.
Russell Belfer committed -
This adds git_index_entry_dup to make a copy of an existing entry and git_index_entry_free to release the memory of the copy. It also updates the documentation for git_index_get_bypath and git_index_get_byindex to make it clear that the returned structure should *not* be modified.
Russell Belfer committed -
The constants for extracting data from git_index_entry flags and flags_extended are not named in a way that makes it easy to know where to use each one. This improves the docs for the flags (and slightly reorganizes them), so it should be more obvious.
Russell Belfer committed -
Bug fixes for checkout and diff
Vicent Martí committed -
Fix trailing whitespaces
Vicent Martí committed -
Since I added the GIT_IDXENTRY_STAGE macro to extract the stage from a git_index_entry, we probably don't need an internal inline function to do the same thing.
Russell Belfer committed -
Under some strange circumstances, diffs can end up listing files that we can't actually open successfully. Instead of aborting the git_diff_find_similar, this makes it so that those files just won't be considered as valid rename/copy targets instead.
Russell Belfer committed -
It is possible for there to be a submodule in a repository with no .gitmodules file (for example, if the user forgot to commit the .gitmodules file). In this case, core Git will just create an empty directory as a placeholder for the submodule but otherwise ignore it. We were generating an error and stopping the checkout. This makes our behavior match that of core git.
Russell Belfer committed -
Unlike blob updates, symlink updates cannot be done "in place" writing over an old symlink. This means that in checkout when we realize that we can safely update a symlink, we still need to remove the old one before writing the new.
Russell Belfer committed -
When the last item in a diff was an untracked directory that only contained ignored items, the loop to scan the contents would run off the end of the iterator and dereference a NULL pointer. This includes a test that reproduces the problem and a fix.
Russell Belfer committed -
nulltoken committed
-
Jameson Miller committed
-
Vicent Marti committed
-
Unify whitespaces to tabs
Vicent Martí committed -
Linquize committed
-
- 14 May, 2013 5 commits
-
-
Russell Belfer committed
-
CMake: vendor strings
Russell Belfer committed -
Create directory for symlink before creating symlink
Russell Belfer committed -
Fix some memory leaks
Russell Belfer committed -
This helps us install multiple versions of the library side-by-side.
Carlos Martín Nieto committed
-