Skip to contentSkip to conversation

git-p4: add support for large file systems

PATCH Superseded [email protected] 3 participants 21 messages Jun 15, 2016 3 messages not in the archive Documentation

v7 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v7 cover git-p4: add support for large file systems

From: Lars Schneider <[email protected]>

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

I am sorry about the "[:space:]" bug this late. I had the fix in my development branch but missed to apply it in this patch series.

@Junio:
Your conflict resolution in pu looks good. Nevertheless, I made this patch on top of next to ease the integration. I hope this is ok.

Cheers,
Lars

Lars Schneider (7):
git-p4: add optional type specifier to gitConfig reader
git-p4: add gitConfigInt reader
git-p4: return an empty list if a list config has no values
git-p4: add file streaming progress in verbose mode
git-p4: check free space during streaming
git-p4: add support for large file systems
git-p4: add Git LFS backend for large file system

 Documentation/git-p4.txt   |  32 +++++
 git-p4.py                  | 278 ++++++++++++++++++++++++++++++++++++++++---
 t/t9823-git-p4-mock-lfs.sh | 170 ++++++++++++++++++++++++++
 t/t9824-git-p4-git-lfs.sh  | 288 +++++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 751 insertions(+), 17 deletions(-)
 create mode 100755 t/t9823-git-p4-mock-lfs.sh
 create mode 100755 t/t9824-git-p4-git-lfs.sh

--
2.5.1

#1 lore raw

PATCH v7 1/7 git-p4: add optional type specifier to gitConfig reader

From: Lars Schneider <[email protected]>

The functions “gitConfig” and “gitConfigBool” are almost identical. Make “gitConfig” more generic by adding an optional type specifier. Use the type specifier “—bool” with “gitConfig” to implement “gitConfigBool. This prepares the implementation of other type specifiers such as “—int”.

---
 git-p4.py | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
git-p4.py +6 -6
index 215f556..2659079 100755
@@ -604,9 +604,12 @@ def gitBranchExists(branch):
 
 _gitConfig = {}
 
-def gitConfig(key):
+def gitConfig(key, typeSpecifier=None):
     if not _gitConfig.has_key(key):
-        cmd = [ "git", "config", key ]
+        cmd = [ "git", "config" ]
+        if typeSpecifier:
+            cmd += [ typeSpecifier ]
+        cmd += [ key ]
         s = read_pipe(cmd, ignore_error=True)
         _gitConfig[key] = s.strip()
     return _gitConfig[key]
