author | Junio C Hamano <gitster@pobox.com> | |
Wed, 22 Oct 2008 00:58:11 +0000 (17:58 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 22 Oct 2008 00:58:11 +0000 (17:58 -0700) |
* jc/maint-co-track:
Enhance hold_lock_file_for_{update,append}() API
demonstrate breakage of detached checkout with symbolic link HEAD
Fix "checkout --track -b newbranch" on detached HEAD
Conflicts:
builtin-commit.c
Enhance hold_lock_file_for_{update,append}() API
demonstrate breakage of detached checkout with symbolic link HEAD
Fix "checkout --track -b newbranch" on detached HEAD
Conflicts:
builtin-commit.c
1 | 2 | |||
---|---|---|---|---|
branch.c | patch | | diff1 | | diff2 | | blob | history |
builtin-commit.c | patch | | diff1 | | diff2 | | blob | history |
builtin-fetch-pack.c | patch | | diff1 | | diff2 | | blob | history |
builtin-revert.c | patch | | diff1 | | diff2 | | blob | history |
cache.h | patch | | diff1 | | diff2 | | blob | history |
refs.c | patch | | diff1 | | diff2 | | blob | history |
rerere.c | patch | | diff1 | | diff2 | | blob | history |
sha1_file.c | patch | | diff1 | | diff2 | | blob | history |
t/t7201-co.sh | patch | | diff1 | | diff2 | | blob | history |
diff --cc branch.c
Simple merge
diff --cc builtin-commit.c
index 33b659edce478fb0d3d4bb723e4f54c13db0efb1,b563a0d67cedc66825692863d9e57001fba35348..93ca49635731942c72cb52b27b1a6ba53becd1ca
--- 1/builtin-commit.c
--- 2/builtin-commit.c
+++ b/builtin-commit.c
die("unable to write new_index file");
fd = hold_lock_file_for_update(&false_lock,
- git_path("next-index-%"PRIuMAX, (uintmax_t) getpid()), 1);
- git_path("next-index-%d", getpid()),
++ git_path("next-index-%"PRIuMAX,
++ (uintmax_t) getpid()),
+ LOCK_DIE_ON_ERROR);
create_base_index();
add_remove_files(&partial);
diff --cc builtin-fetch-pack.c
Simple merge
diff --cc builtin-revert.c
Simple merge
diff --cc cache.h
Simple merge
diff --cc refs.c
Simple merge
diff --cc rerere.c
Simple merge
diff --cc sha1_file.c
Simple merge
diff --cc t/t7201-co.sh
index 82769b89fc79d91982420ddfc83ce6c3dd672095,f93478f97ff8d139d4c67690e1c85f098ca90a10..0e21632f19e75e1e7bbca1ceb2b9402a4d291584
--- 1/t/t7201-co.sh
--- 2/t/t7201-co.sh
+++ b/t/t7201-co.sh
test "$(git config branch.track2.merge)"
git config branch.autosetupmerge false'
- test_expect_success \
- 'checkout w/--track from non-branch HEAD fails' '
- git checkout -b delete-me master &&
- rm .git/refs/heads/delete-me &&
- test refs/heads/delete-me = "$(git symbolic-ref HEAD)" &&
- test_must_fail git checkout --track -b track'
+ test_expect_success 'checkout w/--track from non-branch HEAD fails' '
+ git checkout master^0 &&
+ test_must_fail git symbolic-ref HEAD &&
+ test_must_fail git checkout --track -b track &&
+ test_must_fail git rev-parse --verify track &&
+ test_must_fail git symbolic-ref HEAD &&
+ test "z$(git rev-parse master^0)" = "z$(git rev-parse HEAD)"
+ '
+
+ test_expect_success 'detach a symbolic link HEAD' '
+ git checkout master &&
+ git config --bool core.prefersymlinkrefs yes &&
+ git checkout side &&
+ git checkout master &&
+ it=$(git symbolic-ref HEAD) &&
+ test "z$it" = zrefs/heads/master &&
+ here=$(git rev-parse --verify refs/heads/master) &&
+ git checkout side^ &&
+ test "z$(git rev-parse --verify refs/heads/master)" = "z$here"
+ '
-test_expect_success 'checkout an unmerged path should fail' '
+test_expect_success \
+ 'checkout with --track fakes a sensible -b <name>' '
+ git update-ref refs/remotes/origin/koala/bear renamer &&
+ git update-ref refs/new/koala/bear renamer &&
+
+ git checkout --track origin/koala/bear &&
+ test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
+
+ git checkout master && git branch -D koala/bear &&
+
+ git checkout --track refs/remotes/origin/koala/bear &&
+ test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
+
+ git checkout master && git branch -D koala/bear &&
+
+ git checkout --track remotes/origin/koala/bear &&
+ test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)" &&
+
+ git checkout master && git branch -D koala/bear &&
+
+ git checkout --track refs/new/koala/bear &&
+ test "refs/heads/koala/bear" = "$(git symbolic-ref HEAD)" &&
+ test "$(git rev-parse HEAD)" = "$(git rev-parse renamer)"
+'
+
+test_expect_success \
+ 'checkout with --track, but without -b, fails with too short tracked name' '
+ test_must_fail git checkout --track renamer'
+
+setup_conflicting_index () {
rm -f .git/index &&
O=$(echo original | git hash-object -w --stdin) &&
A=$(echo ourside | git hash-object -w --stdin) &&