Commit Graph

91 Commits

Author SHA1 Message Date
nulltoken
24cb87e2a6 tag: Fix parsing when no tagger nor message 2013-03-31 14:36:51 +02:00
Sven Strickroth
b8acb775e2 Added some tests for issue #1397
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2013-03-25 14:03:16 -07:00
Russell Belfer
65025cb893 Three submodule status bug fixes
1. Fix sort order problem with submodules where "mod" was sorting
   after "mod-plus" because they were being sorted as "mod/" and
   "mod-plus/".  This involved pushing the "contains a .git entry"
   test significantly lower in the stack.
2. Reinstate behavior that a directory which contains a .git entry
   will be treated as a submodule during iteration even if it is
   not yet added to the .gitmodules.
3. Now that any directory containing .git is reported as submodule,
   we have to be more careful checking for GIT_EEXISTS when we
   do a submodule lookup, because that is the error code that is
   returned by git_submodule_lookup when you try to look up a
   directory containing .git that has no record in gitmodules or
   the index.
2013-03-18 17:24:13 -07:00
Russell Belfer
169dc61607 Make iterator APIs consistent with standards
The iterator APIs are not currently consistent with the parameter
ordering of the rest of the codebase.  This rearranges the order
of parameters, simplifies the naming of a number of functions, and
makes somewhat better use of macros internally to clean up the
iterator code.

This also expands the test coverage of iterator functionality,
making sure that case sensitive range-limited iteration works
correctly.
2013-03-06 16:52:01 -08:00
Vicent Martí
b72f5d4038 Merge pull request #1369 from arrbee/repo-init-template-hooks
More tests (and fixes) for initializing repo from template
2013-03-05 15:35:28 -08:00
Vicent Martí
e68e33f33d Merge pull request #1233 from arrbee/file-similarity-metric
Add file similarity scoring to diff rename/copy detection
2013-02-27 14:50:32 -08:00
Russell Belfer
3c42e4ef74 Fix initialization of repo directories
When PR #1359 removed the hooks from the test resources/template
directory, it made me realize that the tests for
git_repository_init_ext using templates must be pretty shabby
because we could not have been testing if the hooks were getting
created correctly.

So, this started with me recreating a couple of hooks, including
a sample and symlink, and adding tests that they got created
correctly in the various circumstances, including with the SHARED
modes, etc.  Unfortunately this uncovered some issues with how
directories and symlinks were copied and chmod'ed.  Also, there
was a FIXME in the code related to the chmod behavior as well.

Going back over the directory creation logic for setting up a
repository, I found it was a little difficult to read and could
result in creating and/or chmod'ing directories that the user
almost certainly didn't intend.

So that let to this work which makes repo initialization much
more careful (and hopefully easier to follow).  It required a
couple of extensions / changes to core fileops utilities, but I
also think those are for the better, at least for git_futils_cp_r
in terms of being careful about what actions it takes.
2013-02-26 11:43:14 -08:00
Martin Woodward
fc6c5b5001 Remove sample hook files
Getting rid of sample hook files from test repos as they just take up
space with no value.
2013-02-25 17:03:05 +00:00
Russell Belfer
d4b747c1cb Add diff rename tests with partial similarity
This adds some new tests that actually exercise the similarity
metric between files to detect renames, copies, and split modified
files that are too heavily modified.

There is still more testing to do - these tests are just partially
covering the cases.

