git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Simon Gerber via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Simon Gerber <gesimu@gmail.com>, Simon Gerber <gesimu@gmail.com>
Subject: [PATCH 1/2] tests: add test case for autocorrect in work tree for bare clone
Date: Fri, 28 Oct 2022 15:24:04 +0000	[thread overview]
Message-ID: <d0a6eea93b58f5a267352690adde00a5b0f3f089.1666970645.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.1373.git.git.1666970645.gitgitgadget@gmail.com>

From: Simon Gerber <gesimu@gmail.com>

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@gmail.com>
---
 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


  reply	other threads:[~2022-10-28 15:24 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 15:24 [PATCH 0/2] Fix autocorrect in work tree for bare repository Simon Gerber via GitGitGadget
2022-10-28 15:24 ` Simon Gerber via GitGitGadget [this message]
2022-10-28 19:28   ` [PATCH 1/2] tests: add test case for autocorrect in work tree for bare clone Junio C Hamano
2022-10-29  8:07     ` Simon Gerber
2022-10-28 15:24 ` [PATCH 2/2] help.c: don't call git_default_config in git_unknown_cmd_config Simon Gerber via GitGitGadget
2022-10-29 19:56 ` [PATCH v2] help.c: fix autocorrect in work tree for bare repository Simon Gerber via GitGitGadget
2022-12-12 16:38   ` Simon Gerber
2022-12-13  1:37   ` Junio C Hamano
2022-12-13  9:48     ` Simon Gerber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0a6eea93b58f5a267352690adde00a5b0f3f089.1666970645.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=gesimu@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).