Show More
@@ -17,7 +17,7 b' use crate::DirstateEntry;' | |||||
17 | use crate::DirstateError; |
|
17 | use crate::DirstateError; | |
18 | use crate::DirstateParents; |
|
18 | use crate::DirstateParents; | |
19 | use crate::EntryState; |
|
19 | use crate::EntryState; | |
20 |
use bytes_cast::unaligned::{I32Be, I64Be, U32Be |
|
20 | use bytes_cast::unaligned::{I32Be, I64Be, U32Be}; | |
21 | use bytes_cast::BytesCast; |
|
21 | use bytes_cast::BytesCast; | |
22 | use std::borrow::Cow; |
|
22 | use std::borrow::Cow; | |
23 | use std::convert::TryFrom; |
|
23 | use std::convert::TryFrom; | |
@@ -135,9 +135,8 b' pub(super) struct Timestamp {' | |||||
135 |
|
135 | |||
136 | /// Counted in bytes from the start of the file |
|
136 | /// Counted in bytes from the start of the file | |
137 | /// |
|
137 | /// | |
138 |
/// NOTE: |
|
138 | /// NOTE: not supporting `.hg/dirstate` files larger than 4 GiB. | |
139 | /// we could save space by using `U32Be` instead. |
|
139 | type Offset = U32Be; | |
140 | type Offset = U64Be; |
|
|||
141 |
|
140 | |||
142 | /// Counted in number of items |
|
141 | /// Counted in number of items | |
143 | /// |
|
142 | /// | |
@@ -172,8 +171,8 b' type OptPathSlice = Slice;' | |||||
172 |
|
171 | |||
173 | /// Make sure that size-affecting changes are made knowingly |
|
172 | /// Make sure that size-affecting changes are made knowingly | |
174 | fn _static_assert_size_of() { |
|
173 | fn _static_assert_size_of() { | |
175 |
let _ = std::mem::transmute::<Header, [u8; |
|
174 | let _ = std::mem::transmute::<Header, [u8; 88]>; | |
176 |
let _ = std::mem::transmute::<Node, [u8; 5 |
|
175 | let _ = std::mem::transmute::<Node, [u8; 45]>; | |
177 | } |
|
176 | } | |
178 |
|
177 | |||
179 | /// Unexpected file format found in `.hg/dirstate` with the "v2" format. |
|
178 | /// Unexpected file format found in `.hg/dirstate` with the "v2" format. | |
@@ -589,8 +588,8 b' fn write_slice<T>(slice: &[T], out: &mut' | |||||
589 | where |
|
588 | where | |
590 | T: BytesCast, |
|
589 | T: BytesCast, | |
591 | { |
|
590 | { | |
592 |
let start = u |
|
591 | let start = u32::try_from(out.len()) | |
593 |
// Could only panic |
|
592 | // Could only panic for a dirstate file larger than 4 GiB | |
594 | .expect("dirstate-v2 offset overflow") |
|
593 | .expect("dirstate-v2 offset overflow") | |
595 | .into(); |
|
594 | .into(); | |
596 | let len = u32::try_from(slice.len()) |
|
595 | let len = u32::try_from(slice.len()) |
@@ -406,19 +406,19 b' Windows paths are accepted on input' | |||||
406 | #if dirstate-v2 |
|
406 | #if dirstate-v2 | |
407 |
|
407 | |||
408 | Check the hash of ignore patterns written in the dirstate at offset |
|
408 | Check the hash of ignore patterns written in the dirstate at offset | |
409 |
12 + 20 + 20 + |
|
409 | 12 + 20 + 20 + 4 + 4 + 4 + 4 = 68 | |
410 |
|
410 | |||
411 | $ hg status > /dev/null |
|
411 | $ hg status > /dev/null | |
412 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 |
|
412 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | |
413 | sha1=6e315b60f15fb5dfa02be00f3e2c8f923051f5ff |
|
413 | sha1=6e315b60f15fb5dfa02be00f3e2c8f923051f5ff | |
414 |
>>> import binascii; print(binascii.hexlify(open(".hg/dirstate", "rb").read()[ |
|
414 | >>> import binascii; print(binascii.hexlify(open(".hg/dirstate", "rb").read()[68:][:20]).decode()) | |
415 | 6e315b60f15fb5dfa02be00f3e2c8f923051f5ff |
|
415 | 6e315b60f15fb5dfa02be00f3e2c8f923051f5ff | |
416 |
|
416 | |||
417 | $ echo rel > .hg/testhgignorerel |
|
417 | $ echo rel > .hg/testhgignorerel | |
418 | $ hg status > /dev/null |
|
418 | $ hg status > /dev/null | |
419 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 |
|
419 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | |
420 | sha1=dea19cc7119213f24b6b582a4bae7b0cb063e34e |
|
420 | sha1=dea19cc7119213f24b6b582a4bae7b0cb063e34e | |
421 |
>>> import binascii; print(binascii.hexlify(open(".hg/dirstate", "rb").read()[ |
|
421 | >>> import binascii; print(binascii.hexlify(open(".hg/dirstate", "rb").read()[68:][:20]).decode()) | |
422 | dea19cc7119213f24b6b582a4bae7b0cb063e34e |
|
422 | dea19cc7119213f24b6b582a4bae7b0cb063e34e | |
423 |
|
423 | |||
424 | #endif |
|
424 | #endif |
General Comments 0
You need to be logged in to leave comments.
Login now