1
1
use std:: fmt:: { self , Debug , Formatter } ;
2
- use std:: hash:: { Hash , Hasher , SipHasher } ;
3
2
4
3
use url:: Url ;
5
4
6
5
use core:: source:: { Source , SourceId } ;
7
6
use core:: GitReference ;
8
7
use core:: { Package , PackageId , Summary , Registry , Dependency } ;
9
- use util:: { CargoResult , Config , to_hex} ;
8
+ use util:: { CargoResult , Config } ;
9
+ use util:: hex:: short_hash;
10
10
use sources:: PathSource ;
11
11
use sources:: git:: utils:: { GitRemote , GitRevision } ;
12
12
@@ -57,8 +57,6 @@ impl<'cfg> GitSource<'cfg> {
57
57
}
58
58
59
59
fn ident ( url : & Url ) -> String {
60
- let mut hasher = SipHasher :: new_with_keys ( 0 , 0 ) ;
61
-
62
60
let url = canonicalize_url ( url) ;
63
61
let ident = url. path_segments ( ) . and_then ( |mut s| s. next_back ( ) ) . unwrap_or ( "" ) ;
64
62
@@ -68,8 +66,7 @@ fn ident(url: &Url) -> String {
68
66
ident
69
67
} ;
70
68
71
- url. hash ( & mut hasher) ;
72
- format ! ( "{}-{}" , ident, to_hex( hasher. finish( ) ) )
69
+ format ! ( "{}-{}" , ident, short_hash( & url) )
73
70
}
74
71
75
72
// Some hacks and heuristics for making equivalent URLs hash the same
0 commit comments