git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Lars Schneider <larsxschneider@gmail.com>
To: Luke Diamand <luke@diamand.org>
Cc: Git Users <git@vger.kernel.org>, Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v7 0/7] git-p4: add support for large file systems
Date: Wed, 23 Sep 2015 10:50:58 +0200	[thread overview]
Message-ID: <A29B974F-2B42-475F-92B6-8B25A54FCDEE@gmail.com> (raw)
In-Reply-To: <CE59FE83-4EE1-41EF-85B6-63EA51BD9E3B@gmail.com>


On 23 Sep 2015, at 10:18, Lars Schneider <larsxschneider@gmail.com> wrote:

> 
> On 23 Sep 2015, at 09:58, Luke Diamand <luke@diamand.org> wrote:
> 
>> On 21 September 2015 at 23:41,  <larsxschneider@gmail.com> wrote:
>>> From: Lars Schneider <larsxschneider@gmail.com>
>>> 
>>> diff to v6:
>>> * fix spaces in .gitattributes for Git-LFS files (old "[:space:]", new "[[:space:]]")
>>> * generated patch on top of next (95c4325) to resolve merge conflicts
>> 
>> Trying this out by hand (rather than using the test cases) it crashes
>> for me. Am I doing something wrong?
>> 
>> - I've got the version of git-p4.py from
>> ef93b8df71f6d8a7936786c989714868c2d3540c in Junio's ls/p4-lfs branch.
>> - I have git-lfs v0.60 (just downloaded the binary distribution).
>> 
>> Then I created a p4 repo, and added two files in Perforce, small.txt
>> and bigfile. bigfile is 400k.
>> 
>> Doing a regular git clone works fine:
>> 
>> $ mkdir depot
>> $ cd depot
>> $ git init .
>> $ git p4 sync //depot
>> $ git checkout p4/master
>> 
>> (I'm using git init + git sync rather than git clone so that I can
>> setup the git config variables I need in the next step).
>> 
>> Doing a clone with LFS support though doesn't work:
>> 
>> $ mkdir depot2
>> $ cd depot2
>> $ git init
>> $ git config git-p4.largeFileSystem GitLFS
>> $ git config git-p4.largeFileThreshold 100k
>> $ git p4 sync //depot
>> Doing initial import of //depot/ from revision #head into refs/remotes/p4/master
>> Traceback (most recent call last):
>> File "/home/ldiamand/git/git/git-p4.py", line 3624, in <module>
>>   main()
>> File "/home/ldiamand/git/git/git-p4.py", line 3618, in main
>>   if not cmd.run(args):
>> File "/home/ldiamand/git/git/git-p4.py", line 3298, in run
>>   self.importHeadRevision(revision)
>> File "/home/ldiamand/git/git/git-p4.py", line 3085, in importHeadRevision
>>   self.commit(details, self.extractFilesFromCommit(details), self.branch)
>> File "/home/ldiamand/git/git/git-p4.py", line 2651, in commit
>>   self.streamP4Files(new_files)
>> File "/home/ldiamand/git/git/git-p4.py", line 2565, in streamP4Files
>>   cb=streamP4FilesCbSelf)
>> File "/home/ldiamand/git/git/git-p4.py", line 501, in p4CmdList
>>   cb(entry)
>> File "/home/ldiamand/git/git/git-p4.py", line 2559, in streamP4FilesCbSelf
>>   self.streamP4FilesCb(entry)
>> File "/home/ldiamand/git/git/git-p4.py", line 2501, in streamP4FilesCb
>>   self.streamOneP4File(self.stream_file, self.stream_contents)
>> File "/home/ldiamand/git/git/git-p4.py", line 2451, in streamOneP4File
>>   (git_mode, contents) =
>> self.largeFileSystem.processContent(self.cloneDestination, git_mode,
>> relPath, contents)
>> File "/home/ldiamand/git/git/git-p4.py", line 1111, in processContent
>>   return LargeFileSystem.processContent(self, cloneDestination,
>> git_mode, relPath, contents)
>> File "/home/ldiamand/git/git/git-p4.py", line 1004, in processContent
>>   (git_mode, contents, localLargeFile) =
>> self.generatePointer(cloneDestination, contentTempFile)
>> File "/home/ldiamand/git/git/git-p4.py", line 1068, in generatePointer
>>   oid,
>> File "/usr/lib/python2.7/posixpath.py", line 70, in join
>>   elif path == '' or path.endswith('/'):
>> AttributeError: 'NoneType' object has no attribute 'endswith'
>> 
> Confirmed. This is a bug!
> 
> Can you try the following sequence of commands?
> 
> $ mkdir depot2
> $ cd depot2
> $ git init
> $ git config git-p4.largeFileSystem GitLFS
> $ git config git-p4.largeFileThreshold 100k
> $ git p4 clone --destination=. //depot
> 
> I’ve always used “clone” and all test cases uses “clone”. I will fix it for “sync”.
> 
> Thanks for reporting,
> Lars

