Commit Graph

2268 Commits

Author SHA1 Message Date
nulltoken
c2e43fb1f2 diff: workdir diffing in a bare repo returns EBAREREPO 2012-10-18 23:38:27 +02:00
nulltoken
5912d74c69 revparse: properly handle refnames containing a @
Fix #994
2012-10-18 23:05:33 +02:00
Carlos Martín Nieto
b2b571ce0c fetch: declare variables at the top of the block 2012-10-18 19:05:24 +02:00
Carlos Martín Nieto
f0d2ddbbf8 remote: support fetch cancelation
Introduce git_remote_stop() which sets a variable that is checked by
the fetch process in a few key places. If this is variable is set, the
fetch is aborted.
2012-10-18 04:31:03 +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
52a61bb804 Fix minor bugs
Fixed no-submodule speedup of new checkout code.  Fixed missing
final update to progress (which may go away, I realize).  Fixed
unused structure in header and incorrect comment.
2012-10-17 14:10:23 -07:00
Ben Straub
6012e86839 Merge pull request #972 from PaulThompson/separate_strarray
Separated git_strarray from common.h.  Added doxy comments.
2012-10-17 11:55:26 -07:00
Russell Belfer
e48bb71bec Skip submodule checkout pass if no submodules
Skip the third pass of checkout (where submodules are checked out)
if the earlier passes found no submodules to be checked out.
2012-10-17 10:44:38 -07:00
Philip Kelley
b4491b9911 Incremental improvements to pack-objects logic
Incorporate feedback for incr. improvements to pack-objects
2012-10-17 12:07:17 -04:00
Vicent Martí
03452b347e Merge pull request #987 from pwkelley/pthread_cond
Support pthread_cond_* on Win32
2012-10-16 10:54:30 -07:00
Vicent Marti
18217e7e8a test: Don't be so picky with failed lookups
Not found means not found, and the other way around.
2012-10-16 19:37:21 +02:00
Philip Kelley
5e4f2b5faa Support pthread_cond_* on Win32 2012-10-16 13:18:45 -04:00
Carlos Martín Nieto
a891841850 config: also free the XDG buffer 2012-10-16 17:58:19 +02:00
Vicent Martí
52748f7b9f Merge pull request #952 from csware/config-locations
Config location fixes
2012-10-16 08:36:55 -07:00
Philip Kelley
9e37305aad Merge pull request #984 from arrbee/fix-fnmatch-and-ignore
Fix single file ignores
2012-10-16 08:34:28 -07:00
Ben Straub
71b79a0aab Merge pull request #982 from nulltoken/clone/no-checkout
clone: Explicit support of no-checkout option
2012-10-15 15:24:50 -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
Russell Belfer
d5a5191067 Import DOS fix for fnmatch
Because fnmatch uses recursion, there were some input sequences
that cause seriously degenerate behavior.  This imports a fix
that imposes a max recursion limiter to avoid the worst of it.
2012-10-15 12:54:46 -07:00
Russell Belfer
824d5e4d26 Always use internal fnmatch, not system 2012-10-15 12:54:46 -07:00
nulltoken
68206c54bf test: fix some memory leaks 2012-10-15 20:41:43 +02:00
nulltoken
fa5d94a0d4 reset: prevent hard reset in a bare repository 2012-10-15 20:41:42 +02:00
nulltoken
c4f68b3202 clone: fix detection of remote HEAD 2012-10-15 20:40:37 +02:00
nulltoken
4d968f134b clone: Explicit support of no-checkout option 2012-10-15 20:40:37 +02:00
Carlos Martín Nieto
7ae5ab5696 Fix leak in the tests
Also introduce the slective ref trimming promised but also missed in
the previous commit.
2012-10-15 16:35:10 +02: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
Philip Kelley
9d9288f417 Fix buffer overrun in git_buf_put_base64 2012-10-14 12:29:05 -04:00
nulltoken
62993b6158 branches: propagate EEXISTS upon creation 2012-10-11 14:08:32 +02:00
Paul Thompson
b46708aaf9 Separated git_strarray from common.h. Added doxy comments. 2012-10-11 23:04:08 +11:00
nulltoken
3548fcf562 refs: propagate EEXISTS upon renaming 2012-10-11 14:00:26 +02:00
Vicent Martí
9206976fc7 Merge pull request #971 from arrbee/base64-encoder
Add git_buf_put_base64 to buffer API
2012-10-10 15:00:32 -07:00
Carlos Martín Nieto
aeba5e175a http: don't discard the HEAD ref
The fix for fetching from empty repositories (22935b06d protocol:
don't store flushes; 2012-10-07) forgot to take into account the
deletion of the flush pkt in the HTTP transport. As a result, the HEAD
ref advertisement where we detect the remote's capabilities was
deleted instead. Fix this.
2012-10-10 23:59:16 +02:00
Russell Belfer
2d3579bea6 Add git_buf_put_base64 to buffer API 2012-10-10 14:54:31 -07:00
Michael Schubert
0cf49e1017 fixup! gsoc-pack-objects WIP
Use khash instead of git.git's hashing algorithm.
2012-10-09 21:50:04 +02:00
Michael Schubert
0a32dca5ec gsoc-pack-objects WIP 2012-10-09 21:28:31 +02:00
Michael Schubert
ec1d42b7d5 Add diff-delta code from git.git 2012-10-09 21:28:31 +02:00
Michael Schubert
e3f8d58d12 indexer: do not require absolute path 2012-10-09 21:28:31 +02:00
Michael Schubert
fa16a6ecc4 Enable pthread condition vars 2012-10-09 21:28:31 +02:00
Michael Schubert
2f05339e3e Add git_tag_foreach 2012-10-09 21:28:31 +02:00
Michael Schubert
edca6c8fed git_odb_object_free: don't segfault w/ arg == NULL 2012-10-09 21:28:31 +02:00
Michael Schubert
4bc1a30f13 util: add git__compress() 2012-10-09 21:28:31 +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
95f5f1e63a Cleanup TYPECHANGE support
This is just some cleanup code, rearranging some of the checkout
code where TYPECHANGE support was added and adding some comments
to the diff header regarding the constants.
2012-10-09 11:54:01 -07:00
Russell Belfer
fbec2fb991 Fix checkout to know about TYPECHANGE diffs 2012-10-09 11:54:01 -07:00
Russell Belfer
bc16fd3ebf Introduce status/diff TYPECHANGE flags
When I wrote the diff code, I based it on core git's diff output
which tends to split a type change into an add and a delete.  But
core git's status has the notion of a T (typechange) flag for a
file.  This introduces that into our status APIs and modifies the
diff code so it can be forced to not split type changes.
2012-10-09 11:54:01 -07:00
Russell Belfer
fade21db0a Improve error propogation in checkout 2012-10-09 11:53:00 -07:00
Vicent Martí
21e0d297af Merge pull request #967 from arrbee/diff-submodule-tests-and-fixes
Diff submodule tests and fixes
2012-10-09 11:45:50 -07:00
Michael Schubert
aa4437f637 Fix compiler warnings
* tests-clar/status: remove an unused variable
* clone: fix -Wmaybe-uninitialized warning
2012-10-09 17:51:11 +02:00
Ben Straub
9adfa7d147 Merge pull request #949 from nulltoken/topic/deploy_repository_set_head
Deploy git_repository_set_head()
2012-10-08 15:25:44 -07:00
Russell Belfer
5d1308f25f Add test for diffs with submodules and bug fixes
The adds a test for the submodule diff capabilities and then
fixes a few bugs with how the output is generated.  It improves
the accuracy of OIDs in the diff delta object and makes the
submodule output more closely mirror the OIDs that will be used
by core git.
2012-10-08 15:22:40 -07:00
Russell Belfer
dfbff793b8 Fix a few diff bugs with directory content
There are a few cases where diff should leave directories in
the diff list if we want to match core git, such as when the
directory contains a .git dir.  That feature was lost when I
introduced some of the new submodule handling.

This restores that and then fixes a couple of related to diff
output that are triggered by having diffs with directories in
them.

Also, this adds a new flag that can be passed to diff if you
want diff output to actually include the file content of any
untracked files.
2012-10-08 15:22:40 -07:00
Russell Belfer
543864b677 Merge pull request #940 from scunz/diff_sm
Diff: Show submodule diff
2012-10-08 15:21:47 -07:00
Philip Kelley
edb456c328 Fix a bug where ignorecase wasn't applied to ignores 2012-10-08 16:32:43 -04:00
nulltoken
bf0e62a2b8 clone: fix cloning of empty repository 2012-10-08 00:44:21 +02:00
nulltoken
d280c71b8e clone: leverage refspec transform 2012-10-08 00:44:16 +02:00
nulltoken
3e012fca77 refspec: introduce git_refspec_transform_l() 2012-10-08 00:44:13 +02:00
nulltoken
70edc1b0fc clone: align type casing with convention 2012-10-08 00:44:11 +02:00
nulltoken
4ba23be1e5 branch: deploy git_branch_is_head() 2012-10-08 00:44:08 +02:00
nulltoken
0c78f685eb branch: introduce git_branch_is_head() 2012-10-07 21:03:51 +02:00
nulltoken
f3cc78340a refs: deploy git_repository_set_head() usage 2012-10-07 21:03:50 +02:00
nulltoken
7eca3c561d clone: deploy git_repository_set_head() usage 2012-10-07 21:03:49 +02:00
nulltoken
a147408f94 reset: make reset rely on git_repository_head() 2012-10-07 21:03:49 +02:00
nulltoken
096d9e94aa remote: use constants for well-known names 2012-10-07 21:03:37 +02:00
nulltoken
74a2400514 refs: use constants for well-known names 2012-10-07 12:04:19 +02:00
Carlos Martín Nieto
acd1700630 remote: only keep a weak pointer in update_tips
The reference is only needed inside the function. We mistakenly
increased the reference counter causing the ODB not to get freed and
leaking descriptors.
2012-10-07 11:19:19 +02:00
Carlos Martín Nieto
22935b06d1 protocol: don't store flushes
Storing flushes in the refs vector doesn't let us recognize when the
remote is empty, as we'd always introduce at least one element into
it. These flushes aren't necessary, so we can simply ignore them.
2012-10-07 10:20:23 +02:00
Sascha Cunz
1dca8510a2 Diff: Do not try to calculate an oid for a GITLINK.
We don't have anything useful that we could do with that oid anyway (We
need to query the submodule for the HEAD commit instead).

