git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] git-p4: fix bug in symlink handling
@ 2010-02-16  8:44 Evan Powers
  2010-02-20 14:05 ` Pete Wyckoff
  0 siblings, 1 reply; 3+ messages in thread
From: Evan Powers @ 2010-02-16  8:44 UTC (permalink / raw)
  To: git; +Cc: gitster, Simon Hausmann, Luke Diamand

Fix inadvertent breakage from b932705 in the code that strips the
trailing '\n' from p4 print on a symlink. (In practice, contents is of
the form ['target\n', ''].)

Signed-off-by: Evan Powers <evan.powers@gmail.com>
---
This patch Works For Me, but I didn't take the time to understand the
entire code path so it might be equally valid to replace contents.pop()
with contents.pop(0) and call it a day.

 contrib/fast-import/git-p4 |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
index e7c4814..cd96c6f 100755
--- a/contrib/fast-import/git-p4
+++ b/contrib/fast-import/git-p4
@@ -967,9 +967,8 @@ class P4Sync(Command):
         elif file["type"] == "symlink":
             mode = "120000"
             # p4 print on a symlink contains "target\n", so strip it off
-            last = contents.pop()
-            last = last[:-1]
-            contents.append(last)
+            data = ''.join(contents)
+            contents = [data[:-1]]

         if self.isWindows and file["type"].endswith("text"):
             mangled = []
-- 
1.6.6

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-p4: fix bug in symlink handling
  2010-02-16  8:44 [PATCH] git-p4: fix bug in symlink handling Evan Powers
@ 2010-02-20 14:05 ` Pete Wyckoff
  2010-02-20 19:22   ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Pete Wyckoff @ 2010-02-20 14:05 UTC (permalink / raw)
  To: Evan Powers; +Cc: git, gitster, Simon Hausmann, Luke Diamand

evan.powers@gmail.com wrote on Tue, 16 Feb 2010 00:44 -0800:
> Fix inadvertent breakage from b932705 in the code that strips the
> trailing '\n' from p4 print on a symlink. (In practice, contents is of
> the form ['target\n', ''].)
> 
> Signed-off-by: Evan Powers <evan.powers@gmail.com>

Acked-by: Pete Wyckoff <pw@padd.com>

This was indeed an inadvertent bug introduced by that commit.
Old code just appended all the data sections so did not see the
null.  This fix works for me.

		-- Pete

> ---
> This patch Works For Me, but I didn't take the time to understand the
> entire code path so it might be equally valid to replace contents.pop()
> with contents.pop(0) and call it a day.
> 
>  contrib/fast-import/git-p4 |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/contrib/fast-import/git-p4 b/contrib/fast-import/git-p4
> index e7c4814..cd96c6f 100755
> --- a/contrib/fast-import/git-p4
> +++ b/contrib/fast-import/git-p4
> @@ -967,9 +967,8 @@ class P4Sync(Command):
>          elif file["type"] == "symlink":
>              mode = "120000"
>              # p4 print on a symlink contains "target\n", so strip it off
> -            last = contents.pop()
> -            last = last[:-1]
> -            contents.append(last)
> +            data = ''.join(contents)
> +            contents = [data[:-1]]
> 
>          if self.isWindows and file["type"].endswith("text"):
>              mangled = []
> -- 
> 1.6.6
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] git-p4: fix bug in symlink handling
  2010-02-20 14:05 ` Pete Wyckoff
@ 2010-02-20 19:22   ` Junio C Hamano
  0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2010-02-20 19:22 UTC (permalink / raw)
  To: Pete Wyckoff; +Cc: Evan Powers, git, gitster, Simon Hausmann, Luke Diamand

Thanks; will apply to 'maint'.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-02-20 19:22 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-16  8:44 [PATCH] git-p4: fix bug in symlink handling Evan Powers
2010-02-20 14:05 ` Pete Wyckoff
2010-02-20 19:22   ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).