emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* git diff: hunk header config
@ 2011-07-31 11:49 Michael Brand
  2011-08-20 16:12 ` Michael Brand
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Brand @ 2011-07-31 11:49 UTC (permalink / raw)
  To: Org Mode

Hi all

I suggest to change the config of git diff in the org-mode.git repo to
the more helpful hunk header (the @@...@@ line) style:

#+begin_src diff
@@ -12991,7 +12991,7 @@ (defun org-align-tags-here (to-col)
          (goto-char (match-beginning 1))
          (insert " ")
          (delete-region (point) (1+ (match-beginning 2)))
-         (setq ncol (max (1+ (current-column))
+         (setq ncol (max (current-column)
                          (1+ col)
                          (if (> to-col 0)
                              to-col
#+end_src

which is similar to GNU diff -p/--show-c-function. The current, not
configured default "style" is:

#+begin_src diff
@@ -12991,7 +12991,7 @@ If ONOFF is `on' or `off', don't toggle but set to thi
          (goto-char (match-beginning 1))
          (insert " ")
          (delete-region (point) (1+ (match-beginning 2)))
-         (setq ncol (max (1+ (current-column))
+         (setq ncol (max (current-column)
                          (1+ col)
                          (if (> to-col 0)
                              to-col
#+end_src

Would that be commonly welcome for at least firstly Emacs Lisp and texinfo?

If yes, the following is to be added to the org-mode.git repo:

1) new file .gitattributes:
#+begin_src
*.el    diff=el
*.texi  diff=texinfo
#+end_src

2) append to .git/config:
#+begin_src
[diff "el"]
	xfuncname = "^(\\(def[a-z]+ .+)$"
[diff "texinfo"]
	xfuncname="^(@(sub)*section.*)$"
#+end_src

I hope that somebody can do this in the repo in such a way that it
will be effective after git pull and git clone automatically, so that
nobody has to care about later.

Michael

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

* Re: git diff: hunk header config
  2011-07-31 11:49 git diff: hunk header config Michael Brand
@ 2011-08-20 16:12 ` Michael Brand
  2011-08-20 21:47   ` suvayu ali
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Brand @ 2011-08-20 16:12 UTC (permalink / raw)
  To: Org Mode; +Cc: Jason Dunsmore, Andrea Crotti, Carsten Dominik

Hi all

1) Since there has been no feedback yet I'd like to bump my previous
post repeated below. I would like to have the config of the repo
orgmode.org/org-mode.git to be extended to support more useful diff
hunk headers containing e. g. the prototype of the current function
for *.el files. Like
"@@ -12991,7 +12991,7 @@ (defun org-align-tags-here (to-col)"
instead of the current
"@@ -12991,7 +12991,7 @@ If ONOFF is `on' or `off', don't toggle but set to thi"
Can this be done in the repo orgmode.org/org-mode.git at all?
Effective for everyone after only git pull?

2) Note: Also a config of git, but for diff of crypted Org files is
shown at the end of this recent post:
http://thread.gmane.org/gmane.emacs.orgmode/45781/focus=45938

Michael

On Sun, Jul 31, 2011 at 13:49, Michael Brand <michael.ch.brand@gmail.com> wrote:
> Hi all
>
> I suggest to change the config of git diff in the org-mode.git repo to
> the more helpful hunk header (the @@...@@ line) style:
>
> #+begin_src diff
> @@ -12991,7 +12991,7 @@ (defun org-align-tags-here (to-col)
>          (goto-char (match-beginning 1))
>          (insert " ")
>          (delete-region (point) (1+ (match-beginning 2)))
> -         (setq ncol (max (1+ (current-column))
> +         (setq ncol (max (current-column)
>                          (1+ col)
>                          (if (> to-col 0)
>                              to-col
> #+end_src
>
> which is similar to GNU diff -p/--show-c-function. The current, not
> configured default "style" is:
>
> #+begin_src diff
> @@ -12991,7 +12991,7 @@ If ONOFF is `on' or `off', don't toggle but set to thi
>          (goto-char (match-beginning 1))
>          (insert " ")
>          (delete-region (point) (1+ (match-beginning 2)))
> -         (setq ncol (max (1+ (current-column))
> +         (setq ncol (max (current-column)
>                          (1+ col)
>                          (if (> to-col 0)
>                              to-col
> #+end_src
>
> Would that be commonly welcome for at least firstly Emacs Lisp and texinfo?
>
> If yes, the following is to be added to the org-mode.git repo:
>
> 1) new file .gitattributes:
> #+begin_src
> *.el    diff=el
> *.texi  diff=texinfo
> #+end_src
>
> 2) append to .git/config:
> #+begin_src
> [diff "el"]
>        xfuncname = "^(\\(def[a-z]+ .+)$"
> [diff "texinfo"]
>        xfuncname="^(@(sub)*section.*)$"
> #+end_src
>
> I hope that somebody can do this in the repo in such a way that it
> will be effective after git pull and git clone automatically, so that
> nobody has to care about later.
>
> Michael

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

* Re: git diff: hunk header config
  2011-08-20 16:12 ` Michael Brand
@ 2011-08-20 21:47   ` suvayu ali
  2011-08-24 10:39     ` Bastien
  2011-08-24 19:20     ` Michael Brand
  0 siblings, 2 replies; 8+ messages in thread
From: suvayu ali @ 2011-08-20 21:47 UTC (permalink / raw)
  To: Michael Brand; +Cc: Jason Dunsmore, Org Mode, Andrea Crotti, Carsten Dominik

Hi Michael,

On Sat, Aug 20, 2011 at 6:12 PM, Michael Brand
<michael.ch.brand@gmail.com> wrote:
> 1) Since there has been no feedback yet I'd like to bump my previous
> post repeated below. I would like to have the config of the repo
> orgmode.org/org-mode.git to be extended to support more useful diff
> hunk headers containing e. g. the prototype of the current function
> for *.el files. Like
> "@@ -12991,7 +12991,7 @@ (defun org-align-tags-here (to-col)"
> instead of the current
> "@@ -12991,7 +12991,7 @@ If ONOFF is `on' or `off', don't toggle but set to thi"
> Can this be done in the repo orgmode.org/org-mode.git at all?
> Effective for everyone after only git pull?
>

This is a very useful config. Thanks for pointing it out. But don't
you think this is a client side setting? As far as I am aware,
settings don't carry over from the remote repository. Its distributed
versioning after all. :)

To make this a server side setting, you would have to add .git/config
and .gitattributes to the repo. But I think that is not correct as
many users might have their own settings that will have to be remerged
at every update.

What do you think? In any case, I think this would be a wonderful
addition to org-faq.org on Worg.

-- 
Suvayu

Open source is the future. It sets us free.

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

* Re: git diff: hunk header config
  2011-08-20 21:47   ` suvayu ali
@ 2011-08-24 10:39     ` Bastien
  2011-08-24 19:20     ` Michael Brand
  1 sibling, 0 replies; 8+ messages in thread
From: Bastien @ 2011-08-24 10:39 UTC (permalink / raw)
  To: suvayu ali
  Cc: Michael Brand, Jason Dunsmore, Org Mode, Andrea Crotti,
	Carsten Dominik

Hi folks,

suvayu ali <fatkasuvayu+linux@gmail.com> writes:

> This is a very useful config. Thanks for pointing it out. But don't
> you think this is a client side setting? As far as I am aware,
> settings don't carry over from the remote repository. Its distributed
> versioning after all. :)
>
> To make this a server side setting, you would have to add .git/config
> and .gitattributes to the repo. But I think that is not correct as
> many users might have their own settings that will have to be remerged
> at every update.

I let Jason decide upon this.

> What do you think? In any case, I think this would be a wonderful
> addition to org-faq.org on Worg.

Suvayu, please feel free to add it to Worg!

Best,

-- 
 Bastien

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

* Re: git diff: hunk header config
  2011-08-20 21:47   ` suvayu ali
  2011-08-24 10:39     ` Bastien
@ 2011-08-24 19:20     ` Michael Brand
  2011-08-24 19:37       ` Achim Gratz
  1 sibling, 1 reply; 8+ messages in thread
From: Michael Brand @ 2011-08-24 19:20 UTC (permalink / raw)
  To: Org Mode; +Cc: Bastien, Jason Dunsmore, Andrea Crotti, Carsten Dominik

On Sat, Aug 20, 2011 at 23:47, suvayu ali <fatkasuvayu+linux@gmail.com> wrote:
> On Sat, Aug 20, 2011 at 6:12 PM, Michael Brand
>> [...]
>> "@@ -12991,7 +12991,7 @@ (defun org-align-tags-here (to-col)"
>> instead of the current
>> "@@ -12991,7 +12991,7 @@ If ONOFF is `on' or `off', don't toggle but set to thi"
>
> [...]
> To make this a server side setting, you would have to add .git/config
> and .gitattributes to the repo. But I think that is not correct as
> many users might have their own settings that will have to be remerged
> at every update.

According to the git manual there is a cleaner way for local changes:
- gitattributes(5) Manual Page:
  - "Attributes which should be version-controlled and distributed to
    other repositories (i.e., attributes of interest to all users)
    should go into .gitattributes files."
  - "If you wish to affect only a single repository (i.e., to assign
    attributes to files that are particular to one user’s workflow for
    that repository), then attributes should be placed in the
    $GIT_DIR/info/attributes file."
- git-config(1) Manual Page:
  - "$GIT_DIR/config: Repository specific configuration file." and
    "The .git/config file in each repository is used to store the
    configuration for that repository"
  - "~/.gitconfig: User-specific configuration file." and
    "$HOME/.gitconfig is used to store a per-user configuration as
    fallback values for the .git/config file."

For .gitattributes it seems to be ok to make it a versioned git repo
element. Proposal for the content (changed from first post):
#+begin_src
# This file is intended to be effective for all users of this repository.
# Use ".git/info/attributes" for changes specific to the local user(s).

*.el    diff=el
*.texi  diff=texinfo
#+end_src

For .git/config I am not sure if it can be made a versioned git repo
element. If not, I don't know how it can become part of the transfer
during git pull which it should be in any case. Proposal for the
content (changed from first post):
#+begin_src
# This file is intended to be effective for all users of this repository.
# Use "$HOME/.gitconfig" for changes specific to one user.

[core]
	repositoryformatversion = 0
	filemode = true
	bare = false
	logallrefupdates = true
[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git://orgmode.org/org-mode.git
[branch "master"]
	remote = origin
	merge = refs/heads/master
[diff "el"]
	xfuncname = "^(\\(def[a-z]+ .+)$"
[diff "texinfo"]
	xfuncname = "^(@(sub)*section.*)$"
#+end_src

> What do you think? In any case, I think this would be a wonderful
> addition to org-faq.org on Worg.

What I would like is that the hunk headers of all future patches from
all contributers look like proposed. Without requiring them to change
their config now and with every new git clone. For me it is not enough
if only a few contributers that stumble upon this FAQ entry and then
even care about, change their config.

Michael

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

* Re: git diff: hunk header config
  2011-08-24 19:20     ` Michael Brand
@ 2011-08-24 19:37       ` Achim Gratz
  2011-08-27  9:15         ` Michael Brand
  0 siblings, 1 reply; 8+ messages in thread
From: Achim Gratz @ 2011-08-24 19:37 UTC (permalink / raw)
  To: emacs-orgmode

Michael Brand <michael.ch.brand@gmail.com> writes:
> For .git/config I am not sure if it can be made a versioned git repo
> element. If not, I don't know how it can become part of the transfer
> during git pull which it should be in any case. Proposal for the
> content (changed from first post):

You can't and I don't think that is an oversight.  As a general
principle such configurations should not be part of the repository at
all.  Please note that if you do configure it that way locally, all
tools in git will show all diffs in the new format, so there is nothing
lost if everybody doesn't have the same configuration.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptation for Waldorf Blofeld V1.15B11:
http://Synth.Stromeko.net/Downloads.html#WaldorfSDada

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

* Re: git diff: hunk header config
  2011-08-24 19:37       ` Achim Gratz
@ 2011-08-27  9:15         ` Michael Brand
  2011-08-27  9:44           ` Achim Gratz
  0 siblings, 1 reply; 8+ messages in thread
From: Michael Brand @ 2011-08-27  9:15 UTC (permalink / raw)
  To: Achim Gratz, Jason Dunsmore, Matt Lundin; +Cc: Org Mode

Hi Achim, Jason and Matt

On Wed, Aug 24, 2011 at 21:37, Achim Gratz <Stromeko@nexgo.de> wrote:
> Michael Brand <michael.ch.brand@gmail.com> writes:
>> For .git/config I am not sure if it can be made a versioned git repo
>> element. If not, I don't know how it can become part of the transfer
>> during git pull which it should be in any case. Proposal for the
>> content (changed from first post):
>
> You can't and I don't think that is an oversight.  As a general
> principle such configurations should not be part of the repository at
> all.  Please note that if you do configure it that way locally, all
> tools in git will show all diffs in the new format, so there is nothing
> lost if everybody doesn't have the same configuration.

Thanks for the clarification. Because I didn't expect this at all it
took me some time to understand that a local config affects also the
diffs already committed, not only "git diff" of uncommitted changes.
Neat.

But aren't there still things lost when one does this only locally?
1) The web browser view of the git repos
   http://orgmode.org/w/org-mode.git, its delayed mirror
   http://repo.or.cz/w/org-mode.git and http://repo.or.cz/w/Worg.git
   (for code/elisp/): Can be solved by configuring these three
   repos locally.
2) When reading patches submitted to the mailing list: Here I don't
   know the solution. In my simple trial, .gitattributes was not
   available in its clone done afterwards.

@Jason and Matt: At least, changing 1) alone would already help. What
do you think?

Michael

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

* Re: git diff: hunk header config
  2011-08-27  9:15         ` Michael Brand
@ 2011-08-27  9:44           ` Achim Gratz
  0 siblings, 0 replies; 8+ messages in thread
From: Achim Gratz @ 2011-08-27  9:44 UTC (permalink / raw)
  To: emacs-orgmode

Michael Brand <michael.ch.brand@gmail.com> writes:
> Thanks for the clarification. Because I didn't expect this at all it
> took me some time to understand that a local config affects also the
> diffs already committed, not only "git diff" of uncommitted changes.

Git doesn't "commit diffs", which is why this is working (and a frequent
source of confusion for people who don't know the architecture of Git).

> Neat.

One of those things that reassures me that Git has made the right
choices.

> But aren't there still things lost when one does this only locally?
> 1) The web browser view of the git repos
>    http://orgmode.org/w/org-mode.git, its delayed mirror
>    http://repo.or.cz/w/org-mode.git and http://repo.or.cz/w/Worg.git
>    (for code/elisp/): Can be solved by configuring these three
>    repos locally.

I wouldn't know how to configure repo.or.cz (or any other mirror), but
it might be worth asking the maintainers of that site if they would
consider adding a global configuration.  Customizing the (global)
configuation on orgmode.org is at Jasons discretion, I guess.

> 2) When reading patches submitted to the mailing list: Here I don't
>    know the solution. In my simple trial, .gitattributes was not
>    available in its clone done afterwards.

Don't read them on the mailing list, then.  Apply them in Git and look
at them whichever way you want to.


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

SD adaptations for KORG EX-800 and Poly-800MkII V0.9:
http://Synth.Stromeko.net/Downloads.html#KorgSDada

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

end of thread, other threads:[~2011-08-27  9:45 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-31 11:49 git diff: hunk header config Michael Brand
2011-08-20 16:12 ` Michael Brand
2011-08-20 21:47   ` suvayu ali
2011-08-24 10:39     ` Bastien
2011-08-24 19:20     ` Michael Brand
2011-08-24 19:37       ` Achim Gratz
2011-08-27  9:15         ` Michael Brand
2011-08-27  9:44           ` Achim Gratz

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).