@@ -617,10 +620,7 @@ def gitConfigBool(key):
        in the config."""
 
     if not _gitConfig.has_key(key):
-        cmd = [ "git", "config", "--bool", key ]
-        s = read_pipe(cmd, ignore_error=True)
-        v = s.strip()
-        _gitConfig[key] = v == "true"
+        _gitConfig[key] = gitConfig(key, '--bool') == "true"
     return _gitConfig[key]
 
 def gitConfigList(key):
Signature · 1 line
2.5.1
#2 lore raw

Re: [PATCH v7 1/7] git-p4: add optional type specifier to gitConfig reader

Quoted 3 lines · [email protected] writes:

From: Lars Schneider <[email protected]>

The functions “gitConfig” and “gitConfigBool” are almost identical. Make “gitConfig” more generic by adding an optional type specifier. Use the type specifier “—bool” with “gitConfig” to implement “gitConfigBool. This prepares the implementation of other type specifiers such as “—int”.

What is this overlong single line paragraph? Is this a MUA artifact on my end?

#3 lore raw

Re: [PATCH v7 1/7] git-p4: add optional type specifier to gitConfig reader

Quoted 9 lines · Junio C Hamano
Quoted 3 lines · [email protected] writes:

From: Lars Schneider <[email protected]>

The functions “gitConfig” and “gitConfigBool” are almost identical. Make “gitConfig” more generic by adding an optional type specifier. Use the type specifier “—bool” with “gitConfig” to implement “gitConfigBool. This prepares the implementation of other type specifiers such as “—int”.

What is this overlong single line paragraph? Is this a MUA artifact on my end?

No. It looks like I messed that up. Same is true for the commit “git-p4: add gitConfigInt reader”. I’ll be more careful in the future.

Sorry,
Lars

#4 lore raw

PATCH v7 2/7 git-p4: add gitConfigInt reader

In reply to [email protected]

From: Lars Schneider <[email protected]>

Add a git config reader for integer variables. Please note that the git config implementation automatically supports k, m, and g suffixes.

---
 git-p4.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
git-p4.py +11 -0
index 2659079..2715895 100755
@@ -623,6 +623,17 @@ def gitConfigBool(key):
         _gitConfig[key] = gitConfig(key, '--bool') == "true"
     return _gitConfig[key]
 
+def gitConfigInt(key):
+    if not _gitConfig.has_key(key):
+        cmd = [ "git", "config", "--int", key ]
+        s = read_pipe(cmd, ignore_error=True)
+        v = s.strip()
+        try:
+            _gitConfig[key] = int(gitConfig(key, '--int'))
+        except ValueError:
+            _gitConfig[key] = None
+    return _gitConfig[key]
+
 def gitConfigList(key):
     if not _gitConfig.has_key(key):
         s = read_pipe(["git", "config", "--get-all", key], ignore_error=True)
Signature · 1 line
2.5.1
#5 lore raw

PATCH v7 3/7 git-p4: return an empty list if a list config has no values

In reply to [email protected]

From: Lars Schneider <[email protected]>

---
 git-p4.py | 2 ++
 1 file changed, 2 insertions(+)
git-p4.py +2 -0
index 2715895..e7d1b3f 100755
@@ -638,6 +638,8 @@ def gitConfigList(key):
     if not _gitConfig.has_key(key):
         s = read_pipe(["git", "config", "--get-all", key], ignore_error=True)
         _gitConfig[key] = s.strip().split(os.linesep)
+        if _gitConfig[key] == ['']:
+            _gitConfig[key] = []
     return _gitConfig[key]
 
 def p4BranchesInGit(branchesAreInRemotes=True):
Signature · 1 line
2.5.1
#6 lore raw

PATCH v7 4/7 git-p4: add file streaming progress in verbose mode

In reply to [email protected]

From: Lars Schneider <[email protected]>

If a file is streamed from P4 to Git then the verbose mode prints continuously the progress as percentage like this:
//depot/file.bin 20% (10 MB)

Upon completion the progress is overwritten with depot source, local file and size like this:
//depot/file.bin --> local/file.bin (10 MB)

---
 git-p4.py | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)
git-p4.py +18 -2
index e7d1b3f..fabc900 100755
@@ -2171,7 +2171,9 @@ class P4Sync(Command, P4UserMap):
     def streamOneP4File(self, file, contents):
         relPath = self.stripRepoPath(file['depotFile'], self.branchPrefixes)
         if verbose:
-            sys.stderr.write("%s\n" % relPath)
+            size = int(self.stream_file['fileSize'])
+            sys.stdout.write('\r%s --> %s (%i MB)\n' % (file['depotFile'], relPath, size/1024/1024))
+            sys.stdout.flush()
 
         (type_base, type_mods) = split_p4_type(file["type"])
 
@@ -2258,7 +2260,8 @@ class P4Sync(Command, P4UserMap):
     def streamOneP4Deletion(self, file):
         relPath = self.stripRepoPath(file['path'], self.branchPrefixes)
         if verbose:
-            sys.stderr.write("delete %s\n" % relPath)
+            sys.stdout.write("delete %s\n" % relPath)
+            sys.stdout.flush()
         self.gitStream.write("D %s\n" % relPath)
 
     # handle another chunk of streaming data
@@ -2298,10 +2301,23 @@ class P4Sync(Command, P4UserMap):
         # 'data' field we need to append to our array
         for k in marshalled.keys():
             if k == 'data':
+                if 'streamContentSize' not in self.stream_file:
+                    self.stream_file['streamContentSize'] = 0
+                self.stream_file['streamContentSize'] += len(marshalled['data'])
                 self.stream_contents.append(marshalled['data'])
             else:
                 self.stream_file[k] = marshalled[k]
 
+        if (verbose and
+            'streamContentSize' in self.stream_file and
+            'fileSize' in self.stream_file and
+            'depotFile' in self.stream_file):
+            size = int(self.stream_file["fileSize"])
+            if size > 0:
+                progress = 100*self.stream_file['streamContentSize']/size
+                sys.stdout.write('\r%s %d%% (%i MB)' % (self.stream_file['depotFile'], progress, int(size/1024/1024)))
+                sys.stdout.flush()
+
         self.stream_have_file_info = True
 
     # Stream directly from "p4 files" into "git fast-import"
Signature · 1 line
2.5.1
#7 lore raw

PATCH v7 5/7 git-p4: check free space during streaming

In reply to [email protected]

From: Lars Schneider <[email protected]>

git-p4 will just halt if there is not enough disk space while streaming content from P4 to Git. Add a check to ensure at least 4 times (arbitrarily chosen) the size of a streamed file is available.

---
 git-p4.py | 27 ++++++++++++++++++++++++++-
 1 file changed, 26 insertions(+), 1 deletion(-)
git-p4.py +26 -1
index fabc900..3931989 100755
@@ -104,6 +104,16 @@ def chdir(path, is_client_path=False):
         path = os.getcwd()
     os.environ['PWD'] = path
 
+def calcDiskFree(dirname):
+    """Return free space in bytes on the disk of the given dirname."""
+    if platform.system() == 'Windows':
+        free_bytes = ctypes.c_ulonglong(0)
+        ctypes.windll.kernel32.GetDiskFreeSpaceExW(ctypes.c_wchar_p(dirname), None, None, ctypes.pointer(free_bytes))
+        return free_bytes.value
+    else:
+        st = os.statvfs(dirname)
+        return st.f_bavail * st.f_frsize
+
 def die(msg):
     if verbose:
         raise Exception(msg)
@@ -2045,6 +2055,14 @@ class P4Sync(Command, P4UserMap):
         self.clientSpecDirs = None
         self.tempBranches = []
         self.tempBranchLocation = "git-p4-tmp"
+        self.largeFileSystem = None
+        self.cloneDestination = None
+
+        if gitConfig('git-p4.largeFileSystem'):
+            largeFileSystemConstructor = globals()[gitConfig('git-p4.largeFileSystem')]
+            self.largeFileSystem = largeFileSystemConstructor(
+                lambda git_mode, relPath, contents: self.writeToGitStream(git_mode, relPath, contents)
+            )
 
         if gitConfig("git-p4.syncFromOrigin") == "false":
             self.syncWithOrigin = False
@@ -2273,6 +2291,14 @@ class P4Sync(Command, P4UserMap):
             if marshalled["code"] == "error":
                 if "data" in marshalled:
                     err = marshalled["data"].rstrip()
+
+        if not err and self.cloneDestination and 'fileSize' in self.stream_file:
+            required_bytes = int((4 * int(self.stream_file["fileSize"])) - calcDiskFree(self.cloneDestination))
+            if required_bytes > 0:
+                err = 'Not enough space left on %s! Free at least %i MB.' % (
+                    os.path.abspath(self.cloneDestination), required_bytes/1024/1024
+                )
+
         if err:
             f = None
             if self.stream_have_file_info:
@@ -3244,7 +3270,6 @@ class P4Clone(P4Sync):
             optparse.make_option("--bare", dest="cloneBare",
                                  action="store_true", default=False),
         ]
-        self.cloneDestination = None
         self.needsGit = False
         self.cloneBare = False
 
Signature · 1 line
2.5.1
#8 lore raw

PATCH v7 6/7 git-p4: add support for large file systems

In reply to [email protected]

From: Lars Schneider <[email protected]>

Perforce repositories can contain large (binary) files. Migrating these repositories to Git generates very large local clones. External storage systems such as Git LFS [1], Git Fat [2], Git Media [3], git-annex [4] try to address this problem.

Add a generic mechanism to detect large files based on extension, uncompressed size, and/or compressed size.

[1] https://git-lfs.github.com/
[2] https://github.com/jedbrown/git-fat
[3] https://github.com/alebedev/git-media
[4] https://git-annex.branchable.com/

---
 Documentation/git-p4.txt   |  32 +++++++++
 git-p4.py                  | 138 +++++++++++++++++++++++++++++++++---
 t/t9823-git-p4-mock-lfs.sh | 170 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 330 insertions(+), 10 deletions(-)
 create mode 100755 t/t9823-git-p4-mock-lfs.sh
Documentation/git-p4.txt +32 -0
index 12a57d4..19833e6 100644
@@ -517,6 +517,38 @@ git-p4.pathEncoding::
 	to transcode the paths to UTF-8. As an example, Perforce on Windows
 	often uses “cp1252” to encode path names.
 
+git-p4.largeFileSystem::
+	Specify the system that is used for large (binary) files. Please note
+	that large file systems do not support the 'git p4 submit' command.
+	Only Git LFS [1] is implemented right now. Download
+	and install the Git LFS command line extension to use this option
+	and configure it like this:
++
+-------------
+git config       git-p4.largeFileSystem GitLFS
+-------------
++
+	[1] https://git-lfs.github.com/
+
+git-p4.largeFileExtensions::
+	All files matching a file extension in the list will be processed
+	by the large file system. Do not prefix the extensions with '.'.
+
+git-p4.largeFileThreshold::
+	All files with an uncompressed size exceeding the threshold will be
+	processed by the large file system. By default the threshold is
+	defined in bytes. Add the suffix k, m, or g to change the unit.
+
+git-p4.largeFileCompressedThreshold::
+	All files with a compressed size exceeding the threshold will be
+	processed by the large file system. This option might slow down
+	your clone/sync process. By default the threshold is defined in
+	bytes. Add the suffix k, m, or g to change the unit.
+
+git-p4.pushLargeFiles::
+	Boolean variable which defines if large files are automatically
+	pushed to a server.
+
 Submit variables
 ~~~~~~~~~~~~~~~~
 git-p4.detectRenames::
git-p4.py +128 -10

181 lines not on this page · raw message

t/t9823-git-p4-mock-lfs.sh new file +170 -0

170 lines not on this page · raw message

Signature · 1 line
2.5.1
#9 lore raw

One tiny comment, otherwise this looks good to me.

Can we use test_path_is_missing in place of !test_path_is_file ?

Quoted 49 lines · On 21 September 2015 at 23:41, <[email protected]> wrote:

From: Lars Schneider <[email protected]>

Perforce repositories can contain large (binary) files. Migrating these repositories to Git generates very large local clones. External storage systems such as Git LFS [1], Git Fat [2], Git Media [3], git-annex [4] try to address this problem.

Add a generic mechanism to detect large files based on extension, uncompressed size, and/or compressed size.

[1] https://git-lfs.github.com/
[2] https://github.com/jedbrown/git-fat
[3] https://github.com/alebedev/git-media
[4] https://git-annex.branchable.com/

t/t9823-git-p4-mock-lfs.sh new file +27 -0
new file mode 100755
index 0000000..5684ee3
@@ -0,0 +1,170 @@
+#!/bin/sh
+
+test_description='Clone repositories and store files in Mock LFS'
+
+. ./lib-git-p4.sh
+
+test_file_is_not_in_mock_lfs () {
+       FILE="$1" &&
+       CONTENT="$2" &&
+       echo "$CONTENT" >expect_content &&
+       test_path_is_file "$FILE" &&
+       test_cmp expect_content "$FILE"
+}
+
+test_file_is_in_mock_lfs () {
+       FILE="$1" &&
+       CONTENT="$2" &&
+       LOCAL_STORAGE=".git/mock-storage/local/$CONTENT" &&
+       SERVER_STORAGE=".git/mock-storage/remote/$CONTENT" &&
+       echo "pointer-$CONTENT" >expect_pointer &&
+       echo "$CONTENT" >expect_content &&
+       test_path_is_file "$FILE" &&
+       test_path_is_file "$LOCAL_STORAGE" &&
+       test_path_is_file "$SERVER_STORAGE" &&
+       test_cmp expect_pointer "$FILE" &&
+       test_cmp expect_content "$LOCAL_STORAGE" &&
+       test_cmp expect_content "$SERVER_STORAGE"

t/t9823-git-p4-mock-lfs.sh line 37

Quoted 10 lines
t/t9823-git-p4-mock-lfs.sh new file +10 -0
+}
+
+test_file_is_deleted_in_mock_lfs () {
+       FILE="$1" &&
+       CONTENT="$2" &&
+       LOCAL_STORAGE=".git/mock-storage/local/$CONTENT" &&
+       SERVER_STORAGE=".git/mock-storage/remote/$CONTENT" &&
+       echo "pointer-$CONTENT" >expect_pointer &&
+       echo "$CONTENT" >expect_content &&
+       ! test_path_is_file "$FILE" &&

Perhaps use test_path_is_missing instead here?

Quoted 136 lines
t/t9823-git-p4-mock-lfs.sh new file +133 -1
+       test_path_is_file "$LOCAL_STORAGE" &&
+       test_path_is_file "$SERVER_STORAGE" &&
+       test_cmp expect_content "$LOCAL_STORAGE" &&
+       test_cmp expect_content "$SERVER_STORAGE"
+}
+
+test_file_count_in_dir () {
+       DIR="$1" &&
+       EXPECTED_COUNT="$2" &&
+       find "$DIR" -type f >actual &&
+       test_line_count = $EXPECTED_COUNT actual
+}
+
+test_expect_success 'start p4d' '
+       start_p4d
+'
+
+test_expect_success 'Create repo with binary files' '
+       client_view "//depot/... //client/..." &&
+       (
+               cd "$cli" &&
+
+               echo "content 1 txt 23 bytes" >file1.txt &&
+               p4 add file1.txt &&
+               echo "content 2-3 bin 25 bytes" >file2.dat &&
+               p4 add file2.dat &&
+               p4 submit -d "Add text and binary file" &&
+
+               mkdir "path with spaces" &&
+               echo "content 2-3 bin 25 bytes" >"path with spaces/file3.bin" &&
+               p4 add "path with spaces/file3.bin" &&
+               p4 submit -d "Add another binary file with same content and spaces in path" &&
+
+               echo "content 4 bin 26 bytes XX" >file4.bin &&
+               p4 add file4.bin &&
+               p4 submit -d "Add another binary file with different content"
+       )
+'
+
+test_expect_success 'Store files in Mock LFS based on size (>24 bytes)' '
+       client_view "//depot/... //client/..." &&
+       test_when_finished cleanup_git &&
+       (
+               cd "$git" &&
+               git init . &&
+               git config git-p4.useClientSpec true &&
+               git config git-p4.largeFileSystem MockLFS &&
+               git config git-p4.largeFileThreshold 24 &&
+               git config git-p4.pushLargeFiles True &&
+               git p4 clone --destination="$git" //depot@all &&
+
+               test_file_is_not_in_mock_lfs file1.txt "content 1 txt 23 bytes" &&
+               test_file_is_in_mock_lfs file2.dat "content 2-3 bin 25 bytes" &&
+               test_file_is_in_mock_lfs "path with spaces/file3.bin" "content 2-3 bin 25 bytes" &&
+               test_file_is_in_mock_lfs file4.bin "content 4 bin 26 bytes XX" &&
+
+               test_file_count_in_dir ".git/mock-storage/local" 2 &&
+               test_file_count_in_dir ".git/mock-storage/remote" 2
+       )
+'
+
+test_expect_success 'Store files in Mock LFS based on extension (dat)' '
+       client_view "//depot/... //client/..." &&
+       test_when_finished cleanup_git &&
+       (
+               cd "$git" &&
+               git init . &&
+               git config git-p4.useClientSpec true &&
+               git config git-p4.largeFileSystem MockLFS &&
+               git config git-p4.largeFileExtensions dat &&
+               git config git-p4.pushLargeFiles True &&
+               git p4 clone --destination="$git" //depot@all &&
+
+               test_file_is_not_in_mock_lfs file1.txt "content 1 txt 23 bytes" &&
+               test_file_is_in_mock_lfs file2.dat "content 2-3 bin 25 bytes" &&
+               test_file_is_not_in_mock_lfs "path with spaces/file3.bin" "content 2-3 bin 25 bytes" &&
+               test_file_is_not_in_mock_lfs file4.bin "content 4 bin 26 bytes XX" &&
+
+               test_file_count_in_dir ".git/mock-storage/local" 1 &&
+               test_file_count_in_dir ".git/mock-storage/remote" 1
+       )
+'
+
+test_expect_success 'Remove file from repo and store files in Mock LFS based on size (>24 bytes)' '
+       client_view "//depot/... //client/..." &&
+       (
+               cd "$cli" &&
+               p4 delete file4.bin &&
+               p4 submit -d "Remove file"
+       ) &&
+
+       client_view "//depot/... //client/..." &&
+       test_when_finished cleanup_git &&
+       (
+               cd "$git" &&
+               git init . &&
+               git config git-p4.useClientSpec true &&
+               git config git-p4.largeFileSystem MockLFS &&
+               git config git-p4.largeFileThreshold 24 &&
+               git config git-p4.pushLargeFiles True &&
+               git p4 clone --destination="$git" //depot@all &&
+
+               test_file_is_not_in_mock_lfs file1.txt "content 1 txt 23 bytes" &&
+               test_file_is_in_mock_lfs file2.dat "content 2-3 bin 25 bytes" &&
+               test_file_is_in_mock_lfs "path with spaces/file3.bin" "content 2-3 bin 25 bytes" &&
+               test_file_is_deleted_in_mock_lfs file4.bin "content 4 bin 26 bytes XX" &&
+
+               test_file_count_in_dir ".git/mock-storage/local" 2 &&
+               test_file_count_in_dir ".git/mock-storage/remote" 2
+       )
+'
+
+test_expect_success 'Run git p4 submit in repo configured with large file system' '
+       client_view "//depot/... //client/..." &&
+       test_when_finished cleanup_git &&
+       (
+               cd "$git" &&
+               git init . &&
+               git config git-p4.useClientSpec true &&
+               git config git-p4.largeFileSystem MockLFS &&
+               git config git-p4.largeFileThreshold 24 &&
+               git config git-p4.pushLargeFiles True &&
+               git p4 clone --destination="$git" //depot@all &&
+
+               test_must_fail git p4 submit
+       )
+'
+
+test_expect_success 'kill p4d' '
+       kill_p4d
+'
+
+test_done
--

2.5.1

#10 lore raw

PATCH v7 7/7 git-p4: add Git LFS backend for large file system

In reply to [email protected]

From: Lars Schneider <[email protected]>

Add example implementation including test cases for the large file system using Git LFS.

Pushing files to the Git LFS server is not tested.

---
 git-p4.py                 |  72 ++++++++++++
 t/t9824-git-p4-git-lfs.sh | 288 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 360 insertions(+)
 create mode 100755 t/t9824-git-p4-git-lfs.sh
git-p4.py +72 -0
index 7a80ebd..fce1d65 100755
@@ -1038,6 +1038,78 @@ class MockLFS(LargeFileSystem):
             os.makedirs(remotePath)
         shutil.copyfile(localLargeFile, os.path.join(remotePath, os.path.basename(localLargeFile)))
 
+class GitLFS(LargeFileSystem):
+    """Git LFS as backend for the git-p4 large file system.
+       See https://git-lfs.github.com/ for details."""
+
+    def __init__(self, *args):
+        LargeFileSystem.__init__(self, *args)
+        self.baseGitAttributes = []
+
+    def generatePointer(self, cloneDestination, contentFile):
+        """Generate a Git LFS pointer for the content. Return LFS Pointer file
+           mode and content which is stored in the Git repository instead of
+           the actual content. Return also the new location of the actual
+           content.
+           """
+        pointerProcess = subprocess.Popen(
+            ['git', 'lfs', 'pointer', '--file=' + contentFile],
+            stdout=subprocess.PIPE
+        )
+        pointerFile = pointerProcess.stdout.read()
+        if pointerProcess.wait():
+            os.remove(contentFile)
+            die('git-lfs pointer command failed. Did you install the extension?')
+        pointerContents = [i+'\n' for i in pointerFile.split('\n')[2:][:-1]]
+        oid = pointerContents[1].split(' ')[1].split(':')[1][:-1]
+        localLargeFile = os.path.join(
+            cloneDestination,
+            '.git', 'lfs', 'objects', oid[:2], oid[2:4],
+            oid,
+        )
+        # LFS Spec states that pointer files should not have the executable bit set.
+        gitMode = '100644'
+        return (gitMode, pointerContents, localLargeFile)
+
+    def pushFile(self, localLargeFile):
+        uploadProcess = subprocess.Popen(
+            ['git', 'lfs', 'push', '--object-id', 'origin', os.path.basename(localLargeFile)]
+        )
+        if uploadProcess.wait():
+            die('git-lfs push command failed. Did you define a remote?')
+
+    def generateGitAttributes(self):
+        return (
+            self.baseGitAttributes +
+            [
+                '\n',
+                '#\n',
+                '# Git LFS (see https://git-lfs.github.com/)\n',
+                '#\n',
+            ] +
+            ['*.' + f.replace(' ', '[[:space:]]') + ' filter=lfs -text\n'
+                for f in sorted(gitConfigList('git-p4.largeFileExtensions'))
+            ] +
+            ['/' + f.replace(' ', '[[:space:]]') + ' filter=lfs -text\n'
+                for f in sorted(self.largeFiles) if not self.hasLargeFileExtension(f)
+            ]
+        )
+
+    def addLargeFile(self, relPath):
+        LargeFileSystem.addLargeFile(self, relPath)
+        self.writeToGitStream('100644', '.gitattributes', self.generateGitAttributes())
+
+    def removeLargeFile(self, relPath):
+        LargeFileSystem.removeLargeFile(self, relPath)
+        self.writeToGitStream('100644', '.gitattributes', self.generateGitAttributes())
+
+    def processContent(self, cloneDestination, git_mode, relPath, contents):
+        if relPath == '.gitattributes':
+            self.baseGitAttributes = contents
+            return (git_mode, self.generateGitAttributes())
+        else:
+            return LargeFileSystem.processContent(self, cloneDestination, git_mode, relPath, contents)
+
 class Command:
     def __init__(self):
         self.usage = "usage: %prog [options]"
