diff options
author | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-24 15:56:51 +0100 |
---|---|---|
committer | Carlos Martín Nieto <cmn@dwim.me> | 2015-03-24 15:56:51 +0100 |
commit | 79010d09df45ed8cbe1b64fb12786db2ba98f7cd (patch) | |
tree | 7d1365f5c934e896290e1a9535ddb4e6fd855b9b | |
parent | 53fc54d5c72068410d8508789dc275dcdd4eaac4 (diff) | |
parent | 1f25fe95f8ba1bf7dc26860c69489c768595534a (diff) | |
download | libgit2-79010d09df45ed8cbe1b64fb12786db2ba98f7cd.tar.gz |
Merge pull request #3015 from ethomson/maint/v0.22
Additional backports
-rw-r--r-- | src/checkout.c | 2 | ||||
-rw-r--r-- | src/repository.c | 3 | ||||
-rw-r--r-- | tests/checkout/nasty.c | 3 | ||||
-rw-r--r-- | tests/clar_libgit2.c | 22 | ||||
-rw-r--r-- | tests/clar_libgit2.h | 4 | ||||
-rw-r--r-- | tests/path/win32.c | 3 |
6 files changed, 35 insertions, 2 deletions
diff --git a/src/checkout.c b/src/checkout.c index 713bc2c33..7b683bbda 100644 --- a/src/checkout.c +++ b/src/checkout.c @@ -1190,7 +1190,7 @@ static int checkout_verify_paths( if (action & ~CHECKOUT_ACTION__REMOVE) { if (!git_path_isvalid(repo, delta->new_file.path, flags)) { - giterr_set(GITERR_CHECKOUT, "Cannot checkout to invalid path '%s'", delta->old_file.path); + giterr_set(GITERR_CHECKOUT, "Cannot checkout to invalid path '%s'", delta->new_file.path); return -1; } } diff --git a/src/repository.c b/src/repository.c index 0cf8eb66b..5d5b3e5ea 100644 --- a/src/repository.c +++ b/src/repository.c @@ -808,7 +808,8 @@ const char *git_repository__8dot3_name(git_repository *repo) /* We anticipate the 8.3 name is "GIT~1", so use a static for * easy testing in the common case */ - if (strcasecmp(repo->name_8dot3, git_repository__8dot3_default) == 0) + if (repo->name_8dot3 && + strcasecmp(repo->name_8dot3, git_repository__8dot3_default) == 0) repo->has_8dot3_default = 1; } #endif diff --git a/tests/checkout/nasty.c b/tests/checkout/nasty.c index bc25a3b52..952a6a112 100644 --- a/tests/checkout/nasty.c +++ b/tests/checkout/nasty.c @@ -217,6 +217,9 @@ void test_checkout_nasty__git_tilde1(void) void test_checkout_nasty__git_custom_shortname(void) { #ifdef GIT_WIN32 + if (!cl_sandbox_supports_8dot3()) + clar__skip(); + cl_must_pass(p_rename("nasty/.git", "nasty/_temp")); cl_git_write2file("nasty/git~1", "", 0, O_RDWR|O_CREAT, 0666); cl_must_pass(p_rename("nasty/_temp", "nasty/.git")); diff --git a/tests/clar_libgit2.c b/tests/clar_libgit2.c index 10f37ad5c..204747498 100644 --- a/tests/clar_libgit2.c +++ b/tests/clar_libgit2.c @@ -533,3 +533,25 @@ void cl_sandbox_set_search_path_defaults(void) GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, sandbox_path); } +#ifdef GIT_WIN32 +bool cl_sandbox_supports_8dot3(void) +{ + git_buf longpath = GIT_BUF_INIT; + char *shortname; + bool supported; + + cl_git_pass( + git_buf_joinpath(&longpath, clar_sandbox_path(), "longer_than_8dot3")); + + cl_git_write2file(longpath.ptr, "", 0, O_RDWR|O_CREAT, 0666); + shortname = git_win32_path_8dot3_name(longpath.ptr); + + supported = (shortname != NULL); + + git__free(shortname); + git_buf_free(&longpath); + + return supported; +} +#endif + diff --git a/tests/clar_libgit2.h b/tests/clar_libgit2.h index f51554293..c9fc4a364 100644 --- a/tests/clar_libgit2.h +++ b/tests/clar_libgit2.h @@ -160,4 +160,8 @@ void cl_fake_home_cleanup(void *); void cl_sandbox_set_search_path_defaults(void); +#ifdef GIT_WIN32 +bool cl_sandbox_supports_8dot3(void); +#endif + #endif diff --git a/tests/path/win32.c b/tests/path/win32.c index 22742f82d..4ff039738 100644 --- a/tests/path/win32.c +++ b/tests/path/win32.c @@ -194,6 +194,9 @@ void test_path_win32__8dot3_name(void) #ifdef GIT_WIN32 char *shortname; + if (!cl_sandbox_supports_8dot3()) + clar__skip(); + /* Some guaranteed short names */ cl_assert_equal_s("PROGRA~1", (shortname = git_win32_path_8dot3_name("C:\\Program Files"))); git__free(shortname); |