Skip to content

Commit

Permalink
Detect exec bit in more cases.
Browse files Browse the repository at this point in the history
git-p4 was missing the execute bit setting if the file had other attribute
bits set.

Acked-By: Simon Hausmann <simon@lst.de>
  • Loading branch information
David Brown authored and Junio C Hamano committed Sep 22, 2007
1 parent 9c2d28c commit b9fc6ea
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion contrib/fast-import/git-p4
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -916,7 +924,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"
Expand Down

0 comments on commit b9fc6ea

Please sign in to comment.