t/t9824-git-p4-git-lfs.sh new file +288 -0

288 lines not on this page · raw message

Signature · 1 line
2.5.1
#11 lore raw
In reply to [email protected]
Quoted 5 lines · On 21 September 2015 at 23:41, <[email protected]> wrote:

From: Lars Schneider <[email protected]>

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'

The test cases work fine, t9823 and t9824.

Thanks
Luke

#12 lore raw
Quoted 63 lines · Luke Diamand
Quoted 5 lines · On 21 September 2015 at 23:41, <[email protected]> wrote:

From: Lars Schneider <[email protected]>

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)
Quoted 9 lines
 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

#13 lore raw
Quoted 86 lines · Lars Schneider
Quoted 63 lines · Luke Diamand
Quoted 5 lines · On 21 September 2015 at 23:41, <[email protected]> wrote:

From: Lars Schneider <[email protected]>

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)
Quoted 9 lines
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
Quoted 4 lines

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

git-p4.py +1 -1
index 8c7496d..1d1bb87 100755
@@ -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')]
t/t9824-git-p4-git-lfs.sh +29 -0
index 7385a2b..6d374c0 100755
@@ -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 &&

A message that is not in the archive (sent off-list or not yet received): CAE5ih7-NqSd+zSqTungDt5oWzy4QT--vjYaShd=YDzGxHosz3A@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): CAE5ih7_StiXA-c5yER9jhc941vsKfvEUONLXQ4E7JANOhCxMxQ@mail.gmail.com

