* [PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing.
@ 2009-08-01 16:57 Thell Fowler
2009-08-04 21:15 ` Nanako Shiraishi
0 siblings, 1 reply; 4+ messages in thread
From: Thell Fowler @ 2009-08-01 16:57 UTC (permalink / raw)
To: git
- Added --allow-eof-whitelines to git apply to short-circuit removal
of new empty lines when tailing-space is set.
- Added pass-through to apply from git-am.sh
- Added pass-through to git-am from git-rebase.sh
- Added the auto-completion entries.
Signed-off-by: TBFowler <thell@almostautomated.com>
---
builtin-apply.c | 5 ++++-
contrib/completion/git-completion.bash | 4 ++--
git-am.sh | 3 +++
git-rebase.sh | 3 +++
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/builtin-apply.c b/builtin-apply.c
index dc0ff5e..79be05c 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -43,6 +43,7 @@ static int apply = 1;
static int apply_in_reverse;
static int apply_with_reject;
static int apply_verbosely;
+static int keep_new_eof_whitelines;
static int no_add;
static const char *fake_ancestor;
static int line_termination = '\n';
@@ -1996,7 +1997,7 @@ static int apply_one_fragment(struct image *img,
struct fragment *frag,
error("invalid start of line: '%c'", first);
return -1;
}
- if (added_blank_line)
+ if (added_blank_line && !keep_new_eof_whitelines)
new_blank_lines_at_end++;
else
new_blank_lines_at_end = 0;
@@ -3304,6 +3305,8 @@ int cmd_apply(int argc, const char **argv, const
char *unused_prefix)
{ OPTION_CALLBACK, 0, "whitespace", &whitespace_option, "action",
"detect new or modified lines that have whitespace errors",
0, option_parse_whitespace },
+ OPT_BOOLEAN(0, "allow-eof-whitelines", &keep_new_eof_whitelines,
+ "allow processing of whitespace fix but don't suppress new
whitelines at end of file"),
OPT_BOOLEAN('R', "reverse", &apply_in_reverse,
"apply the patch in reverse"),
OPT_BOOLEAN(0, "unidiff-zero", &unidiff_zero,
diff --git a/contrib/completion/git-completion.bash
b/contrib/completion/git-completion.bash
index 745b5fb..512b14c 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -675,7 +675,7 @@ _git_am ()
__gitcomp "
--3way --committer-date-is-author-date --ignore-date
--interactive --keep --no-utf8 --signoff --utf8
- --whitespace=
+ --whitespace= --allow-eof-whitelines
"
return
esac
@@ -695,7 +695,7 @@ _git_apply ()
--stat --numstat --summary --check --index
--cached --index-info --reverse --reject --unidiff-zero
--apply --no-add --exclude=
- --whitespace= --inaccurate-eof --verbose
+ --whitespace= --allow-eof-whitelines --inaccurate-eof --verbose
"
return
esac
diff --git a/git-am.sh b/git-am.sh
index d64d997..5757674 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -16,6 +16,7 @@ s,signoff add a Signed-off-by line to the commit message
u,utf8 recode into utf8 (default)
k,keep pass -k flag to git-mailinfo
whitespace= pass it through git-apply
+allow-eof-whitelines pass it through git-apply
directory= pass it through git-apply
C= pass it through git-apply
p= pass it through git-apply
@@ -299,6 +300,8 @@ do
shift; resolvemsg=$1 ;;
--whitespace|--directory)
git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;;
+ --allow-eof-whitelines)
+ git_apply_opt="$git_apply_opt $1" ;;
-C|-p)
git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
--patch-format)
diff --git a/git-rebase.sh b/git-rebase.sh
index 18bc694..1556224 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -333,6 +333,9 @@ do
;;
esac
;;
+ --allow-eof-whitelines)
+ git_am_opt="$git_am_opt $1"
+ ;;
--committer-date-is-author-date|--ignore-date)
git_am_opt="$git_am_opt $1"
force_rebase=t
--
1.6.4.rc3.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing.
2009-08-01 16:53 [RFC] Allowing new eof whitelines while still doing whitespace trailing-space fix Thell Fowler
@ 2009-08-01 22:12 ` TBFowler
0 siblings, 0 replies; 4+ messages in thread
From: TBFowler @ 2009-08-01 22:12 UTC (permalink / raw)
To: git; +Cc: TBFowler
- Added --allow-eof-whitelines to git apply to short-circuit removal of new empty lines when tailing-space is set.
- Added pass-through to apply from git-am.sh
- Added pass-through to git-am from git-rebase.sh
- Added the auto-completion entries.
Signed-off-by: TBFowler <thell@almostautomated.com>
---
builtin-apply.c | 5 ++++-
contrib/completion/git-completion.bash | 4 ++--
git-am.sh | 3 +++
git-rebase.sh | 3 +++
4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/builtin-apply.c b/builtin-apply.c
index dc0ff5e..79be05c 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -43,6 +43,7 @@ static int apply = 1;
static int apply_in_reverse;
static int apply_with_reject;
static int apply_verbosely;
+static int keep_new_eof_whitelines;
static int no_add;
static const char *fake_ancestor;
static int line_termination = '\n';
@@ -1996,7 +1997,7 @@ static int apply_one_fragment(struct image *img, struct fragment *frag,
error("invalid start of line: '%c'", first);
return -1;
}
- if (added_blank_line)
+ if (added_blank_line && !keep_new_eof_whitelines)
new_blank_lines_at_end++;
else
new_blank_lines_at_end = 0;
@@ -3304,6 +3305,8 @@ int cmd_apply(int argc, const char **argv, const char *unused_prefix)
{ OPTION_CALLBACK, 0, "whitespace", &whitespace_option, "action",
"detect new or modified lines that have whitespace errors",
0, option_parse_whitespace },
+ OPT_BOOLEAN(0, "allow-eof-whitelines", &keep_new_eof_whitelines,
+ "allow processing of whitespace fix but don't suppress new whitelines at end of file"),
OPT_BOOLEAN('R', "reverse", &apply_in_reverse,
"apply the patch in reverse"),
OPT_BOOLEAN(0, "unidiff-zero", &unidiff_zero,
diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 745b5fb..512b14c 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -675,7 +675,7 @@ _git_am ()
__gitcomp "
--3way --committer-date-is-author-date --ignore-date
--interactive --keep --no-utf8 --signoff --utf8
- --whitespace=
+ --whitespace= --allow-eof-whitelines
"
return
esac
@@ -695,7 +695,7 @@ _git_apply ()
--stat --numstat --summary --check --index
--cached --index-info --reverse --reject --unidiff-zero
--apply --no-add --exclude=
- --whitespace= --inaccurate-eof --verbose
+ --whitespace= --allow-eof-whitelines --inaccurate-eof --verbose
"
return
esac
diff --git a/git-am.sh b/git-am.sh
index d64d997..5757674 100755
--- a/git-am.sh
+++ b/git-am.sh
@@ -16,6 +16,7 @@ s,signoff add a Signed-off-by line to the commit message
u,utf8 recode into utf8 (default)
k,keep pass -k flag to git-mailinfo
whitespace= pass it through git-apply
+allow-eof-whitelines pass it through git-apply
directory= pass it through git-apply
C= pass it through git-apply
p= pass it through git-apply
@@ -299,6 +300,8 @@ do
shift; resolvemsg=$1 ;;
--whitespace|--directory)
git_apply_opt="$git_apply_opt $(sq "$1=$2")"; shift ;;
+ --allow-eof-whitelines)
+ git_apply_opt="$git_apply_opt $1" ;;
-C|-p)
git_apply_opt="$git_apply_opt $(sq "$1$2")"; shift ;;
--patch-format)
diff --git a/git-rebase.sh b/git-rebase.sh
index 18bc694..1556224 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -333,6 +333,9 @@ do
;;
esac
;;
+ --allow-eof-whitelines)
+ git_am_opt="$git_am_opt $1"
+ ;;
--committer-date-is-author-date|--ignore-date)
git_am_opt="$git_am_opt $1"
force_rebase=t
--
1.6.4.rc3.dirty
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing.
2009-08-01 16:57 [PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing Thell Fowler
@ 2009-08-04 21:15 ` Nanako Shiraishi
2009-08-05 0:15 ` Thell Fowler
0 siblings, 1 reply; 4+ messages in thread
From: Nanako Shiraishi @ 2009-08-04 21:15 UTC (permalink / raw)
To: Thell Fowler; +Cc: git
Quoting Thell Fowler <tbfowler4@gmail.com>
> - Added --allow-eof-whitelines to git apply to short-circuit removal
> of new empty lines when tailing-space is set.
> - Added pass-through to apply from git-am.sh
> - Added pass-through to git-am from git-rebase.sh
> - Added the auto-completion entries.
>
> Signed-off-by: TBFowler <thell@almostautomated.com>
I like this new feature. However, this topic came up last week, and Junio said that whitespace checking should be controlled with the attributes mechanism.
http://thread.gmane.org/gmane.comp.version-control.git/124113/focus=124138
Please do not talk "I did this, I did that" in your proposed commit log
message. From Documentation/SubmittingPatches:
- the body should provide a meaningful commit message, which:
- uses the imperative, present tense: "change",
not "changed" or "changes".
- includes motivation for the change, and contrasts
its implementation with previous behaviour
In other words, the messages are often written as if you are giving an order to the program to correct itself.
--
Nanako Shiraishi
http://ivory.ap.teacup.com/nanako3/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing.
2009-08-04 21:15 ` Nanako Shiraishi
@ 2009-08-05 0:15 ` Thell Fowler
0 siblings, 0 replies; 4+ messages in thread
From: Thell Fowler @ 2009-08-05 0:15 UTC (permalink / raw)
To: Nanako Shiraishi; +Cc: git
On Wed, 2009-08-05 at 06:15 +0900, Nanako Shiraishi wrote:
> Quoting Thell Fowler <tbfowler4@gmail.com>
>
> > - Added --allow-eof-whitelines to git apply to short-circuit removal
> > of new empty lines when tailing-space is set.
> > - Added pass-through to apply from git-am.sh
> > - Added pass-through to git-am from git-rebase.sh
> > - Added the auto-completion entries.
> >
> > Signed-off-by: TBFowler <thell@almostautomated.com>
>
> I like this new feature. However, this topic came up last week, and Junio said that whitespace checking should be controlled with the attributes mechanism.
>
> http://thread.gmane.org/gmane.comp.version-control.git/124113/focus=124138
>
Seemed that the issue/resolution was still open for discussion.
http://thread.gmane.org/gmane.comp.version-control.git/124113/focus=124138
Should this be re-done as a whitespace attribute?
> Please do not talk "I did this, I did that" in your proposed commit log
> message. From Documentation/SubmittingPatches:
>
> - the body should provide a meaningful commit message, which:
> - uses the imperative, present tense: "change",
> not "changed" or "changes".
> - includes motivation for the change, and contrasts
> its implementation with previous behaviour
>
> In other words, the messages are often written as if you are giving an order to the program to correct itself.
>
Got it. ...'giving an order'... and the motivation; should be easy to remember.
Thank you for the feedback and instruction.
Thell
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-08-05 0:17 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-01 16:57 [PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing Thell Fowler
2009-08-04 21:15 ` Nanako Shiraishi
2009-08-05 0:15 ` Thell Fowler
-- strict thread matches above, loose matches on Subject: below --
2009-08-01 16:53 [RFC] Allowing new eof whitelines while still doing whitespace trailing-space fix Thell Fowler
2009-08-01 22:12 ` [PATCH] Add --allow-eof-whitelines to git-apply while still doing whitespace trailing-space fixing TBFowler
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).