Skip to content

Commit ca28370

Browse files
corecodeJunio C Hamano
authored andcommitted
Allow forcing of a parent commit, even if the parent is not a direct one.
This can be used to compress multiple changesets into one, for example like git cvsexportcommit -P cvshead mybranch without having to do so in git first. Signed-off-by: Simon 'corecode' Schubert <corecode@fs.ei.tum.de> Signed-off-by: Junio C Hamano <junkio@cox.net>
1 parent 4c55068 commit ca28370

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Documentation/git-cvsexportcommit.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ git-cvsexportcommit - Export a single commit to a CVS checkout
88

99
SYNOPSIS
1010
--------
11-
'git-cvsexportcommit' [-h] [-v] [-c] [-p] [-a] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
11+
'git-cvsexportcommit' [-h] [-v] [-c] [-P] [-p] [-a] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
1212

1313

1414
DESCRIPTION
@@ -46,6 +46,9 @@ OPTIONS
4646
-f::
4747
Force the merge even if the files are not up to date.
4848

49+
-P::
50+
Force the parent commit, even if it is not a direct parent.
51+
4952
-m::
5053
Prepend the commit message with the provided prefix.
5154
Useful for patch series and the like.

git-cvsexportcommit.perl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@
1515
die "GIT_DIR is not defined or is unreadable";
1616
}
1717

18-
our ($opt_h, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m );
18+
our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m );
1919

20-
getopts('hpvcfam:');
20+
getopts('hPpvcfam:');
2121

2222
$opt_h && usage();
2323

@@ -89,7 +89,7 @@
8989
last;
9090
}; # found it
9191
}
92-
die "Did not find $parent in the parents for this commit!" if !$found;
92+
die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
9393
} else { # we don't have a parent from the cmdline...
9494
if (@parents == 1) { # it's safe to get it from the commit
9595
$parent = $parents[0];

0 commit comments

Comments
 (0)