#17 lore raw

Adding back [email protected], which I inadvertently dropped off the thread.

Quoted 25 lines · Luke Diamand
Quoted 10 lines · Lars Schneider
Quoted 7 lines · Luke Diamand
Quoted 2 lines · Lars Schneider

On 23 Sep 2015, at 10:18, Lars Schneider <[email protected]> wrote:

<snip>

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

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()’)

It fixes the problem, but in re-running the tests, I'm seeing t9808 fail which doesn't happen on next.

Confirmed. I fixed it.
Do you think it makes sense to create a new roll v8 for Junio?

How about we leave it a day or two in case anything else crawls out of the woodwork?

Thanks!
Luke

#18 lore raw
Quoted 28 lines · Luke Diamand

Adding back [email protected], which I inadvertently dropped off the thread.

Quoted 25 lines · Luke Diamand
Quoted 10 lines · Lars Schneider
Quoted 7 lines · Luke Diamand
Quoted 2 lines · Lars Schneider

On 23 Sep 2015, at 10:18, Lars Schneider <[email protected]> wrote:

<snip>

Quoted 1 line
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

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()’)

It fixes the problem, but in re-running the tests, I'm seeing t9808 fail which doesn't happen on next.

Confirmed. I fixed it.
Do you think it makes sense to create a new roll v8 for Junio?

