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

[StGit PATCH 4/5] Add the -p option to fold

From
CMCatalin Marinas <catalin.marinas@gmail.com>
Date
Sep 16, 2009, 21:41 UTC
Message-ID
<20090916214110.6622.12748.stgit@toshiba-laptop>
In-Reply-To
<20090916214049.6622.44662.stgit@toshiba-laptop>

This option was added to import, so it makes sense for fold to have it as well.

Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
---
 stgit/commands/fold.py |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/stgit/commands/fold.py b/stgit/commands/fold.py
index 28e824c..ce0459e 100644
--- a/stgit/commands/fold.py
+++ b/stgit/commands/fold.py
@@ -39,6 +39,8 @@ options = [
         short = 'Perform a three-way merge with the current patch'),
     opt('-b', '--base', args = [argparse.commit],
         short = 'Use BASE instead of HEAD when applying the patch'),
+    opt('-p', '--strip', type = 'int', metavar = 'N',
+        short = 'Remove N leading slashes from diff paths (default 1)'),
     opt('--reject', action = 'store_true',
         short = 'Leave the rejected hunks in corresponding *.rej files')]
 
@@ -75,11 +77,13 @@ def func(parser, options, args):
         crt_patch = crt_series.get_patch(current)
         bottom = crt_patch.get_bottom()
         git.apply_patch(filename = filename, base = bottom,
-                        reject = options.reject)
+                        strip = options.strip, reject = options.reject)
     elif options.base:
         git.apply_patch(filename = filename, reject = options.reject,
+                        strip = options.strip,
                         base = git_id(crt_series, options.base))
     else:
-        git.apply_patch(filename = filename, reject = options.reject)
+        git.apply_patch(filename = filename, strip = options.strip,
+                        reject = options.reject)
 
     out.done()
Previous: Catalin MarinasNext: Catalin Marinas
Message 5 of 6 in “More UI clean-up”
  1. 0/5 More UI clean-upCatalin Marinas, Sep 16, 2009
  2. 1/5 Remove the 'fail_dump' argument to git.apply_patch()Catalin Marinas, Sep 16, 2009
  3. 2/5 Add the --reject option to foldCatalin Marinas, Sep 16, 2009
  4. 3/5 Do not create an empty patch if import failed without --rejectCatalin Marinas, Sep 16, 2009
  5. 4/5 Add the -p option to foldCatalin Marinas, Sep 16, 2009
  6. 5/5 Autosign imported patchesCatalin Marinas, Sep 16, 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.