I think I found an easy fix. Can you try it?

(in case my mail app messes something up: I changed line 2240 in git-p4.py to 'self.cloneDestination = os.getcwd()’)

Thanks,
Lars


diff --git a/git-p4.py b/git-p4.py
index 8c7496d..1d1bb87 100755
--- a/git-p4.py
+++ b/git-p4.py
@@ -2237,7 +2237,7 @@ class P4Sync(Command, P4UserMap):
         self.tempBranches = []
         self.tempBranchLocation = "git-p4-tmp"
         self.largeFileSystem = None
-        self.cloneDestination = None
+        self.cloneDestination = os.getcwd()

         if gitConfig('git-p4.largeFileSystem'):
             largeFileSystemConstructor = globals()[gitConfig('git-p4.largeFileSystem')]
diff --git a/t/t9824-git-p4-git-lfs.sh b/t/t9824-git-p4-git-lfs.sh
index 7385a2b..6d374c0 100755
--- a/t/t9824-git-p4-git-lfs.sh
+++ b/t/t9824-git-p4-git-lfs.sh
@@ -86,6 +86,35 @@ test_expect_success 'Store files in LFS based on size (>24 bytes)' '
        )
 '

+test_expect_success 'Store files in LFS based on size (>24 bytes) and use git p4 sync and no client spec' '
+       test_when_finished cleanup_git &&
+       (
+               cd "$git" &&
+               git init . &&
+               git config git-p4.largeFileSystem GitLFS &&
+               git config git-p4.largeFileThreshold 24 &&
+               git p4 sync //depot &&
+               git checkout p4/master
+               test_file_in_lfs file2.dat 25 "content 2-3 bin 25 bytes" &&
+               test_file_in_lfs "path with spaces/file3.bin" 25 "content 2-3 bin 25 bytes" &&
+               test_file_in_lfs file4.bin 26 "content 4 bin 26 bytes XX" &&
+
+               test_file_count_in_dir ".git/lfs/objects" 2 &&
+
+               cat >expect <<-\EOF &&
+
+               #
+               # Git LFS (see https://git-lfs.github.com/)
+               #
+               /file2.dat filter=lfs -text
+               /file4.bin filter=lfs -text
+               /path[[:space:]]with[[:space:]]spaces/file3.bin filter=lfs -text
+               EOF
+               test_path_is_file .gitattributes &&
+               test_cmp expect .gitattributes
+       )
+'
+
 test_expect_success 'Store files in LFS based on size (>25 bytes)' '
        client_view "//depot/... //client/..." &&
        test_when_finished cleanup_git &&

  reply	other threads:[~2015-09-23  8:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-21 22:41 [PATCH v7 0/7] git-p4: add support for large file systems larsxschneider
2015-09-21 22:41 ` [PATCH v7 1/7] git-p4: add optional type specifier to gitConfig reader larsxschneider
2015-09-22 21:49   ` Junio C Hamano
2015-09-23  7:38     ` Lars Schneider
2015-09-21 22:41 ` [PATCH v7 2/7] git-p4: add gitConfigInt reader larsxschneider
2015-09-21 22:41 ` [PATCH v7 3/7] git-p4: return an empty list if a list config has no values larsxschneider
2015-09-21 22:41 ` [PATCH v7 4/7] git-p4: add file streaming progress in verbose mode larsxschneider
2015-09-21 22:41 ` [PATCH v7 5/7] git-p4: check free space during streaming larsxschneider
2015-09-21 22:41 ` [PATCH v7 6/7] git-p4: add support for large file systems larsxschneider
2015-09-25  9:09   ` Luke Diamand
2015-09-21 22:41 ` [PATCH v7 7/7] git-p4: add Git LFS backend for large file system larsxschneider
2015-09-22 22:03 ` [PATCH v7 0/7] git-p4: add support for large file systems Junio C Hamano
2015-09-23  7:41   ` Lars Schneider
2015-09-23  7:58 ` Luke Diamand
2015-09-23  8:18   ` Lars Schneider
2015-09-23  8:50     ` Lars Schneider [this message]
     [not found]       ` <CAE5ih7-NqSd+zSqTungDt5oWzy4QT--vjYaShd=YDzGxHosz3A@mail.gmail.com>
     [not found]         ` <ECBECF84-28A9-4E10-907C-8E670F864A25@gmail.com>
     [not found]           ` <CAE5ih7_StiXA-c5yER9jhc941vsKfvEUONLXQ4E7JANOhCxMxQ@mail.gmail.com>
2015-09-23 11:25             ` Luke Diamand
2015-09-23 11:42               ` Lars Schneider
2015-09-24 20:44                 ` Luke Diamand
2015-09-25  8:35                   ` Lars Schneider
2015-09-25  9:00                     ` Luke Diamand

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=A29B974F-2B42-475F-92B6-8B25A54FCDEE@gmail.com \
    --to=larsxschneider@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=luke@diamand.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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).