How about we leave it a day or two in case anything else crawls out of the woodwork?

Thanks!
Luke

sounds good to me!

Thanks,
Lars

#19 lore raw
Quoted 26 lines · Lars Schneider
Quoted 23 lines · Luke Diamand

Adding back [email protected], which I inadvertently dropped off the thread.

Quoted 20 lines · Luke Diamand
Quoted 18 lines · Lars Schneider
Quoted 7 lines · Luke Diamand
Quoted 2 lines · Lars Schneider

On 23 Sep 2015, at 10:18, Lars Schneider <[email protected]> wrote:

<snip>

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

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()’)

It fixes the problem, but in re-running the tests, I'm seeing t9808 fail which doesn't happen on next.

Confirmed. I fixed it.
Do you think it makes sense to create a new roll v8 for Junio?

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

How about we leave it a day or two in case anything else crawls out of the woodwork?

Thanks!
Luke

sounds good to me!

OK, not sure if I'm just doing something daft here....but it seems to be ignoring the size limit!

I've got the version from the branch:

8fee565 git-p4: add Git LFS backend for large file system

Plus the couple of oneliner fixes for cloneDestination.

I've created a repo with a file called foo, size 16MB, and another file called foo.mp4, which is just a symlink to foo.

I then do:

$ mkdir a
$ cd a
$ git init .
$ git config git-p4.largeFileSystem GitLFS
$ git config git-p4.largeFileExtensions mp4
$ git config git-p4.largeFileThreshold 100k
$ git-p4.py sync -v //depot

