Re: [PATCH] Let format-patch and rebase ignore trivial merges.
- From
- Bernhard R. Link <brlink@debian.org>
- Date
- Dec 17, 2009, 21:48 UTC
- Message-ID
- <20091217214843.GA414@pcpool00.mathematik.uni-freiburg.de>
- In-Reply-To
- <4B2A1895.2000803@viscovery.net>
* Johannes Sixt <j.sixt@viscovery.net> [091217 12:40]:
Show 5 quoted lines
> > I want the default for format-patch changed. > > I do not see why format-patch would have to be changed. The case that you > outline (a merge -s ours happened and you want to follow only one parent) > is rare enough
While it is rare, the result format-patch currently produces is quite a desaster without any need.
> and even more rarly will somebody want to apply format-patch to such a history. > But I guess that you are actually not interested in format-patch per se, > but rather in rebase (which uses format-patch).
I'm looking for a nice way to store the history of a patches in a Debian package. Currently the best way is to use quilt and store the patches in git. Topgit is quite overkill, git directly preserving history means no way to export sane patches. And git rebase -i means losing history of previous states and pullability.
An way to combine those is doing many trivial merges, but that kills rebase and format-patch. (While the patch exporting for creating the debian source packages could change to the right directory and give the proper arguments, needing to remember the extra argument and teaching anyone else involved how to call it to get what to sent to upstream is annoying).
> I haven't looked at the code, but wouldn't it be matter of "if we do not > have any pathspec, add '.'" *after* all options are parsed?
That's what I would say my patch is doing.
> git rev-list -- . works in a bare repository, too. If you hard-code "-- ." > in the rev-list invocations in git-rebase[--interactive], then it cannot > be said that this works "by chance" due to cd_to_toplevel.
It works in a bare repository. But it does not work when called from a subdirectory of the working dir.
The easiest way I see to express generally
git rev-list --prune-tree $args
is
topdir=$(git rev-parse --show-cdup)
if test -z "$topdir" ; then
topdir=.
fi
set -- $args
while test $# -gt 0 ; do
if test "x$1" = "x--" ; then
break
fi
shift
done
if test $# -gt 1 ; then
git rev-list $args
elif test $# -eq 1 ; then
git rev-list $args $topdir
else
git rev-list $args -- $topdir
fiHochachtungsvoll, Bernhard R. Link
-- "Never contain programs so few bugs, as when no debugging tools are available!" Niklaus Wirth