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

[PATCH] pathsec: make check for PATHSPEC_LITERAL more readable

From
AGAreaZR via GitGitGadget <gitgitgadget@gmail.com>
Date
Dec 18, 2024, 03:53 UTC
Message-ID
<pull.1453.git.git.1734493992236.gitgitgadget@gmail.com>
From: Seija Kijin <doremylover123@gmail.com>

This check is designed to die if global_magic has the PATHSPEC_LITERAL and any other setting.

This can be written is a much more obvious way: if global_magic has PATHSPEC_LITERAL, it can only BE PATHSPEC_LITERAL, and if it isn't then there are other settings.

Signed-off-by: Seija Kijin <doremylover123@gmail.com>
---
    pathsec: make check for PATHSPEC_LITERAL more readable
    
    This check is designed to die if global_magic has the PATHSPEC_LITERAL
    and any other setting.
    
    This can be written is a much more obvious way: if global_magic has
    PATHSPEC_LITERAL, it can only BE PATHSPEC_LITERAL, and if it isn't then
    there are other settings.
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-1453%2FAreaZR%2Fredundant-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-1453/AreaZR/redundant-v1
Pull-Request: https://github.com/git/git/pull/1453
 pathspec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pathspec.c b/pathspec.c
index 0fc6f84a6e6..0af953d055d 100644
--- a/pathspec.c
+++ b/pathspec.c
@@ -313,7 +313,7 @@ static int get_global_magic(int element_magic)
 		global_magic |= PATHSPEC_ICASE;
 
 	if ((global_magic & PATHSPEC_LITERAL) &&
-	    (global_magic & ~PATHSPEC_LITERAL))
+	    (global_magic != PATHSPEC_LITERAL))
 		die(_("global 'literal' pathspec setting is incompatible "
 		      "with all other global pathspec settings"));
 

base-commit: d882f382b3d939d90cfa58d17b17802338f05d66
-- 
gitgitgadget
Next: Kristoffer Haugsbakk
Message 1 of 2 in “pathsec: make check for PATHSPEC_LITERAL more readable”
  1. pathsec: make check for PATHSPEC_LITERAL more readableAreaZR via GitGitGadget, Dec 18, 2024
  2. Kristoffer HaugsbakkDec 18, 2024

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.