That reports that both foo and foo.mp4 have been pushed into LFS:

//depot/foo --> foo (16 MB)
Reading pipe: ['git', 'config', '--bool', 'git-p4.pushLargeFiles']
foo moved to large file system
(/home/lgd/git/git/x/git/a/.git/lfs/objects/08/0a/080acf35a507ac9849cfcba47dc2ad83e01b75663a516279c8b9d243b719643e)
//depot/foo.mp4 --> foo.mp4 (0 MB)
foo.mp4 moved to large file system
(/home/lgd/git/git/x/git/a/.git/lfs/objects/2c/26/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae)

But the file system says otherwise:

$ ls -l
-rw-r--r-- 1 lgd lgd 16777216 Sep 24 21:38 foo
-rw-r--r-- 1 lgd lgd        3 Sep 24 21:38 foo.mp4

As does git:

git ls-files --debug
.gitattributes
ctime: 1443127106:535552029
mtime: 1443127106:535552029

  dev: 65025    ino: 13638459
  uid: 1000     gid: 1000
  size: 94      flags: 0

foo
ctime: 1443127106:579552030
mtime: 1443127106:579552030
dev: 65025 ino: 13638462
uid: 1000 gid: 1000
size: 16777216 flags: 0 <<<<<<<<<<<<< Quite large!
foo.mp4
ctime: 1443127106:599552030
mtime: 1443127106:599552030

  dev: 65025    ino: 13638463
  uid: 1000     gid: 1000
  size: 3       flags: 0

