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

Re: format-patch problem when using relative

From
Jeff King <peff@peff.net>
Date
Nov 26, 2008, 18:01 UTC
Message-ID
<20081126180154.GA7584@coredump.intra.peff.net>
In-Reply-To
<17081052-4480-4971-9F38-BD5C48087379@gmail.com>
On Wed, Nov 26, 2008 at 05:12:02PM +0100, Nikola Knežević wrote:
> git format-patch -o patches -n --relative=click click/master myclick
>
> This produced a bunch of files in patches directory, most of which are  
> empty. When I tried this --stdout, I had something like this:

Hmm. It seems that there is no history pruning done with --relative, so you will still end up with commits that make no changes. However, this is intentional. See cd676a51:

    diff --relative: output paths as relative to the current subdirectory
    [...]
     - This works not just with diff but also works with the log
       family of commands, but the history pruning is not affected.
       In other words, if you go to a subdirectory, you can say:
            $ git log --relative -p
       but it will show the log message even for commits that do not
       touch the current directory.  You can limit it by giving
       pathspec yourself:
            $ git log --relative -p .
       This originally was not a conscious design choice, but we
       have a way to affect diff pathspec and pruning pathspec
       independently.  IOW "git log --full-diff -p ." tells it to
       prune history to commits that affect the current subdirectory
       but show the changes with full context.  I think it makes
       more sense to leave pruning independent from --relative than
       the obvious alternative of always pruning with the current
       subdirectory, which would break the symmetry.
So I think what you really want is:
  git format-patch --relative=click click/master myclick -- click
to limit the path pruning to the 'click' directory.
-Peff
Previous: Nikola KneževićNext: Nikola Knežević
Message 2 of 4 in “format-patch problem when using relative”
  1. Nikola KneževićNov 26, 2008
  2. Jeff KingNov 26, 2008
  3. Nikola KneževićNov 26, 2008
  4. Björn SteinbrinkNov 27, 2008

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.