[PATCH 1/2] tests: add test case for autocorrect in work tree for bare clone

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Simon Gerber <gesimu@xxxxxxxxx>

Currently, auto correction doesn't work reliably for commands which must
run in a work tree (e.g. `git status`) in Git work trees which are
created from a bare repository.

This commit adds a test which shows the broken autocompletion by calling
`git stauts` which gets autocorrected to `git status`. This works fine
in a work tree created with `git worktree add` from a regular clone, but
doesn't work in a work tree created with `git worktree add` from a bare
clone.

Signed-off-by: Simon Gerber <gesimu@xxxxxxxxx>
---
 t/t9005-help-autocorrect-worktree.sh | 29 ++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100755 t/t9005-help-autocorrect-worktree.sh

diff --git a/t/t9005-help-autocorrect-worktree.sh b/t/t9005-help-autocorrect-worktree.sh
new file mode 100755
index 00000000000..4fecc8a8e01
--- /dev/null
+++ b/t/t9005-help-autocorrect-worktree.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+test_description='test autocorrect in work tree based on bare repository'
+. ./test-lib.sh
+
+test_expect_success 'setup non-bare' '
+	echo one >file &&
+	git add file &&
+	git commit -m one &&
+	echo two >file &&
+	git commit -a -m two
+'
+
+test_expect_success 'setup bare' '
+	git clone --bare . bare.git &&
+	cd bare.git
+'
+
+test_expect_success 'setup worktree from bare' '
+	git worktree add ../bare-wt &&
+	cd ../bare-wt
+'
+
+test_expect_success 'autocorrect works in work tree created from bare repo' '
+	git config help.autocorrect immediate &&
+	git stauts
+'
+
+test_done
-- 
gitgitgadget




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux