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

13 messages from 2007-09-19 to 2007-09-24. Participants: David Brown, Simon Hausmann, Dana How, Junio C Hamano.
Thread: https://gitlist.dev/t/9944

## David Brown, 2007-09-19 18:15

Subject: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <119022570352-git-send-email-git@davidb.org>
URL: https://gitlist.dev/e/119022570352-git-send-email-git%40davidb.org

```
git-p4 was missing the execute bit setting if the file had other attribute
bits set.
---
 contrib/fast-import/git-p4 |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index adaaae6..50850b8 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -932,7 +932,10 @@ class P4Sync(Command):
                 data = file['data']
 
                 mode = "644"
-                if file["type"].startswith("x"):
+                if (file["type"].startswith("x") or
+                        file["type"].startswith("cx") or
+                        file["type"].startswith("kx") or
+                        file["type"].startswith("ux")):
                     mode = "755"
                 elif file["type"] == "symlink":
                     mode = "120000"
-- 
1.5.3.1

```

## Simon Hausmann, 2007-09-19 19:03

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <200709192103.53526.simon@lst.de>
URL: https://gitlist.dev/e/200709192103.53526.simon%40lst.de
In-Reply-To: <119022570352-git-send-email-git@davidb.org>

```
On Wednesday 19 September 2007 20:15:03 David Brown wrote:
> git-p4 was missing the execute bit setting if the file had other attribute
> bits set.
> ---
>  contrib/fast-import/git-p4 |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
>
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index adaaae6..50850b8 100755
> --- a/contrib/fast-import/git-p4
> +++ b/contrib/fast-import/git-p4
> @@ -932,7 +932,10 @@ class P4Sync(Command):
>                  data = file['data']
>
>                  mode = "644"
> -                if file["type"].startswith("x"):
> +                if (file["type"].startswith("x") or
> +                        file["type"].startswith("cx") or
> +                        file["type"].startswith("kx") or
> +                        file["type"].startswith("ux")):
>                      mode = "755"
>                  elif file["type"] == "symlink":
>                      mode = "120000"

I'm fine with this, so unless you find a better way:

Acked-By: Simon Hausmann <simon@lst.de>


Simon

```

## David Brown, 2007-09-19 19:14

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <20070919191412.GA6475@old.davidb.org>
URL: https://gitlist.dev/e/20070919191412.GA6475%40old.davidb.org
In-Reply-To: <200709192103.53526.simon@lst.de>

```
On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>> git-p4 was missing the execute bit setting if the file had other attribute
>> bits set.
>> ---
>>  contrib/fast-import/git-p4 |    5 ++++-
>>  1 files changed, 4 insertions(+), 1 deletions(-)
>>
>> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
>> index adaaae6..50850b8 100755
>> --- a/contrib/fast-import/git-p4
>> +++ b/contrib/fast-import/git-p4
>> @@ -932,7 +932,10 @@ class P4Sync(Command):
>>                  data = file['data']
>>
>>                  mode = "644"
>> -                if file["type"].startswith("x"):
>> +                if (file["type"].startswith("x") or
>> +                        file["type"].startswith("cx") or
>> +                        file["type"].startswith("kx") or
>> +                        file["type"].startswith("ux")):
>>                      mode = "755"
>>                  elif file["type"] == "symlink":
>>                      mode = "120000"
>
>I'm fine with this, so unless you find a better way:

Well, I just tested it, and it still doesn't work, so I need to take some
time and try to figure out what is happening.

I'm sometimes getting back 'xtext', and sometimes things like 'text+mx'
back from perforce, so I need to read up, and really figure out what to
look for.

David

```

## Dana How, 2007-09-19 19:31

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <56b7f5510709191231g22385e32y9c34d711d65b3bb7@mail.gmail.com>
URL: https://gitlist.dev/e/56b7f5510709191231g22385e32y9c34d711d65b3bb7%40mail.gmail.com
In-Reply-To: <20070919191412.GA6475@old.davidb.org>

```
On 9/19/07, David Brown <git@davidb.org> wrote:
> On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
> >On Wednesday 19 September 2007 20:15:03 David Brown wrote:
> >> git-p4 was missing the execute bit setting if the file had other attribute
> >> bits set.
> >
> >I'm fine with this, so unless you find a better way:
>
> Well, I just tested it, and it still doesn't work, so I need to take some
> time and try to figure out what is happening.
>
> I'm sometimes getting back 'xtext', and sometimes things like 'text+mx'
> back from perforce, so I need to read up, and really figure out what to
> look for.

The output of "git p4 filetypes" was enough for me
when I wrote my p4 front-end to fast-import;
I never did read the p4 manual.

Have fun,
-- 
Dana L. How  danahow@gmail.com  +1 650 804 5991 cell

```

## David Brown, 2007-09-19 19:49

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <20070919194944.GA11271@old.davidb.org>
URL: https://gitlist.dev/e/20070919194944.GA11271%40old.davidb.org
In-Reply-To: <56b7f5510709191231g22385e32y9c34d711d65b3bb7@mail.gmail.com>

```
On Wed, Sep 19, 2007 at 12:31:52PM -0700, Dana How wrote:
>On 9/19/07, David Brown <git@davidb.org> wrote:
>> On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>> >On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>> >> git-p4 was missing the execute bit setting if the file had other attribute
>> >> bits set.
>> >
>> >I'm fine with this, so unless you find a better way:
>>
>> Well, I just tested it, and it still doesn't work, so I need to take some
>> time and try to figure out what is happening.
>>
>> I'm sometimes getting back 'xtext', and sometimes things like 'text+mx'
>> back from perforce, so I need to read up, and really figure out what to
>> look for.
>
>The output of "git p4 filetypes" was enough for me
>when I wrote my p4 front-end to fast-import;
>I never did read the p4 manual.

I have a patch based on what 'p4 help filetypes'.  I'm running it now on a
large test repository, and I'll compare the results when it is done.
Provided it works, I'll send a new patch in a little bit.

David

```

## David Brown, 2007-09-19 20:12

Subject: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <1190232768445-git-send-email-git@davidb.org>
URL: https://gitlist.dev/e/1190232768445-git-send-email-git%40davidb.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

```

## David Brown, 2007-09-19 21:03

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <20070919210318.GA32131@old.davidb.org>
URL: https://gitlist.dev/e/20070919210318.GA32131%40old.davidb.org
In-Reply-To: <1190232768445-git-send-email-git@davidb.org>

```
On Wed, Sep 19, 2007 at 01:12:48PM -0700, David Brown wrote:
>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(-)

I've tested this patch on our fairly large P4 repo, and at least the tip
exactly matches the files that P4 finds.  So, it at least should be better.
git-p4 still has some problems with case-insensitive servers.

Dave

```

## David Brown, 2007-09-20 15:16

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <20070920151637.GA26873@old.davidb.org>
URL: https://gitlist.dev/e/20070920151637.GA26873%40old.davidb.org
In-Reply-To: <200709192103.53526.simon@lst.de>

```
On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>On Wednesday 19 September 2007 20:15:03 David Brown wrote:

>> git-p4 was missing the execute bit setting if the file had other attribute
>> bits set.
>> ---

>I'm fine with this, so unless you find a better way:
>
>Acked-By: Simon Hausmann <simon@lst.de>

I sent out an improved version of this patch yesterday
<1190232768445-git-send-email-git@davidb.org> that I'd like to get
approved.  I guess I'm not quite sure what happens at this point with a
patch.

Thanks,
David

```

## Junio C Hamano, 2007-09-20 22:53

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <7vodfxj6db.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vodfxj6db.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <20070920151637.GA26873@old.davidb.org>

```
David Brown <git@davidb.org> writes:

> On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>
>>> git-p4 was missing the execute bit setting if the file had other attribute
>>> bits set.
>>> ---
>
>>I'm fine with this, so unless you find a better way:
>>
>>Acked-By: Simon Hausmann <simon@lst.de>
>
> I sent out an improved version of this patch yesterday
> <1190232768445-git-send-email-git@davidb.org> that I'd like to get
> approved.  I guess I'm not quite sure what happens at this point with a
> patch.

I still have that *768445* message as "the last one proposed as
better than previous ones" in my mbox.

Simon?

```

## Simon Hausmann, 2007-09-21 10:20

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <200709211220.05434.simon@lst.de>
URL: https://gitlist.dev/e/200709211220.05434.simon%40lst.de
In-Reply-To: <7vodfxj6db.fsf@gitster.siamese.dyndns.org>

```
On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
> David Brown <git@davidb.org> writes:
> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
> >>> git-p4 was missing the execute bit setting if the file had other
> >>> attribute bits set.
> >>> ---
> >>
> >>I'm fine with this, so unless you find a better way:
> >>
> >>Acked-By: Simon Hausmann <simon@lst.de>
> >
> > I sent out an improved version of this patch yesterday
> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
> > approved.  I guess I'm not quite sure what happens at this point with a
> > patch.
>
> I still have that *768445* message as "the last one proposed as
> better than previous ones" in my mbox.
>
> Simon?

Indeed, the new improved version is much better :)

