1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-12 00:06:36 +02:00

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>
This commit is contained in:
Simon 'corecode' Schubert 2007-02-01 11:43:39 +01:00 committed by Junio C Hamano
parent 4c55068683
commit ca28370a35
2 changed files with 7 additions and 4 deletions

View File

@ -8,7 +8,7 @@ git-cvsexportcommit - Export a single commit to a CVS checkout
SYNOPSIS SYNOPSIS
-------- --------
'git-cvsexportcommit' [-h] [-v] [-c] [-p] [-a] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID 'git-cvsexportcommit' [-h] [-v] [-c] [-P] [-p] [-a] [-f] [-m msgprefix] [PARENTCOMMIT] COMMITID
DESCRIPTION DESCRIPTION
@ -46,6 +46,9 @@ OPTIONS
-f:: -f::
Force the merge even if the files are not up to date. Force the merge even if the files are not up to date.
-P::
Force the parent commit, even if it is not a direct parent.
-m:: -m::
Prepend the commit message with the provided prefix. Prepend the commit message with the provided prefix.
Useful for patch series and the like. Useful for patch series and the like.

View File

@ -15,9 +15,9 @@
die "GIT_DIR is not defined or is unreadable"; die "GIT_DIR is not defined or is unreadable";
} }
our ($opt_h, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m ); our ($opt_h, $opt_P, $opt_p, $opt_v, $opt_c, $opt_f, $opt_a, $opt_m );
getopts('hpvcfam:'); getopts('hPpvcfam:');
$opt_h && usage(); $opt_h && usage();
@ -89,7 +89,7 @@
last; last;
}; # found it }; # found it
} }
die "Did not find $parent in the parents for this commit!" if !$found; die "Did not find $parent in the parents for this commit!" if !$found and !$opt_P;
} else { # we don't have a parent from the cmdline... } else { # we don't have a parent from the cmdline...
if (@parents == 1) { # it's safe to get it from the commit if (@parents == 1) { # it's safe to get it from the commit
$parent = $parents[0]; $parent = $parents[0];