Without this, the following code creates the error "Failed to read
descriptor: Is a directory" when run against the submod2 test-case:

    const char* oidstr = "873585b94bdeabccea991ea5e3ec1a277895b698";
    git_tree* tree = resolve_commit_oid_to_tree(g_repo, oidstr);
    git_diff_list* diff = NULL;
    cl_assert(tree);
    cl_git_pass(git_diff_workdir_to_tree(g_repo, NULL, tree, &diff));
2012-10-05 13:53:53 +02:00
Sascha Cunz
1686641f18 Extract submodule logic out of diff_output.c:get_workdir_content 2012-10-05 13:03:38 +02:00
Sascha Cunz
7e57d2506a Diff: teach get_workdir_content to show a submodule as text
1. teach diff.c:maybe_modified to query git_submodule_status for the
   modification state of a submodule. According to the
   git_submodule_status docs, it will filter for to-ignore states
   already.

2. teach diff_output.c:get_workdir_content to check the submodule status
   again and create a line like:

      Subproject commit <SHA-1>\n
   or
      Subproject comimt <SHA-1>-dirty\n

   like git.git does.
2012-10-05 13:03:38 +02:00
Sascha Cunz
9ce44f1ae5 Diff: teach get_blob_content to show a submodule as text
diff_output.c:get_blob_content used to try to read the submodule commit
as a blob in the superproject's odb. Of course it cannot find it and
errors out with GIT_ENOTFOUND, implcitly terminating the whole diff
output.