Acked-By: Simon Hausmann <simon@lst.de>


Simon

```

## Junio C Hamano, 2007-09-21 21:15

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <7vfy17iuu9.fsf@gitster.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vfy17iuu9.fsf%40gitster.siamese.dyndns.org
In-Reply-To: <200709211220.05434.simon@lst.de>

```
Simon Hausmann <simon@lst.de> writes:

> On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
>> David Brown <git@davidb.org> writes:
>> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>> >>> git-p4 was missing the execute bit setting if the file had other
>> >>> attribute bits set.
>> >>> ---
>> >>
>> >>I'm fine with this, so unless you find a better way:
>> >>
>> >>Acked-By: Simon Hausmann <simon@lst.de>
>> >
>> > I sent out an improved version of this patch yesterday
>> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
>> > approved.  I guess I'm not quite sure what happens at this point with a
>> > patch.
>>
>> I still have that *768445* message as "the last one proposed as
>> better than previous ones" in my mbox.
>>
>> Simon?
>
> Indeed, the new improved version is much better :)
>
> Acked-By: Simon Hausmann <simon@lst.de>

Thanks.  This should go to 'maint' (part of v1.5.3.3) right?

```

## David Brown, 2007-09-21 21:24

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <20070921212443.GA14983@old.davidb.org>
URL: https://gitlist.dev/e/20070921212443.GA14983%40old.davidb.org
In-Reply-To: <7vfy17iuu9.fsf@gitster.siamese.dyndns.org>

```
On Fri, Sep 21, 2007 at 02:15:10PM -0700, Junio C Hamano wrote:
>Simon Hausmann <simon@lst.de> writes:
>
>> On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
>>> David Brown <git@davidb.org> writes:
>>> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
>>> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
>>> >>> git-p4 was missing the execute bit setting if the file had other
>>> >>> attribute bits set.
>>> >>> ---
>>> >>
>>> >>I'm fine with this, so unless you find a better way:
>>> >>
>>> >>Acked-By: Simon Hausmann <simon@lst.de>
>>> >
>>> > I sent out an improved version of this patch yesterday
>>> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
>>> > approved.  I guess I'm not quite sure what happens at this point with a
>>> > patch.
>>>
>>> I still have that *768445* message as "the last one proposed as
>>> better than previous ones" in my mbox.
>>>
>>> Simon?
>>
>> Indeed, the new improved version is much better :)
>>
>> Acked-By: Simon Hausmann <simon@lst.de>
>
>Thanks.  This should go to 'maint' (part of v1.5.3.3) right?

Sounds good by me.  I've been using it on a few other repos, and haven't
had any problems.

David

```

## Simon Hausmann, 2007-09-24 06:20

Subject: Re: [PATCH] [git-p4] Detect exec bit in more cases.
Message-ID: <200709240820.45185.simon@lst.de>
URL: https://gitlist.dev/e/200709240820.45185.simon%40lst.de
In-Reply-To: <20070921212443.GA14983@old.davidb.org>

```
On Friday 21 September 2007 23:24:43 David Brown wrote:
> On Fri, Sep 21, 2007 at 02:15:10PM -0700, Junio C Hamano wrote:
> >Simon Hausmann <simon@lst.de> writes:
> >> On Friday 21 September 2007 00:53:52 Junio C Hamano wrote:
> >>> David Brown <git@davidb.org> writes:
> >>> > On Wed, Sep 19, 2007 at 09:03:50PM +0200, Simon Hausmann wrote:
> >>> >>On Wednesday 19 September 2007 20:15:03 David Brown wrote:
> >>> >>> git-p4 was missing the execute bit setting if the file had other
> >>> >>> attribute bits set.
> >>> >>> ---
> >>> >>
> >>> >>I'm fine with this, so unless you find a better way:
> >>> >>
> >>> >>Acked-By: Simon Hausmann <simon@lst.de>
> >>> >
> >>> > I sent out an improved version of this patch yesterday
> >>> > <1190232768445-git-send-email-git@davidb.org> that I'd like to get
> >>> > approved.  I guess I'm not quite sure what happens at this point with
> >>> > a patch.
> >>>
> >>> I still have that *768445* message as "the last one proposed as
> >>> better than previous ones" in my mbox.
> >>>
> >>> Simon?
> >>
> >> Indeed, the new improved version is much better :)
> >>
> >> Acked-By: Simon Hausmann <simon@lst.de>
> >
> >Thanks.  This should go to 'maint' (part of v1.5.3.3) right?
>
> Sounds good by me.  I've been using it on a few other repos, and haven't
> had any problems.

Agreed.


Simon

```