There is also one bug fix in this where a change set with only
MODIFY being broken into ADD/DELETE (due to low self-similarity)
without any additional RENAMED entries would end up not processing
the split requests (because the num_rewrites counter got reset).
2013-02-21 16:44:44 -08:00
Vicent Martí
fcd7733ded Merge pull request #1318 from nulltoken/topic/diff-tree-coverage
Topic/diff tree coverage
2013-02-14 12:49:46 -08:00
Russell Belfer
c2c0874de2 More diff tests with binary data 2013-02-11 14:45:46 -08:00
nulltoken
f093cd62c4 Add unsymlinked.git test repository 2013-02-06 16:03:06 +01:00
Scott J. Goldman
cb35094be3 Allow peeled references without trailing newline at end of file
Also ammends one of the tag tests to make sure it's working.
2013-01-22 15:49:51 -08:00
Edward Thomson
271680d7f4 add a git config, don't run crlf tests on non-win32 2013-01-17 18:18:44 -06:00
Edward Thomson
6e959708e5 cache should contain on-disk (filtered) file size 2013-01-17 15:17:32 -06:00
Sebastian Bauer
72719e7333 Altered the description of the template.
Before, it was identical to the default template making it difficult
to check, if the proper template was copied an external template
test.
2013-01-13 12:26:52 +01:00
Philip Kelley
359316b5d3 Merge pull request #1215 from phkelley/binaryunicode
Add a failing test for CRLF filters
2013-01-11 17:16:55 -08:00
Philip Kelley
dd6367e37e Fix up binaryunicode test repo 2013-01-11 20:07:52 -05:00
Philip Kelley
fcc48d1fce Add a failing test for autocrlf filters 2013-01-09 12:37:22 -05:00
Michael Schubert
abeefbbe18 push: properly handle tags
Currently, push doesn't really handle tags when queueing objects. Fix
it.
2013-01-09 17:05:21 +01:00
Carlos Martín Nieto
f1c75b94a1 tree: relax the filemode parser
There are many different broken filemodes in the wild so we need to
protect against them and give something useful up the chain. Don't
fail when reading a tree from the ODB but normalize the mode as best
we can.

As 664 is no longer a mode that we consider to be valid and gets
normalized to 644, we can stop accepting it in the treebuilder. The
library won't expose it to the user, so any invalid modes are a bug.
2012-12-07 16:59:18 +01:00
Russell Belfer
f684970a10 Merge pull request #1108 from libgit2/ahead-behind-count
Add API to calculate ahead/behind count
2012-11-29 22:53:34 -08:00
Vicent Martí
f1e5c506b2 Merge pull request #1110 from libgit2/features/push_rebased
Push! By schu, phkelley, and congyiwu
2012-11-29 12:18:05 -08:00
Philip Kelley
36c730daa0 Remove more sample hooks from test repo for push 2012-11-29 10:34:16 -05:00
Philip Kelley
3238ee3e07 Remove sample hooks from test repo for push 2012-11-29 08:37:32 -05:00
Scott J. Goldman
0d9e0323a5 Add the ahead/behind test that Carlos suggested
Adds a repo with a more complex topology to test the ahead-behind
count.
2012-11-28 18:54:57 -08:00
nulltoken
37849a8ec3 tracking: fix retrieval of the tracking ref of branch with empty merge and/or remote entry 2012-11-28 20:00:07 +01:00
Philip Kelley
613d5eb939 Push! By schu, phkelley, and congyiwu, et al 2012-11-28 11:42:37 -05:00
Carlos Martín Nieto
47db054df0 config: distinguish between a lone variable name and one without rhs
'[section] variable' and '[section] variable =' behave differently
when parsed as booleans, so we need to store that distinction
internally.
2012-11-13 13:53:41 -08:00
Vicent Marti
19c044a17d Merge remote-tracking branch 'ben/local-transport' into development 2012-11-12 14:23:17 -08:00
Ben Straub
11fabe73a0 Local fetch: add tests 2012-11-09 10:33:10 -08:00
delanne
bcad677ba8 - Update 'tests-clar/resources/config/config11' in order to reproduce the invalidread with the unittest (just added some \n at the end of the file)
- Fix config_file.c
2012-11-08 12:28:21 +01:00
Vicent Martí
8ff2b0c759 Merge pull request #1039 from erikvanzijst/erik/tag_without_message
Correctly parse tags lacking a description
2012-11-07 16:30:55 -08:00
nulltoken
a2a618948c remote: Add malformed remote load test 2012-11-04 23:08:17 -08:00
Erik van Zijst
6bb9fea13e tags: Fixed the tag parser to correctly treat the message field as optional.
This fix makes libgit2 capable of parsing annotated tag objects that lack
the optional message/description field.
Previously, libgit2 treated this field as mandatory and raised a tag_error on
such tags. However, the message field is optional.

An example of such a tag is refs/tags/v2.6.16.31-rc1 in Linux:

$ git cat-file tag refs/tags/v2.6.16.31-rc1
object afaa018cefb6af63befef1df7d8febaae904434f
type commit
tag v2.6.16.31-rc1
tagger Adrian Bunk <bunk@stusta.de> 1162716505 +0100
$
2012-11-02 10:28:17 -07:00
Vicent Martí
1362a98316 Merge pull request #1014 from arrbee/diff-rename-detection
Initial implementation of diff rename detection
2012-11-02 10:00:28 -07:00
Edward Thomson
f45ec1a076 index refactoring 2012-10-29 20:04:21 -05:00
Russell Belfer
b4f5bb0747 Initial implementation of diff rename detection
This implements the basis for diff rename and copy detection,
although it is based on simple SHA comparison right now instead
of using a matching algortihm.  Just as `git_diff_merge` can be
used as a post-pass on diffs to emulate certain command line
behaviors, there is a new API `git_diff_detect` which will
update a diff list in-place, adjusting some deltas to RENAMED
or COPIED state (and also, eventually, splitting MODIFIED deltas
where the change is too large into DELETED/ADDED pairs).

This also adds a new test repo that will hold rename/copy/split
scenarios.  Right now, it just has exact-match rename and copy,
but the tests are written to use tree diffs, so we should be able
to add new test scenarios easily without breaking tests.
2012-10-23 16:40:51 -07:00
yorah
a1abe66aca Add config level support in the config API
Added `struct git_config_entry`: a git_config_entry contains the key, the value, and the config file level from which a config element was found.
Added `git_config_open_level`: build a single-level focused config object from a multi-level one.

We are now storing `git_config_entry`s in the khash of the config_file
2012-10-23 12:48:38 +02:00
yorah
f8ede94808 Fix adding variable to config file with no trailing newline
This can occur after a manual modification of a config file.
2012-10-23 11:48:50 +02:00
Russell Belfer
4c47a8bcfe Merge pull request #968 from arrbee/diff-support-typechange
Support TYPECHANGE records in status and adjust checkout accordingly
2012-10-17 14:14:51 -07:00
Russell Belfer
52032ae536 Fix single-file ignore checks
To answer if a single given file should be ignored, the path to
that file has to be processed progressively checking that there
are no intermediate ignored directories in getting to the file
in question.  This enables that, fixing the broken old behavior,
and adds tests to exercise various ignore situations.
2012-10-15 12:54:46 -07:00
Carlos Martín Nieto
47f44b6ee4 refs: loosen the OID parsing
We used to require loose references to contain only an OID (possibly
after trimming the string). This is however not enough for letting us
lookup FETCH_HEAD, which can have a lot of content after the initial
OID.

Change the parsing rules so that a loose refernce must e at least 40
bytes long and the 41st (if it's there) must be accepted by
isspace(3). This makes the trim unnecessary, so only do it for
symrefs. This fixes #977.
2012-10-15 14:00:19 +02:00
Russell Belfer
0d64bef941 Add complex checkout test and then fix checkout
This started as a complex new test for checkout going through the
"typechanges" test repository, but that revealed numerous issues
with checkout, including:

* complete failure with submodules
* failure to create blobs with exec bits
* problems when replacing a tree with a blob because the tree
  "example/" sorts after the blob "example" so the delete was
  being processed after the single file blob was created

This fixes most of those problems and includes a number of other
minor changes that made it easier to do that, including improving
the TYPECHANGE support in diff/status, etc.
2012-10-09 11:59:34 -07:00
Russell Belfer
f3a04e0f49 Test data with lots of type changes 2012-10-09 11:54:02 -07:00
Michael Schubert
8060cdc93c revwalk: fix off-by-one error
Fixes #921.
2012-09-27 19:12:01 +02:00
Vicent Martí
31d22037a6 Merge pull request #944 from scunz/list_tags
Tags: teach git_tag_list not to include the 'refs/tags/' prefix
2012-09-25 14:52:24 -07:00
nulltoken
77e06d7e85 refs: introduce git_reference_is_valid_name() 2012-09-25 07:49:15 +02:00
Sascha Cunz
7604ddbf70 Tests: Add 3 tags to resources/testrepo.
Adjusts refs::list test (including the comments)
Adjusts objects::tags::list test
2012-09-23 01:02:07 +02:00
Vicent Martí
d973a5afd4 Merge pull request #929 from arrbee/diff-iter-fixes
Fix problems in diff iterator record chaining
2012-09-13 14:20:43 -07:00