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

[PATCH] [git-p4] Detect exec bit in more cases.

From
David Brown <git@davidb.org>
Date
Sep 19, 2007, 20:12 UTC
Message-ID
<1190232768445-git-send-email-git@davidb.org>
In-Reply-To
<119022570352-git-send-email-git@davidb.org>
git-p4 was missing the execute bit setting if the file had other attribute
bits set.
---
 contrib/fast-import/git-p4 |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index adaaae6..557649a 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -63,6 +63,14 @@ def system(cmd):
     if os.system(cmd) != 0:
         die("command failed: %s" % cmd)
 
+def isP4Exec(kind):
+    """Determine if a Perforce 'kind' should have execute permission
+
+    'p4 help filetypes' gives a list of the types.  If it starts with 'x',
+    or x follows one of a few letters.  Otherwise, if there is an 'x' after
+    a plus sign, it is also executable"""
+    return (re.search(r"(^[cku]?x)|\+.*x", kind) != None)
+
 def p4CmdList(cmd, stdin=None, stdin_mode='w+b'):
     cmd = "p4 -G %s" % cmd
     if verbose:
@@ -932,7 +940,7 @@ class P4Sync(Command):
                 data = file['data']
 
                 mode = "644"
-                if file["type"].startswith("x"):
+                if isP4Exec(file["type"]):
                     mode = "755"
                 elif file["type"] == "symlink":
                     mode = "120000"
-- 
1.5.3
Previous: Simon HausmannNext: David Brown
Message 12 of 13 in “[git-p4] Detect exec bit in more cases.”
  1. [git-p4] Detect exec bit in more cases.David Brown, Sep 19, 2007
  2. Simon HausmannSep 19, 2007
  3. David BrownSep 19, 2007
  4. Dana HowSep 19, 2007
  5. David BrownSep 19, 2007
  6. David BrownSep 20, 2007
  7. Junio C HamanoSep 20, 2007
  8. Simon HausmannSep 21, 2007
  9. Junio C HamanoSep 21, 2007
  10. David BrownSep 21, 2007
  11. Simon HausmannSep 24, 2007
  12. [git-p4] Detect exec bit in more cases.David Brown, Sep 19, 2007
  13. David BrownSep 19, 2007

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.