What's going on?

Thanks!
Luke

#20 lore raw
Quoted 90 lines · Luke Diamand
Quoted 26 lines · Lars Schneider
Quoted 23 lines · Luke Diamand

Adding back [email protected], which I inadvertently dropped off the thread.

Quoted 20 lines · Luke Diamand
Quoted 18 lines · Lars Schneider
Quoted 7 lines · Luke Diamand
Quoted 2 lines · Lars Schneider

On 23 Sep 2015, at 10:18, Lars Schneider <[email protected]> wrote:

<snip>

Quoted 1 line
Quoted 6 lines
Quoted 3 lines

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()’)

It fixes the problem, but in re-running the tests, I'm seeing t9808 fail which doesn't happen on next.

Confirmed. I fixed it.
Do you think it makes sense to create a new roll v8 for Junio?

Quoted 6 lines
Quoted 5 lines
Quoted 5 lines

How about we leave it a day or two in case anything else crawls out of the woodwork?

Thanks!
Luke

sounds good to me!

OK, not sure if I'm just doing something daft here....but it seems to be ignoring the size limit!

I've got the version from the branch:

8fee565 git-p4: add Git LFS backend for large file system

Plus the couple of oneliner fixes for cloneDestination.

I've created a repo with a file called foo, size 16MB, and another file called foo.mp4, which is just a symlink to foo.

I then do:

$ mkdir a
$ cd a
$ git init .
$ git config git-p4.largeFileSystem GitLFS
$ git config git-p4.largeFileExtensions mp4
$ git config git-p4.largeFileThreshold 100k
$ git-p4.py sync -v //depot

That reports that both foo and foo.mp4 have been pushed into LFS:

