List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: RFE: download patch between arbitrary revisions
Date: Thu, 13 Jun 2013 23:21:26 +0100	[thread overview]
Message-ID: <20130613222126.GC23890@serenity.lan> (raw)
In-Reply-To: <20130613215810.GB29281@blizzard>

On Thu, Jun 13, 2013 at 11:58:10PM +0200, Lukas Fleischer wrote:
> On Mon, Jun 03, 2013 at 07:49:53PM +0100, John Keeping wrote:
> > On Sun, Jun 02, 2013 at 09:19:11PM -0400, Konstantin Ryabitsev wrote:
> > > There is currently a way to render a diff between two arbitrary objects,
> > > e.g.:
> > > 
> > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/diff/?id=v3.10-rc4&id2=v3.10-rc3
> > > 
> > > However, there doesn't appear to be a way to download a patch in the
> > > same way -- it will only make patch against id's parent. E.g.:
> > > 
> > > https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/patch/?id=v3.10-rc4&id2=v3.10-rc3
> > > 
> > > Any way we can make the behaviour of patch match that of diff?
> > 
> > I had a quick look at this and changing the patch output is really easy,
> > but the top of the output is now completely wrong since it displays the
> > message from the "id" commit.  I'm not sure what to do about this;
> > clearly it is useful to be able to get the patch output between two
> > arbitrary points in a raw format (not HTML) but I don't know what to do
> > about the commit message and headers.  Perhaps we can do something like:
> > 
> >     if "id2" is specified:
> >         print shortlog output
> >     else:
> >         do what we currently do
> > 
> > but I don't know how much code would be needed for that.
> 
> Well, the problem, obviously, is that we are currently using
> git-format-patch(1)-style patches for single commits. There are three
> possible solutions that come into my mind: 
> 
> 1. Use a plain diff for multiple patches (like `git diff HEAD~10..`).
> 
> 2. Create a patch for a squash commit (like `git merge --squash`
>    followed by `git format-patch`). Basically what John suggested above.
> 
> 3. Create a bunch of `git am` compatible patches (like `git format-patch
>    --stdout HEAD~10..`).
> 
> I personally think that it might be best to create a new parameter (or
> an entirely new URL) to switch between creating plain diffs (see 1) and
> git-format-patch(1)-like patches (see 3). That way, we would be able to
> provide both patches that mirror exactly what is in the repos and simple
> patches that summarize a couple of commits.

Sounds sensible.  How about making "patch" do the "format-patch
--stdout" behaviour and add a new "raw diff" command that just shows the
diff?

So:

    /patch/?id=v1.8.3.1&id2=v1.8.3

generates something like "git format-patch v1.8.3..v1.8.3.1".  And

    /rawdiff/?id=v1.8.3.1&id2=v1.8.3

generates the diff with no HTML around it.

The latter could be a query parameter instead ("raw=1"?).  Having not
investigated the impact on the code, I have no preference for one over
the other.


  reply	other threads:[~2013-06-13 22:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-03  1:19 mricon
2013-06-03 18:49 ` john
2013-06-13 21:58   ` cgit
2013-06-13 22:21     ` john [this message]
2013-06-16  7:56       ` cgit
2013-06-16 10:11         ` john
2013-06-16 19:18           ` cgit
2013-08-06 19:23             ` mricon
2013-08-06 21:40               ` cgit
2013-08-12 19:05                 ` Jason
2013-08-14  8:56                   ` cgit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130613222126.GC23890@serenity.lan \
    --to=cgit@lists.zx2c4.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).