This patch teaches it to create a text that describes the submodule
instead. The text looks like:

	Subproject commit <SHA1>\n

which is what git.git does, too.
2012-10-05 13:03:38 +02:00
Sascha Cunz
1a5cd26b8c Fix minor whitespace issue 2012-10-05 13:03:38 +02:00
Russell Belfer
d0b452db02 Merge pull request #932 from ben/clone_pack_race
ODB: re-load packfiles on failed lookup
2012-10-02 11:08:30 -07:00
Russell Belfer
eada0762dd Merge pull request #939 from pwkelley/ignorecase
Support for the core.ignorecase flag
2012-10-02 10:45:40 -07:00
Sven Strickroth
997579bed1 Move win32 specific stuff to win32/findfile.c
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-10-02 17:58:34 +02:00
Sven Strickroth
4258d4832b Rename xdr to xdg
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-10-02 17:21:07 +02:00
Sven Strickroth
8b3de0b6b8 Optimized win32_nextpath
Based on a suggestion by Russell Belfer.

Signed-off-by: Sven Strickroth <email@cs-ware.de>
Signed-off-by: Russell Belfer <rb@github.com>
2012-10-02 17:16:22 +02:00
Carlos Martín Nieto
c648d4a8aa remote: don't auto-follow tags on an unamed remote
An unnamed remote is used for commands like

    git fetch git://host/repo

