Commit Graph

30 Commits

Author SHA1 Message Date
John Fultz
67db2bdeea Fix git_checkout_tree() to do index filemodes correctly on Windows.
git_checkout_tree() has some fallback behaviors for file systems
which don't have full support of filemodes.  Generally works fine,
but if a given file had a change of type from a 0644 to 0755 (i.e.,
you add executable permissions), the fallback behavior incorrectly
triggers when writing hte updated index.

This would cause a git_checkout_tree() command, even with the
GIT_CHECKOUT_FORCE option set, to leave a dirty index on Windows.

Also added checks to an existing test to catch this case.
2015-04-06 18:22:17 -05:00
Carlos Martín Nieto
4e498646b6 repository: remove log message override for switching the active branch
We want to use the "checkout: moving from ..." message in order to let
git know when a change of branch has happened. Make the convenience
functions for this goal write this message.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
6bfb990dc7 branch: don't accept a reflog message override
This namespace is about behaving like git's branch command, so let's do
exactly that instead of taking a reflog message.

This override is still available via the reference namespace.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
23a17803b6 reset: remove reflog message override
This function is meant to simulate what git does in the reset command,
so we should include the reflog message in that.
2015-03-03 14:40:50 +01:00
Carlos Martín Nieto
659cf2029f Remove the signature from ref-modifying functions
The signature for the reflog is not something which changes
dynamically. Almost all uses will be NULL, since we want for the
repository's default identity to be used, making it noise.

In order to allow for changing the identity, we instead provide
git_repository_set_ident() and git_repository_ident() which allow a user
to override the choice of signature.
2015-03-03 14:40:50 +01:00
Edward Thomson
496b76d415 checkout tests: just use SAFE where appropriate 2015-02-27 13:50:48 -05:00
Edward Thomson
96b82b11c6 checkout: remove GIT_CHECKOUT_SAFE_CREATE as a strategy 2015-02-27 13:50:44 -05:00
Edward Thomson
e6da3e4496 checkout: upgrade to SAFE_CREATE when no index file
When the repository does not contain an index, emulate git's behavior
and upgrade to `SAFE_CREATE`.  This allows us to check out repositories
created with `git clone --no-checkout`.
2015-02-27 13:50:32 -05:00
Edward Thomson
8639ea5f98 checkout: introduce GIT_CHECKOUT_DONT_WRITE_INDEX 2015-02-14 09:25:35 -05:00
Edward Thomson
fa89ff20cd remove some unused warnings 2015-02-04 14:15:13 +00:00
Edward Thomson
2fbce0bfac checkout test: ensure .gitattributes lifecycle
The .gitattributes cache should not reload .gitattributes in the
middle of checking out, only between checkout operations.  Otherwise,
we'll spend all our time stat'ing and read'ing the gitattributes.
2015-02-02 22:46:39 -05:00
Edward Thomson
1d50b3649d checkout: introduce git_checkout_perfdata
Checkout can now provide performance data about the number of (some)
syscalls performed using an optional callback.
2015-01-20 17:12:23 -06:00
Carlos Martín Nieto
c4a2fd5c1d Plug a couple of leaks 2015-01-04 17:39:43 +00:00
Edward Thomson
40d791545a Always checkout with case sensitive iterator
On a case-insensitive filesystem, we need to deal with case-changing
renames (eg, foo -> FOO) by removing the old and adding the new,
exactly as if we were on a case-sensitive filesystem.

Update the `checkout::tree::can_cancel_checkout_from_notify` test, now
that notifications are always sent case sensitively.
2014-12-23 10:14:04 -06:00
Edward Thomson
61ee5b0e57 Introduce test for checkout case-changing rename 2014-12-23 10:14:01 -06:00
Carlos Martín Nieto
f7fcb18f8a Plug leaks
Valgrind is now clean except for libssl and libgcrypt.
2014-11-23 15:51:31 +01:00
Edward Thomson
9f664347ff checkout_index: remove conflicts when checking out new files 2014-11-06 18:49:57 -05:00
Sven Strickroth
b8add6c42e Allow to propagate checkout callbacks to git HARD reset
Signed-off-by: Sven Strickroth <email@cs-ware.de>
2014-08-03 16:29:51 +02:00
Ben Straub
6affd71f33 git_checkout_opts -> git_checkout_options 2014-03-06 09:44:51 -08:00
Ben Straub
586be3b889 Add reflog parameters to git_reset 2014-02-03 15:05:55 -08:00
Ben Straub
b31ebfbc66 Add reflog params to git_branch_create 2014-01-30 15:52:13 -08:00
Ben Straub
94f263f59b Add reflog params to set-head calls 2014-01-30 15:51:00 -08:00
Carlos Martín Nieto
d541170c77 index: rename an entry's id to 'id'
This was not converted when we converted the rest, so do it now.
2014-01-25 08:15:44 +01:00
Edward Thomson
e8b81c698c Preserve tree filemode in index during checkout
Don't try to determine whether the system supports file modes
when putting the tree data in the index during checkout.  The tree's
mode is canonical and did not come from stat(2) in the first place.
2014-01-22 13:26:30 -05:00
Carlos Martín Nieto
0b28217bda refs: remove the _with_log differentiation
Any well-behaved program should write a descriptive message to the
reflog whenever it updates a reference. Let's make this more prominent
by removing the version without the reflog parameters.
2014-01-15 13:32:43 +01:00
Edward Thomson
bf4a577c69 Overwrite ignored directories on checkout 2013-12-13 10:10:32 -05:00
Edward Thomson
81a2012d99 Overwrite ignored files on checkout 2013-12-13 09:29:55 -05:00
Russell Belfer
8046b26cb1 Try a test that won't assert on Linux 2013-12-11 10:57:51 -08:00
Russell Belfer
cbd048969e Fix checkout notify callback docs and tests
The checkout notify callback behavior on non-zero return values
was not being tested.  This adds tests, fixes a bug with positive
values, and clarifies the documentation to make it clear that the
checkout can be canceled via this mechanism.
2013-12-11 10:57:50 -08:00
Ben Straub
1782038144 Rename tests-clar to tests 2013-11-14 14:05:52 -08:00