//depot/foo --> foo (16 MB)
Reading pipe: ['git', 'config', '--bool', 'git-p4.pushLargeFiles']
foo moved to large file system
(/home/lgd/git/git/x/git/a/.git/lfs/objects/08/0a/080acf35a507ac9849cfcba47dc2ad83e01b75663a516279c8b9d243b719643e)
//depot/foo.mp4 --> foo.mp4 (0 MB)
foo.mp4 moved to large file system
(/home/lgd/git/git/x/git/a/.git/lfs/objects/2c/26/2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae)

But the file system says otherwise:

$ ls -l
(quoted diff) +0 -2
-rw-r--r-- 1 lgd lgd 16777216 Sep 24 21:38 foo
-rw-r--r-- 1 lgd lgd        3 Sep 24 21:38 foo.mp4

As does git:

git ls-files --debug
.gitattributes
ctime: 1443127106:535552029
mtime: 1443127106:535552029

 dev: 65025    ino: 13638459
 uid: 1000     gid: 1000
 size: 94      flags: 0

foo
ctime: 1443127106:579552030
mtime: 1443127106:579552030
dev: 65025 ino: 13638462
uid: 1000 gid: 1000
size: 16777216 flags: 0 <<<<<<<<<<<<< Quite large!
foo.mp4
ctime: 1443127106:599552030
mtime: 1443127106:599552030

Quoted 5 lines
 dev: 65025    ino: 13638463
 uid: 1000     gid: 1000
 size: 3       flags: 0

What's going on?

I believe this is correct. Git-LFS uses the clean/smudge filter to replace the LFS pointer with the actual file on checkout. Therefore you see the actual file! You can find details here: https://github.com/github/git-lfs/blob/master/docs/spec.md#intercepting-git

Can you run du -hs .git/objects in your Git repository? This should report a value well below 16 MB.

Cheers,
Lars

#21 lore raw
Quoted 8 lines · Lars Schneider
Quoted 4 lines

size: 3 flags: 0

What's going on?

I believe this is correct. Git-LFS uses the clean/smudge filter to replace the LFS pointer with the actual file on checkout. Therefore you see the actual file! You can find details here: https://github.com/github/git-lfs/blob/master/docs/spec.md#intercepting-git

Can you run du -hs .git/objects in your Git repository? This should report a value well below 16 MB.

It does, thanks!

#22 lore raw
In reply to [email protected]
Quoted 6 lines · [email protected] writes:

From: Lars Schneider <[email protected]>

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

Quoted 6 lines

I am sorry about the "[:space:]" bug this late. I had the fix in my development branch but missed to apply it in this patch series.

@Junio:
Your conflict resolution in pu looks good. Nevertheless, I made this patch on top of next to ease the integration. I hope this is ok.

Please don't rebase without a good reason, especially after you checked the conflict resolution is OK and your reroll does not affect the way the conflicts are resolved. If you based your v6 patch on v2.6.0-rc0 and then your v7 patch needs to use something that did not exist v2.6.0-rc3, you cannot avoid rebasing on top of that newer codebase to use that new feature, but otherwise, no.

This is because I prefer to apply the new series to the same base version so that each step can be compared with the corresponding step in the previous round.

I even try hard to keep the commits from the older round if the patch text and log message are unchanged. This time, I had to backport [v7 6/7] to apply to the same base before noticing and verifying that [v7 7/7] is the only thing that was changed in this round. All the other ones turned out to be identical.

Hence, the end result for me was

    $ git checkout ls/p4-lfs
    $ git reset --hard HEAD^
    $ git am -s git-p4-lfs-7-of-7.mbox

but it took me a lot longer than necessary because of the rebase.

Thanks.

#23 lore raw
Quoted 32 lines · Junio C Hamano
Quoted 6 lines · [email protected] writes:

From: Lars Schneider <[email protected]>

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

Quoted 6 lines

I am sorry about the "[:space:]" bug this late. I had the fix in my development branch but missed to apply it in this patch series.

@Junio:
Your conflict resolution in pu looks good. Nevertheless, I made this patch on top of next to ease the integration. I hope this is ok.

Please don't rebase without a good reason, especially after you checked the conflict resolution is OK and your reroll does not affect the way the conflicts are resolved. If you based your v6 patch on v2.6.0-rc0 and then your v7 patch needs to use something that did not exist v2.6.0-rc3, you cannot avoid rebasing on top of that newer codebase to use that new feature, but otherwise, no.

This is because I prefer to apply the new series to the same base version so that each step can be compared with the corresponding step in the previous round.

I even try hard to keep the commits from the older round if the patch text and log message are unchanged. This time, I had to backport [v7 6/7] to apply to the same base before noticing and verifying that [v7 7/7] is the only thing that was changed in this round. All the other ones turned out to be identical.

Quoted 8 lines

Hence, the end result for me was

   $ git checkout ls/p4-lfs
   $ git reset --hard HEAD^
   $ git am -s git-p4-lfs-7-of-7.mbox

but it took me a lot longer than necessary because of the rebase.

Understood. Thanks for taking the time and explaining me your workflow. That helps a lot as my intention was to save your time, not waste it.

Sorry,
Lars