All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Brown <git@davidb.org>
To: git@vger.kernel.org
Cc: David Brown <git@davidb.org>
Subject: [PATCH] [git-p4] Detect exec bit in more cases.
Date: Wed, 19 Sep 2007 13:12:48 -0700	[thread overview]
Message-ID: <1190232768445-git-send-email-git@davidb.org> (raw)
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

  parent reply	other threads:[~2007-09-19 20:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-19 18:15 [PATCH] [git-p4] Detect exec bit in more cases David Brown
2007-09-19 19:03 ` Simon Hausmann
2007-09-19 19:14   ` David Brown
2007-09-19 19:31     ` Dana How
2007-09-19 19:49       ` David Brown
2007-09-20 15:16   ` David Brown
2007-09-20 22:53     ` Junio C Hamano
2007-09-21 10:20       ` Simon Hausmann
2007-09-21 21:15         ` Junio C Hamano
2007-09-21 21:24           ` David Brown
2007-09-24  6:20             ` Simon Hausmann
2007-09-19 20:12 ` David Brown [this message]
2007-09-19 21:03   ` David Brown

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

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

  git send-email \
    --in-reply-to=1190232768445-git-send-email-git@davidb.org \
    --to=git@davidb.org \
    --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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.