9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] git/{diff,import}: make it easier to handle manually-asembled patch emails
@ 2021-08-22 17:10 ori
  2021-08-22 17:12 ` ori
  0 siblings, 1 reply; 3+ messages in thread
From: ori @ 2021-08-22 17:10 UTC (permalink / raw)
  To: 9fans

Often, people (including myself) will write emails that
can almost be applied with git/import.  This changes
git/diff and git/import so that things will generally
work even when assembling diffs by hand:

1.      git/import becomes slightly more lax:

                ^diff ...
                ^--- ...

        will both be detected as the start of a patch.

2.  git/diff produces the same format of diff
        as git/export, starting with paths:

                --- a/path/to/file
                +++     b/path/to/file

        which means that the 'ape/patch -p1' used
        within git/import will just work.

So with this, if you send an email to the mailing list,
write up a committable description, and append the
output of git/diff to the end of the email, git/import
should just work.

[this patch was send through the mailing list using the
above procedure, and will be committed with git/import
to verify that it works as advertised]

diff 8c228a123fa0c6062570964011854302bbf57242 uncommitted
--- a/sys/src/cmd/git/diff
+++ b/sys/src/cmd/git/diff
@@ -26,12 +26,16 @@
                git/query -c $commit HEAD | subst '^..'
 }
 
+mntgen /mnt/scratch
+bind $branch/tree/ /mnt/scratch/a
+bind . /mnt/scratch/b
+echo diff `{git/query $commit} uncommitted
 for(f in `$nl{lsdirty | sort | uniq}){
-       orig=$branch/tree/$f
-       if(! test -f $orig)
+       cd /mnt/scratch
+       if(! test -f a/$f)
                orig=/dev/null
-       if(! test -f $f)
+       if(! test -f b/$f)
                f=/dev/null
-       diff -u $orig $f
+       diff -u a/$f b/$f
 }
 exit ''
--- a/sys/src/cmd/git/import
+++ b/sys/src/cmd/git/import
@@ -45,7 +45,7 @@
                state="body"
                next
        }
-       (state=="headers" || state=="body") && (/^diff/ || /^---[       ]*$/){
+       (state=="headers" || state=="body") && (/^diff / || /^--- /){
                state="diff"
        }
        state=="body" {


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T403f90e3b0509704-Md1cc4902bb399c16511e2f9b
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] git/{diff,import}: make it easier to handle manually-asembled patch emails
  2021-08-22 17:10 [9fans] git/{diff,import}: make it easier to handle manually-asembled patch emails ori
@ 2021-08-22 17:12 ` ori
  2021-08-22 17:19   ` ori
  0 siblings, 1 reply; 3+ messages in thread
From: ori @ 2021-08-22 17:12 UTC (permalink / raw)
  To: 9fans

Oops, sent to the wrong mailing list -- sorry about the noise.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T403f90e3b0509704-M300dfe7499e5b62ca9db9bbf
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] git/{diff,import}: make it easier to handle manually-asembled patch emails
  2021-08-22 17:12 ` ori
@ 2021-08-22 17:19   ` ori
  0 siblings, 0 replies; 3+ messages in thread
From: ori @ 2021-08-22 17:19 UTC (permalink / raw)
  To: 9fans

Quoth ori@eigenstate.org:
> Oops, sent to the wrong mailing list -- sorry about the noise.
> 

Also, as a side note, it seems like the 9fans
mailing lists mangles patches -- if anyone
ever sends patches, they'll need to be sent
as attachments.


------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T403f90e3b0509704-M61320344b346fd78f92b2b62
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-08-22 17:19 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-22 17:10 [9fans] git/{diff,import}: make it easier to handle manually-asembled patch emails ori
2021-08-22 17:12 ` ori
2021-08-22 17:19   ` ori

9fans - fans of the OS Plan 9 from Bell Labs

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.vuxu.org/9fans

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V1 9fans 9fans/ https://inbox.vuxu.org/9fans \
		9fans@9fans.net
	public-inbox-index 9fans

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.vuxu.org/vuxu.archive.9fans


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git