Skip to content

Commit 4cc16ab

Browse files
committed
Introduce a left-open range denoted by ...
1 parent 9f027fa commit 4cc16ab

2 files changed

Lines changed: 11 additions & 13 deletions

File tree

‎README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,10 @@ How to use
4444
- number of seconds since the Unix epoch
4545

4646
<rev-list> speficy commits to modify which must be on the
47-
current branch; a single commit <committish> or
48-
a range of commits <committish1>..<committish2>
49-
(*both inclusive*)
47+
current branch; a single commit or a range of
48+
commits: <committish1>..<committish2> denotes a
49+
*closed* range, and <committish1>...<committish2>
50+
denotes a *left-open* range
5051

5152
Author
5253
------

‎git-shift‎

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,10 @@ usage: git shift [options] {[<time>][<timediff>][timezone]|<datetime>} <rev-list
7171
- number of seconds since the Unix epoch
7272
7373
<rev-list> speficy commits to modify which must be on the
74-
current branch; a single commit <committish> or
75-
a range of commits <committish1>..<committish2>
76-
(*both inclusive*)
74+
current branch; a single commit or a range of
75+
commits: <committish1>..<committish2> denotes a
76+
*closed* range, and <committish1>...<committish2>
77+
denotes a *left-open* range
7778
EOS
7879
}
7980

@@ -249,19 +250,15 @@ sub expand_revspec {
249250
my($revspec, $branch) = @_;
250251
@_ == 1 or die;
251252

252-
if ($revspec =~ /\.\.\./) {
253-
print STDERR "$0: `...' is not supported.\n";
254-
exit 64;
255-
}
256-
if ($revspec =~ /\.\./) {
257-
my($from_spec, $to_spec) = split(/\.\./, $revspec, 2);
253+
if ($revspec =~ /\.\.(\.)?/) {
254+
my($from_spec, $to_spec, $exclude_from) = ($`, $', $1);
258255
if ($to_spec eq '') {
259256
$to_spec = 'HEAD';
260257
}
261258
my @revs = git_revlist($from_spec eq '' ?
262259
$to_spec :
263260
sprintf('%s..%s', $from_spec, $to_spec));
264-
push @revs, git_revparse($from_spec) unless $from_spec eq '';
261+
push @revs, git_revparse($from_spec) unless $from_spec eq '' || $exclude_from;
265262
return @revs;
266263
}
267264

0 commit comments

Comments
 (0)