git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] Let format-patch and rebase ignore trivial merges.

From
BLBernhard 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
fi
Hochachtungsvoll,
	Bernhard R. Link
-- 
"Never contain programs so few bugs, as when no debugging tools are available!"
	Niklaus Wirth
Previous: Johannes SixtNext: Junio C Hamano
Message 5 of 11 in “Let format-patch and rebase ignore trivial merges.”
  1. Let format-patch and rebase ignore trivial merges.Bernhard R. Link, Dec 16, 2009
  2. Johannes SixtDec 16, 2009
  3. Bernhard R. LinkDec 17, 2009
  4. Johannes SixtDec 17, 2009
  5. Bernhard R. LinkDec 17, 2009
  6. Junio C HamanoDec 17, 2009
  7. Bernhard R. LinkDec 18, 2009
  8. Johannes SixtDec 18, 2009
  9. Bernhard R. LinkDec 18, 2009
  10. Let format-patch and rebase ignore trivial merges.Bernhard R. Link, Dec 18, 2009
  11. Junio C HamanoDec 18, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.