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

Re: [PATCH] Teach fmt-patch to write individual files.

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
May 5, 2006, 00:56 UTC
Message-ID
<Pine.LNX.4.63.0605050249050.25249@wbgn013.biozentrum.uni-wuerzburg.de>
In-Reply-To
<7vhd452uzn.fsf@assigned-by-dhcp.cox.net>
Hi,
On Thu, 4 May 2006, Junio C Hamano wrote:
Show 10 quoted lines
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> 
> > When called with "--stdout", it still writes to standard output.
> >
> > Notable differences to git-format-patch:
> >
> > 	- since fmt-patch uses the standardized logging machinery, it is
> > 	  no longer "From nobody", but "From <commit_sha1>",
> 
> Yes, and the date on that UNIX-From line has been updated ;-).
Right.
Show 6 quoted lines
> > 	- the empty lines before and after the "---" just before the
> > 	  diffstat are no longer there,
> 
> Personally, I find this the most annoying myself.  I am not
> complaining to you because as you know you inherited this
> behaviour from my code.
How about this?
-- snip --
diff --git a/log-tree.c b/log-tree.c
index d92abaf..6379d43 100644
--- a/log-tree.c
+++ b/log-tree.c
@@ -86,7 +86,7 @@ int log_tree_diff_flush(struct rev_info 
 	}
 
 	if (opt->loginfo && !opt->no_commit_id)
-		show_log(opt, opt->loginfo, opt->diffopt.with_stat ? "---\n" : "\n");
+		show_log(opt, opt->loginfo, opt->diffopt.with_stat ? "\n---\n\n" : "\n");
 	diff_flush(&opt->diffopt);
 	return 1;
 }
-- snap --

> > 	- git-format-patch outputs the commit_sha1 just before the first
> > 	  diff, which fmt-patch does not,
> 
> Which should be fine.

Yeah, I just wanted to mention it in case people rely on it.

> > 	- the file names are no longer output to stdout, but to stderr
> > 	  (since stdout is freopen()ed all the time), and
> 
> Which might be a bigger deal; I suspect people capture that while
> dumping patches into individual files, and do their
> postprocessing using the list of filenames.

I hoped it is not necessary to "FILE *realstdout = fdopen(dup(1));" but I 
can do it if this is wanted.

> > 	- "git fmt-patch HEAD^" does not work as expected: it outputs
> > 	  *all* commits reachable from HEAD^!
> 
> If we really wanted to handle this, you could do something like
> what builtin-diff does before letting the revision machinery
> start walking the revision tree.  Look at pending objects, and
> if you find only one UNINTERESTING commit, add_object the
> current HEAD there as well.  Personally I do not think it is
> worth it; rather we would probably want to standardize on rev-list
> syntax.

Well, I have to get used to add ".." after HEAD^, but that is probably not 
very difficult. I would like fmt-patch to error out without a range, 
though.

> Two major differences you forgot to mention.
> 
> One is that it does not do the "git cherry" filtering.  It is
> not a big deal for me personally, but some people may be
> depending on it.  I dunno.

Oops. I really did not think of that.

> Another is -o outdir, which should be trivial to add once you
> have implemented output switching with freopen().

Yes, this becomes easy now. I'll do that next.

Ciao,
Dscho
Previous: Junio C Hamano
Message 3 of 3 in “Teach fmt-patch to write individual files.”
  1. Teach fmt-patch to write individual files.Johannes Schindelin, May 4, 2006
  2. Junio C HamanoMay 5, 2006
  3. Johannes SchindelinMay 5, 2006

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.