From 59c222052801a55bb40a78378ea19c6b7c4ec45d Mon Sep 17 00:00:00 2001 From: Jonathan Nieder Date: Fri, 11 Oct 2013 10:35:46 -0700 Subject: [PATCH 1/2] status test: add missing && to <&3 2>&4 "$*" } +check_command_chaining_ () { + eval >&3 2>&4 "(exit 189) && $*" + eval_chain_ret=$? + if test "$eval_chain_ret" != 189 + then + error 'bug in test script: missing "&&" in test commands' + fi +} + test_run_ () { + check_command_chaining_ "$1" test_cleanup=: expecting_failure=$2 setup_malloc_check Signed-off-by: Jonathan Nieder --- t/t7512-status-help.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh index 0688d58884..9905d43c74 100755 --- a/t/t7512-status-help.sh +++ b/t/t7512-status-help.sh @@ -669,7 +669,7 @@ EOF test_expect_success 'status showing detached at and from a tag' ' test_commit atag tagging && git checkout atag && - cat >expected <<\EOF + cat >expected <<\EOF && HEAD detached at atag nothing to commit (use -u to show untracked files) EOF @@ -677,7 +677,7 @@ EOF test_i18ncmp expected actual && git reset --hard HEAD^ && - cat >expected <<\EOF + cat >expected <<\EOF && HEAD detached from atag nothing to commit (use -u to show untracked files) EOF @@ -695,7 +695,7 @@ test_expect_success 'status while reverting commit (conflicts)' ' test_commit new to-revert.txt && TO_REVERT=$(git rev-parse --short HEAD^) && test_must_fail git revert $TO_REVERT && - cat >expected <expected <to-revert.txt && git add to-revert.txt && - cat >expected <expected <expected <<\EOF + cat >expected <<\EOF && On branch master nothing to commit (use -u to show untracked files) EOF From bffd8098705ffcfeb267951dcdd4e49dd188a7bb Mon Sep 17 00:00:00 2001 From: Ralf Thielow Date: Fri, 11 Oct 2013 17:58:37 +0200 Subject: [PATCH 2/2] status: show commit sha1 in "You are currently cherry-picking" message Especially helpful when cherry-picking multiple commits. Signed-off-by: Ralf Thielow Acked-by: Matthieu Moy Signed-off-by: Jonathan Nieder --- t/t7512-status-help.sh | 10 ++++++---- wt-status.c | 7 +++++-- wt-status.h | 1 + 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/t/t7512-status-help.sh b/t/t7512-status-help.sh index 9905d43c74..3cec57af1e 100755 --- a/t/t7512-status-help.sh +++ b/t/t7512-status-help.sh @@ -626,9 +626,10 @@ test_expect_success 'prepare for cherry-pick conflicts' ' test_expect_success 'status when cherry-picking before resolving conflicts' ' test_when_finished "git cherry-pick --abort" && test_must_fail git cherry-pick cherry_branch_second && - cat >expected <<\EOF && + TO_CHERRY_PICK=$(git rev-parse --short CHERRY_PICK_HEAD) && + cat >expected <main.txt && git add main.txt && - cat >expected <<\EOF && + cat >expected <cherry_pick_head_sha1, DEFAULT_ABBREV)); if (s->hints) { if (has_unmerged(s)) status_printf_ln(s, color, @@ -1169,8 +1170,10 @@ void wt_status_get_state(struct wt_status_state *state, state->rebase_in_progress = 1; state->branch = read_and_strip_branch("rebase-merge/head-name"); state->onto = read_and_strip_branch("rebase-merge/onto"); - } else if (!stat(git_path("CHERRY_PICK_HEAD"), &st)) { + } else if (!stat(git_path("CHERRY_PICK_HEAD"), &st) && + !get_sha1("CHERRY_PICK_HEAD", sha1)) { state->cherry_pick_in_progress = 1; + hashcpy(state->cherry_pick_head_sha1, sha1); } if (!stat(git_path("BISECT_LOG"), &st)) { state->bisect_in_progress = 1; diff --git a/wt-status.h b/wt-status.h index 9341c569a5..6c29e6f5e5 100644 --- a/wt-status.h +++ b/wt-status.h @@ -88,6 +88,7 @@ struct wt_status_state { char *detached_from; unsigned char detached_sha1[20]; unsigned char revert_head_sha1[20]; + unsigned char cherry_pick_head_sha1[20]; }; void wt_status_prepare(struct wt_status *s);