Patchwork [7,of,8] largefiles: use strip() instead of slicing to get rid of EOL of standin

login
register
mail settings
Submitter Katsunori FUJIWARA
Date March 27, 2017, 1:53 a.m.
Message ID <b80768388eb2700a6191.1490579627@speaknoevil>
Download mbox | patch
Permalink /patch/19728/
State Accepted
Headers show

Comments

Katsunori FUJIWARA - March 27, 2017, 1:53 a.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1490575476 -32400
#      Mon Mar 27 09:44:36 2017 +0900
# Node ID b80768388eb2700a619159447461063983dd5806
# Parent  a26720a7404871d286ac4070710022b448572cb2
largefiles: use strip() instead of slicing to get rid of EOL of standin

This slicing prevents from replacing SHA-1 by another (= longer hash
value) in the future.

Patch

diff --git a/hgext/largefiles/basestore.py b/hgext/largefiles/basestore.py
--- a/hgext/largefiles/basestore.py
+++ b/hgext/largefiles/basestore.py
@@ -130,7 +130,7 @@  class basestore(object):
                     key = (filename, fctx.filenode())
                     if key not in verified:
                         verified.add(key)
-                        expectedhash = fctx.data()[0:40]
+                        expectedhash = fctx.data().strip()
                         filestocheck.append((cset, filename, expectedhash))
 
         failed = self._verifyfiles(contents, filestocheck)