Commit Graph

2526 Commits

Author SHA1 Message Date
Russell Belfer
ac971ecfdb Better fix for isalpha in drive letter detection
Missed a place that used this and missed git__isalpha
2012-06-08 14:08:34 -07:00
Russell Belfer
d17db71b6f isalpha is not great for UTF-8
When checking for a drive letter on windows, instead of using
isalpha(), it is better to just check for a..z and A..Z, I think,
particularly because the MS isalpha implementation appears to
assert when given an 0xFF byte.
2012-06-08 13:56:53 -07:00
Russell Belfer
145e696b49 Minor fixes, cleanups, and clarifications
There are three actual changes in this commit:

1. When the trailing newline of a file is removed in a diff, the
   change will now be reported with `GIT_DIFF_LINE_DEL_EOFNL` passed
   to the callback.  Previously, the `ADD_EOFNL` constant was given
   which was just an error in my understanding of when the various
   circumstances arose.  `GIT_DIFF_LINE_ADD_EOFNL` is deprecated and
   should never be generated.  A new newline is simply an `ADD`.
2. Rewrote the `diff_delta__merge_like_cgit` function that contains
   the core logic of the `git_diff_merge` implementation.  The new
   version doesn't actually have significantly different behavior,
   but the logic should be much more obvious, I think.
3. Fixed a bug in `git_diff_merge` where it freed a string pool
   while some of the string data was still in use.  This led to
   `git_diff_print_patch` accessing memory that had been freed.

The rest of this commit contains improved documentation in `diff.h`
to make the behavior and the equivalencies with core git clearer,
and a bunch of new tests to cover the various cases, oh and a minor
simplification of `examples/diff.c`.
2012-06-08 12:11:13 -07:00
Russell Belfer
0abd724454 Fix filemode comparison in diffs
File modes were both not being ignored properly on platforms
where they should be ignored, nor be diffed consistently on
platforms where they are supported.

This change adds a number of diff and status filemode change
tests.  This also makes sure that filemode-only changes are
included in the diff output when they occur and that filemode
changes are ignored successfully when core.filemode is false.

There is no code that automatically toggles core.filemode
based on the capabilities of the current platform, so the user
still needs to be careful in their .git/config file.
2012-06-08 12:09:10 -07:00
Vicent Martí
80c03754ae Merge pull request #757 from benstraub/development
Tests: wrap 'getenv' and friends for Win32 tests.
2012-06-08 11:36:49 -07:00
Ben Straub
e272efcb20 Tests: wrap 'getenv' and friends for Win32 tests. 2012-06-08 11:24:37 -07:00
Vicent Martí
3f0358604e misc: Fix warnings from PVS Studio trial 2012-06-07 22:43:48 +02:00
Ben Straub
763b838152 Fixing rev-parse-induced Travis errors. 2012-06-07 13:22:50 -07:00
Vicent Martí
6c08e69fd9 Merge pull request #669 from nulltoken/topic/reset
Add git_reset()
2012-06-07 12:30:20 -07:00
Vicent Martí
b9ebcc59e7 Merge pull request #684 from benstraub/rev-parse
Rev parse
2012-06-07 12:29:31 -07:00
Ben Straub
327dc61f13 Prefer git__free (again). 2012-06-07 12:28:08 -07:00
nulltoken
edebceffef Add git_reset()
Currently supports Soft and Mixed modes.
2012-06-07 21:27:30 +02:00
Ben Straub
31dda64716 Rename internal function. 2012-06-07 12:16:39 -07:00
Vicent Martí
cddb8efe56 Merge pull request #704 from nulltoken/topic/blob_fromchunks
Add the ability to create blob given a provider of chunks of bytes
2012-06-07 11:34:48 -07:00
nulltoken
cd44576790 blob: add git_blob_create_fromchunks() 2012-06-07 20:33:22 +02:00
Vicent Martí
5bb545822d Merge pull request #752 from nulltoken/fix/warning
Fix compilation warning and failing test
2012-06-07 09:44:08 -07:00
Vicent Martí
9bc57e5671 Merge pull request #751 from libgit2/8bit-filename-status
git_status_file returns GIT_ENOTFOUND for "域名检测工具.exe" (and similarly named files)
2012-06-07 09:37:23 -07:00
Adam Roben
8e60c712ac Fix git_status_file for files that start with a character > 0x7f
git_status_file would always return GIT_ENOTFOUND for these files.

The underlying bug was that git__strcmp_cb, which is used by
git_path_with_stat_cmp to sort entries in the working directory,
compares strings based on unsigned chars (this is confirmed by the
strcmp(3) manpage), while git__prefixcmp, which is used by
workdir_iterator__entry_cmp to search for a path in the working
directory, compares strings based on char. So the sort puts this path at
the end of the list, while the search expects it to be at the beginning.

The fix was simply to make git__prefixcmp compare using unsigned chars,
just like strcmp(3). The rest of the change is just adding/updating
tests.
2012-06-07 09:50:19 -04:00
Adam Roben
b9f78cb87b Ingore clar_main.c.rule 2012-06-07 09:49:52 -04:00
nulltoken
6654dbe320 tests: fix assertion 2012-06-07 14:09:25 +02:00
nulltoken
6f944ab196 Fix compilation warning 2012-06-07 13:36:28 +02:00
Ben Straub
9ecf860d48 Rename posix wrappers with 'p_' prefix. 2012-06-06 13:24:25 -07:00
Ben Straub
1a728066c3 Remove 'git__' prefix from a static function. 2012-06-06 13:04:08 -07:00
Ben Straub
d6391a626f Rev-parse: stop referencing freed memory.
Converted an internal utility to return an oid, 
rather than a tree entry (whose lifetime is tied
to the parent tree, which was freed before 
returning).
2012-06-06 13:00:12 -07:00
Ben Straub
36c0802245 Omit failing test on 32-bit machines.
This test is intended to verify that 64-bit
machines can handle parsing dates in 2039 and
beyond, and fails on 32-bit machines. It is now
omitted when run on a 32-bit machine to eliminate
an expected failure.
2012-06-06 12:39:29 -07:00
Ben Straub
19d35d528c Prefer git__free() to free(). 2012-06-06 12:31:48 -07:00
Ben Straub
8a385c0482 Move git__date_parse declaration to util.h. 2012-06-06 12:25:22 -07:00
Ben Straub
2c2cde47b8 Fix signatures for tree calls. 2012-06-06 08:41:39 -07:00
Carlos Martín Nieto
66798ad0d8 Don't include arpa/inet.h on Windows 2012-06-06 11:00:15 +02:00
Michael Schubert
fdc5c38e40 transports: fix buglet 2012-06-05 23:03:06 +02:00
Vicent Martí
966fbdcb8e Merge pull request #697 from carlosmn/ssl
Add HTTPS support
2012-06-05 13:53:33 -07:00
Vicent Martí
eadc0e03f1 Merge pull request #747 from nulltoken/topic/init-filemode
Make git_repository_init() value "core.filemode" and "core.ignorecase"
2012-06-05 13:41:13 -07:00
nulltoken
693b23c09a repository: make git_repository_init() value the core.ignorecase config entry 2012-06-05 22:33:34 +02:00
Vicent Martí
8fc1e0c819 Merge pull request #738 from nacho/development
libgit2-glib bindings moved to gnome servers
2012-06-05 13:18:29 -07:00
Vicent Marti
a146ba9e5b tests: Fix warning with nested comments 2012-06-05 22:16:08 +02:00
Vicent Martí
2255b60e28 Merge pull request #714 from schu/config-enotfound
config: do not set an error for GIT_ENOTFOUND
2012-06-05 13:12:36 -07:00
Ben Straub
56a5000d58 Merge branch 'development' into rev-parse
Conflicts:
	src/util.h
	tests-clar/refs/branches/listall.c
2012-06-05 12:52:44 -07:00
nulltoken
fac66990b6 repository: make git_repository_init() value the core.filemode config entry 2012-06-05 14:01:44 +02:00
Carlos Martín Nieto
01dbe273c9 Merge pull request #737 from nulltoken/topic/git_remote_add_refspec
Remotes and refspecs
2012-06-04 15:10:29 -07:00
nulltoken
d27bf66561 remote: Make git_remote_add() generate a default refspec with a force update specifier 2012-06-04 23:47:09 +02:00
Russell Belfer
8856849c1c Merge pull request #739 from arthurschreiber/fix_remote_connected
Fix git_remote_connected
2012-06-04 14:31:53 -07:00
Ben Straub
e267c9fc1a Complete the AUTHORS list. 2012-06-04 06:03:08 -07:00
Arthur Schreiber
e9551e86b9 Fix git_close/http_close/local_close to set the transport's connected attribute to 0. 2012-06-02 16:52:22 +02:00
Arthur Schreiber
36c88422ef Add a failing test case for git_remote_disconnect/git_remote_connected. 2012-06-02 16:48:12 +02:00
Ben Straub
734efe4b8e Rev-parse: implement ":/foo" syntax. 2012-06-01 14:18:52 -07:00
Ben Straub
2497106f91 Rev-parse: add test with deeper path. 2012-06-01 11:41:54 -07:00
Carlos Martín Nieto
1d4dcc4b48 config: set an error message when asked to delete a non-existent key 2012-06-01 11:48:58 +02:00
Ben Straub
b183a92fc2 Rev-parse: Plug memory leaks. 2012-05-31 13:42:58 -07:00
Ignacio Casal Quinteiro
36bae3e96a libgit2-glib bindings moved to gnome servers 2012-05-31 09:56:05 +02:00
Ben Straub
244d2f6b80 Rev-parse: add "tag:README" syntax. 2012-05-30 16:52:11 -07:00