Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
bc31fc9c
Kaydet (Commit)
bc31fc9c
authored
Haz 13, 2012
tarafından
Norbert Thiebaud
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
be stricter with tab
Change-Id: I17db9db426b10e0cb2148b33dfc9631ea9cb81a4
üst
f5e1c753
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
46 deletions
+60
-46
pre-commit
git-hooks/pre-commit
+60
-46
No files found.
git-hooks/pre-commit
Dosyayı görüntüle @
bc31fc9c
...
...
@@ -21,57 +21,70 @@ sub check_whitespaces($)
my
$filename
;
my
$reported_filename
=
""
;
my
$lineno
;
sub
bad_line
{
my
(
$why
,
$line
,
$file_filter
)
=
@_
;
if
(
!
defined
$file_filter
||
$filename
=~
/\.($file_filter)$/
)
{
if
(
!
$found_bad
)
{
print
STDERR
"*\n"
;
print
STDERR
"* You have some suspicious patch lines:\n"
;
print
STDERR
"*\n"
;
$found_bad
=
1
;
}
if
(
$reported_filename
ne
$filename
)
{
print
STDERR
"* In $filename\n"
;
$reported_filename
=
$filename
;
}
print
STDERR
"* $why (line $lineno)\n"
;
print
STDERR
"$filename:$lineno:$line\n"
;
sub
bad_line
{
my
(
$why
,
$line
,
$file_filter
)
=
@_
;
if
(
!
defined
$file_filter
||
$filename
=~
/\.($file_filter)$/
)
{
if
(
!
$found_bad
)
{
print
STDERR
"*\n"
;
print
STDERR
"* You have some suspicious patch lines:\n"
;
print
STDERR
"*\n"
;
$found_bad
=
1
;
}
if
(
$reported_filename
ne
$filename
)
{
print
STDERR
"* In $filename\n"
;
$reported_filename
=
$filename
;
}
print
STDERR
"* $why (line $lineno)\n"
;
print
STDERR
"$filename:$lineno:$line\n"
;
}
}
open
(
FILES
,
"git-diff-index -p -M --cached $h |"
)
||
die
"Cannot run git diff-index."
;
while
(
<
FILES
>
)
{
if
(
m|^diff --git a/(.*) b/\1$|
)
{
$filename
=
$1
;
next
;
}
if
(
/^@@ -\S+ \+(\d+)/
)
{
$lineno
=
$1
-
1
;
next
;
}
if
(
/^ /
)
{
$lineno
++
;
next
;
}
if
(
s/^\+//
)
{
$lineno
++
;
chomp
;
if
(
/\s$/
)
{
bad_line
(
"trailing whitespace"
,
$_
,
$src_limited
);
}
if
(
/^\s* /
)
{
bad_line
(
"indent SP followed by a TAB"
,
$_
,
$src_limited
);
}
if
(
/^(?:[<>=]){7}$/
)
{
bad_line
(
"unresolved merge conflict"
,
$src_full
);
}
if
(
/SAL_DEBUG/
)
{
bad_line
(
"temporary debug in commit"
,
$_
,
$src_limited
);
}
}
while
(
<
FILES
>
)
{
if
(
m|^diff --git a/(.*) b/\1$|
)
{
$filename
=
$1
;
next
;
}
if
(
/^@@ -\S+ \+(\d+)/
)
{
$lineno
=
$1
-
1
;
next
;
}
if
(
/^ /
)
{
$lineno
++
;
next
;
}
if
(
s/^\+//
)
{
$lineno
++
;
chomp
;
if
(
/\s$/
)
{
bad_line
(
"trailing whitespace"
,
$_
,
$src_limited
);
}
if
(
/\s* /
)
{
bad_line
(
"indent with Tab"
,
$_
,
$src_limited
);
}
if
(
/^(?:[<>=]){7}$/
)
{
bad_line
(
"unresolved merge conflict"
,
$src_full
);
}
if
(
/SAL_DEBUG/
)
{
bad_line
(
"temporary debug in commit"
,
$_
,
$src_limited
);
}
}
}
if
(
$found_bad
)
{
exit
(
$found_bad
);
exit
(
$found_bad
);
}
}
...
...
@@ -79,7 +92,8 @@ sub check_whitespaces($)
# Initial commit: diff against an empty tree object
my
$against
=
"4b825dc642cb6eb9a060e54bf8d69288fbee4904"
;
if
(
system
(
"git rev-parse --verify HEAD >/dev/null 2>&1"
)
==
0
)
{
if
(
system
(
"git rev-parse --verify HEAD >/dev/null 2>&1"
)
==
0
)
{
$against
=
"HEAD"
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment