@@ -50,7 +50,7 @@ pub(crate) mod function {
50
50
}
51
51
} ;
52
52
53
- let ( src, dst) = match spec. find_byte ( b':' ) {
53
+ let ( mut src, dst) = match spec. find_byte ( b':' ) {
54
54
Some ( pos) => {
55
55
let ( src, dst) = spec. split_at ( pos) ;
56
56
let dst = & dst[ 1 ..] ;
@@ -86,6 +86,11 @@ pub(crate) mod function {
86
86
}
87
87
} ;
88
88
89
+ if let Some ( spec) = src. as_mut ( ) {
90
+ if * spec == "@" {
91
+ * spec = "HEAD" . into ( ) ;
92
+ }
93
+ }
89
94
let ( src, src_had_pattern) = validated ( src, operation == Operation :: Push ) ?;
90
95
let ( dst, dst_had_pattern) = validated ( dst, false ) ?;
91
96
if mode != Mode :: Negative && src_had_pattern != dst_had_pattern {
@@ -103,10 +108,11 @@ pub(crate) mod function {
103
108
match spec {
104
109
Some ( spec) => {
105
110
let glob_count = spec. iter ( ) . filter ( |b| * * b == b'*' ) . take ( 2 ) . count ( ) ;
106
- if glob_count == 2 {
111
+ if glob_count > 1 {
107
112
return Err ( Error :: PatternUnsupported { pattern : spec. into ( ) } ) ;
108
113
}
109
- if glob_count == 1 {
114
+ let has_globs = glob_count == 1 ;
115
+ if has_globs {
110
116
let mut buf = smallvec:: SmallVec :: < [ u8 ; 256 ] > :: with_capacity ( spec. len ( ) ) ;
111
117
buf. extend_from_slice ( spec) ;
112
118
let glob_pos = buf. find_byte ( b'*' ) . expect ( "glob present" ) ;
@@ -132,7 +138,7 @@ pub(crate) mod function {
132
138
}
133
139
} ) ?;
134
140
}
135
- Ok ( ( Some ( spec) , glob_count == 1 ) )
141
+ Ok ( ( Some ( spec) , has_globs ) )
136
142
}
137
143
None => Ok ( ( None , false ) ) ,
138
144
}
0 commit comments