git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 1/4] completion: squelch stray errors in sparse-checkout completion

From
Elijah Newren via GitGitGadget <gitgitgadget@gmail.com>
Date
Nov 23, 2023, 17:44 UTC
Message-ID
<591c7b8d73b1a93feaa749d68156a198a7e32a9c.1700761448.git.gitgitgadget@gmail.com>
In-Reply-To
<pull.1349.git.1700761448.gitgitgadget@gmail.com>
From: Elijah Newren <newren@gmail.com>
If, in the root of a project, one types
    git sparse-checkout set --cone ../<TAB>
then an error message of the form
    fatal: ../: '../' is outside repository at '/home/newren/floss/git'

is written to stderr, which munges the users view of their own command. Squelch such messages.

Signed-off-by: Elijah Newren <newren@gmail.com>
---
 contrib/completion/git-completion.bash | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index ba5c395d2d8..6fced40d04c 100644
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -3014,7 +3014,7 @@ __gitcomp_directories ()
 			COMPREPLY+=("$c/")
 			_found=1
 		fi
-	done < <(git ls-tree -z -d --name-only HEAD $_tmp_dir)
+	done < <(git ls-tree -z -d --name-only HEAD $_tmp_dir 2>/dev/null)
 
 	if [[ $_found == 0 ]] && [[ "$cur" =~ /$ ]]; then
 		# No possible further completions any deeper, so assume we're at
-- 
gitgitgadget
Previous: Elijah Newren via GitGitGadgetNext: SZEDER Gábor
Message 2 of 22 in “Sparse checkout completion fixes”
  1. 0/4 Sparse checkout completion fixesElijah Newren via GitGitGadget, Nov 23, 2023
  2. 1/4 completion: squelch stray errors in sparse-checkout completionElijah Newren via GitGitGadget, Nov 23, 2023
  3. SZEDER GáborNov 24, 2023
  4. Elijah NewrenNov 24, 2023
  5. 2/4 completion: fix logic for determining whether cone mode is activeElijah Newren via GitGitGadget, Nov 23, 2023
  6. 3/4 completion: avoid misleading completions in cone modeElijah Newren via GitGitGadget, Nov 23, 2023
  7. 4/4 completion: avoid user confusion in non-cone modeElijah Newren via GitGitGadget, Nov 23, 2023
  8. Junio C HamanoNov 24, 2023
  9. Elijah NewrenNov 24, 2023
  10. Junio C HamanoNov 27, 2023
  11. Elijah NewrenDec 3, 2023
  12. 0/4 Sparse checkout completion fixesElijah Newren via GitGitGadget, Nov 26, 2023
  13. 1/4 completion: squelch stray errors in sparse-checkout completionElijah Newren via GitGitGadget, Nov 26, 2023
  14. 2/4 completion: fix logic for determining whether cone mode is activeElijah Newren via GitGitGadget, Nov 26, 2023
  15. 3/4 completion: avoid misleading completions in cone modeElijah Newren via GitGitGadget, Nov 26, 2023
  16. 4/4 completion: avoid user confusion in non-cone modeElijah Newren via GitGitGadget, Nov 26, 2023
  17. 0/4 Sparse checkout completion fixesElijah Newren via GitGitGadget, Dec 3, 2023
  18. 1/4 completion: squelch stray errors in sparse-checkout completionElijah Newren via GitGitGadget, Dec 3, 2023
  19. 2/4 completion: fix logic for determining whether cone mode is activeElijah Newren via GitGitGadget, Dec 3, 2023
  20. 3/4 completion: avoid misleading completions in cone modeElijah Newren via GitGitGadget, Dec 3, 2023
  21. 4/4 completion: avoid user confusion in non-cone modeElijah Newren via GitGitGadget, Dec 3, 2023
  22. Junio C HamanoDec 3, 2023

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.