where no tags should be downloaded. Make this the default.
2012-10-02 13:09:18 +02:00
Carlos Martín Nieto
218c88a968 remote: set/unset the autotag setting on save
Make the configuration option match the configured behavior when
saving a remote.
2012-10-02 13:09:18 +02:00
Vicent Martí
8bc5caccee Merge pull request #961 from arrbee/win64-cleanups
Win64 cleanups
2012-10-01 13:57:32 -07:00
Russell Belfer
7c411fd9b2 Fix up more Win64 compile warnings 2012-10-01 12:32:55 -07:00
Vicent Marti
93b5fabcc0 threads: Assert that the global state is initialized 2012-10-01 17:59:04 +02:00
Vicent Marti
9063be1f45 remote: Fix mid-block declaration 2012-10-01 17:33:05 +02:00
Carlos Martín Nieto
3230a44f4c remote: support downloading all tags
Also honor remote.$name.tagopt = --tags.
2012-09-30 12:05:28 +02:00
Carlos Martín Nieto
eb0bd77a88 remote: use the refspec functions to parse, instead of rolling our own
The local function works for simple cases, but we shouldn't reinvent
the wheel just for us.
2012-09-30 12:04:49 +02:00
Carlos Martín Nieto
f70e466f68 remote: add accessors for the autotag setting 2012-09-30 12:04:49 +02:00
Carlos Martín Nieto
a37ddf7ef8 remote: create tags if we have them
Together with include-tag, this make us behave more like git. After a
fetch, try to create any tags the remote told us about for which we
have objects locally.
2012-09-30 12:04:39 +02:00
Carlos Martín Nieto
24f2f94e7d fetch: use the include-tag capability
This tells the remote to send us any tags that point to objects that
we are downloading.
2012-09-30 11:56:38 +02:00
Carlos Martín Nieto
c128149315 refs: propagate EEXISTS
Indicate whether the error comes from the ref already existing or
elsewhere. We always perform the check and this lets the user write
more concise code.
2012-09-30 11:56:37 +02:00
Carlos Martín Nieto
3665ba8eeb refspec: add git_refspec__free, remove git_refspec_parse
The latter shouldn't be exposed and isn't used, git_refspec__parse
supersedes it.

Fix a leak in the refspec tests while we're at it.
2012-09-30 11:56:37 +02:00
Sven Strickroth
19aa8416e5 Silence MinGW warnings
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-09-29 21:31:19 +02:00
Sven Strickroth
dee18b825a Added win32_ prefix for Win32-only methods
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-09-29 21:26:04 +02:00
Sven Strickroth
77ddd4ccc3 Make it compile with MinGW on Windows
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-09-29 21:24:07 +02:00
Sven Strickroth
32a4e3b712 Move code to find msysgit path using registry to own method
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-09-29 20:26:33 +02:00
Sven Strickroth
549ee21a6f Find git installations based on %PATH%
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2012-09-29 20:20:41 +02:00
Russell Belfer
cc5bf359a6 Clean up Win64 warnings 2012-09-28 14:34:08 -07:00
Vicent Martí
34402bcdb9 Merge pull request #959 from jamill/empty_file_hash
Fix error hashing empty file.
2012-09-28 11:57:02 -07:00
Vicent Martí
3f849902e4 Merge pull request #958 from schu/fix-merge-base
revwalk: fix off-by-one error
2012-09-28 11:48:43 -07:00
Jameson Miller
addc9be4fc Fix error hashing empty file. 2012-09-27 13:12:27 -04:00
Michael Schubert
8060cdc93c revwalk: fix off-by-one error
Fixes #921.
2012-09-27 19:12:01 +02:00
Russell Belfer
bae957b95d Add const to all shared pointers in diff API
There are a lot of places where the diff API gives the user access
to internal data structures and many of these were being exposed
through non-const pointers.  This replaces them all with const
pointers for any object that the user can access but is still
owned internally to the git_diff_list or git_diff_patch objects.

This will probably break some bindings...  Sorry!
2012-09-25 16:35:05 -07:00
Russell Belfer
6428630865 Fix bugs in new diff patch code
This fixes all the bugs in the new diff patch code.  The only
really interesting one is that when we merge two diffs, we now
have to actually exclude diff delta records that are not supposed
to be tracked, as opposed to before where they could be included
because they would be skipped silently by `git_diff_foreach()`.
Other than that, there are just minor errors.
2012-09-25 16:35:05 -07:00