* ignore blank line removals @ 2016-11-03 15:57 John Rood 2016-11-15 17:56 ` John Rood 0 siblings, 1 reply; 4+ messages in thread From: John Rood @ 2016-11-03 15:57 UTC (permalink / raw) To: git If the contents of a file initially are: one three and on branch A there is a commit, removing the blank line: one three and on branch B there is a commit, adding 'two': one two three Normally, if you try to merge A into B (or B into A), git recognizes a decision needs to be made between removing the second line or add "two" to the second line. It would be convenient to have a merge strategy that defaults to the latter in cases where the removed line was a blank line (or a line containing only whitespace) ...something like -Xignore-blank-line-removals. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ignore blank line removals 2016-11-03 15:57 ignore blank line removals John Rood @ 2016-11-15 17:56 ` John Rood 2016-11-15 18:51 ` Junio C Hamano 0 siblings, 1 reply; 4+ messages in thread From: John Rood @ 2016-11-15 17:56 UTC (permalink / raw) To: git Is there any push-back on this, or is there a backlog that we can add this feature to? On Thu, Nov 3, 2016 at 10:57 AM, John Rood <mr.john.rood@gmail.com> wrote: > If the contents of a file initially are: > one > > three > and on branch A there is a commit, removing the blank line: > one > three > and on branch B there is a commit, adding 'two': > one > two > three > Normally, if you try to merge A into B (or B into A), git recognizes a > decision needs to be made between removing the second line or add > "two" to the second line. It would be convenient to have a merge > strategy that defaults to the latter in cases where the removed line > was a blank line (or a line containing only whitespace) ...something > like -Xignore-blank-line-removals. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ignore blank line removals 2016-11-15 17:56 ` John Rood @ 2016-11-15 18:51 ` Junio C Hamano 2016-11-15 19:32 ` John Rood 0 siblings, 1 reply; 4+ messages in thread From: Junio C Hamano @ 2016-11-15 18:51 UTC (permalink / raw) To: John Rood; +Cc: git John Rood <mr.john.rood@gmail.com> writes: > On Thu, Nov 3, 2016 at 10:57 AM, John Rood <mr.john.rood@gmail.com> wrote: >> If the contents of a file initially are: >> one >> >> three >> and on branch A there is a commit, removing the blank line: >> one >> three >> and on branch B there is a commit, adding 'two': >> one >> two >> three >> Normally, if you try to merge A into B (or B into A), git recognizes a >> decision needs to be made between removing the second line or add >> "two" to the second line. It would be convenient to have a merge >> strategy that defaults to the latter in cases where the removed line >> was a blank line (or a line containing only whitespace) ...something >> like -Xignore-blank-line-removals. > > Is there any push-back on this, or is there a backlog that we can add > this feature to? If you mean by "push-back" objections that say "this feature is evil and should not be added to Git, ever", I do not think we saw any on the list. The lack of response is most likely that everybody thought "Meh." aka "It is not useful/interesting/valuable enough feature to bother discussing." One thing I wondered was what you would want if the contents were one/three without blank, A added blank between the two and B replaced blank with two. As your example shows, in the filetype you are dealing with, a blank line has no significant meaning (otherwise you won't be ignoring the change A made to remove the blank in your original example). The outcome desired by you may be one/two/three without any blank in that case because of that. Which would lead to the suspicion that ignore-blank-line-removals is not a good general feature (i.e. in this other example, you want to ignore blank line addition). Which further leads to the suspicion that the desire you expressed in the original post is not well thought through to be a useful specifification to build anything out of (yet), but is merely a potentially interesting discussion starter. And nobody so far found it interesting enough to spend time discussing it further to make the wish detailed enough to be called a "design" of a new feature. Having said all that. I suspect that you may not have to make any change to Git to do what you want; can't you just use the 'merge' attribute with a custom 3-way merge driver that removes an empty line? ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ignore blank line removals 2016-11-15 18:51 ` Junio C Hamano @ 2016-11-15 19:32 ` John Rood 0 siblings, 0 replies; 4+ messages in thread From: John Rood @ 2016-11-15 19:32 UTC (permalink / raw) To: Junio C Hamano; +Cc: git Yes that makes sense. I was not aware of custom merge drivers, but indeed that may address my situation. I'll look into it. Thanks! On Tue, Nov 15, 2016 at 12:51 PM, Junio C Hamano <gitster@pobox.com> wrote: > John Rood <mr.john.rood@gmail.com> writes: > >> On Thu, Nov 3, 2016 at 10:57 AM, John Rood <mr.john.rood@gmail.com> wrote: >>> If the contents of a file initially are: >>> one >>> >>> three >>> and on branch A there is a commit, removing the blank line: >>> one >>> three >>> and on branch B there is a commit, adding 'two': >>> one >>> two >>> three >>> Normally, if you try to merge A into B (or B into A), git recognizes a >>> decision needs to be made between removing the second line or add >>> "two" to the second line. It would be convenient to have a merge >>> strategy that defaults to the latter in cases where the removed line >>> was a blank line (or a line containing only whitespace) ...something >>> like -Xignore-blank-line-removals. >> >> Is there any push-back on this, or is there a backlog that we can add >> this feature to? > > If you mean by "push-back" objections that say "this feature is evil > and should not be added to Git, ever", I do not think we saw any on > the list. The lack of response is most likely that everybody > thought "Meh." aka "It is not useful/interesting/valuable enough > feature to bother discussing." > > One thing I wondered was what you would want if the contents were > one/three without blank, A added blank between the two and B > replaced blank with two. As your example shows, in the filetype you > are dealing with, a blank line has no significant meaning (otherwise > you won't be ignoring the change A made to remove the blank in your > original example). The outcome desired by you may be one/two/three > without any blank in that case because of that. Which would lead to > the suspicion that ignore-blank-line-removals is not a good general > feature (i.e. in this other example, you want to ignore blank line > addition). Which further leads to the suspicion that the desire you > expressed in the original post is not well thought through to be a > useful specifification to build anything out of (yet), but is merely > a potentially interesting discussion starter. And nobody so far > found it interesting enough to spend time discussing it further to > make the wish detailed enough to be called a "design" of a new > feature. > > Having said all that. > > I suspect that you may not have to make any change to Git to do what > you want; can't you just use the 'merge' attribute with a custom > 3-way merge driver that removes an empty line? > ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2016-11-15 19:32 UTC | newest] Thread overview: 4+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-11-03 15:57 ignore blank line removals John Rood 2016-11-15 17:56 ` John Rood 2016-11-15 18:51 ` Junio C Hamano 2016-11-15 19:32 ` John Rood
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox