Skip to content

Kanban board #11293

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 254 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
254 commits
Select commit Hold shift + click to select a range
33791e8
projects can now be listed
adelowo Jul 15, 2019
b531a24
projects can be closed and opened
adelowo Jul 16, 2019
276eb2d
fix redirection url
adelowo Jul 16, 2019
caca9aa
projects can be deleted
adelowo Jul 16, 2019
9d2a8a9
allow a project to be edited
adelowo Jul 18, 2019
f03ce65
update url
adelowo Jul 18, 2019
90fcb62
oops
adelowo Aug 1, 2019
cf7c91e
Merge remote-tracking branch 'origin' into kanban_board
adelowo Aug 1, 2019
e7b16bc
Merge remote-tracking branch 'origin' into kanban_board
adelowo Aug 8, 2019
04690c9
Merge remote-tracking branch 'origin' into kanban_board
adelowo Aug 11, 2019
8ed5579
add UI for selecting project type
adelowo Aug 11, 2019
155531e
allow selection of project type
adelowo Aug 11, 2019
ddd0ab0
improve migrations
adelowo Aug 11, 2019
975be2d
Merge remote-tracking branch 'origin' into kanban_board
adelowo Aug 11, 2019
6064da1
Merge remote-tracking branch 'origin' into kanban_board
adelowo Aug 13, 2019
1b5645b
Merge remote-tracking branch 'origin' into kanban_board
adelowo Aug 14, 2019
d263a7a
create project boards
adelowo Aug 14, 2019
b9dc634
Merge remote-tracking branch 'origin' into kanban_board
adelowo Aug 14, 2019
7d3f4e2
Merge remote-tracking branch 'origin' into kanban_board
adelowo Aug 18, 2019
3328d1a
Merge remote-tracking branch 'origin' into kanban_board
adelowo Aug 25, 2019
76a10f8
merge origin/master
adelowo Aug 25, 2019
016d720
Merge remote-tracking branch 'origin' into kanban_board
adelowo Sep 4, 2019
e7cf2b7
fix compilation
adelowo Sep 4, 2019
89d8838
Merge remote-tracking branch 'origin' into kanban_board
adelowo Sep 14, 2019
82f752c
Allow issues to be assigned to a project
adelowo Sep 14, 2019
1c3c5fb
add comments when you change a project
adelowo Sep 14, 2019
e2e9fea
allow filtering issues by projectID
adelowo Sep 14, 2019
3291520
Merge remote-tracking branch 'origin' into kanban_board
adelowo Sep 15, 2019
1b7bd5d
Merge remote-tracking branch 'origin' into kanban_board
adelowo Sep 16, 2019
98cb54c
Merge remote-tracking branch 'origin' into kanban_board
adelowo Sep 18, 2019
f6f60e3
fix build
adelowo Sep 18, 2019
e3bdc56
Merge remote-tracking branch 'origin' into kanban_board
adelowo Sep 22, 2019
f7a8af5
fix compilation after merge conflict
adelowo Sep 22, 2019
947bb7a
fix migration's arrangement
adelowo Sep 22, 2019
16d7950
save repo ID too
adelowo Sep 22, 2019
74b92ab
save repo ID too
adelowo Sep 22, 2019
16ae30f
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Sep 27, 2019
1832878
Initial view for kanban
adelowo Sep 27, 2019
4440cba
fix board url
adelowo Sep 27, 2019
21699b6
Commit less changes
adelowo Sep 27, 2019
91b0b77
Implement sortable library
adelowo Sep 28, 2019
9641f38
move card across all boards
adelowo Sep 28, 2019
c3c58ab
Merge remote-tracking branch 'origin' into kanban_board
adelowo Sep 29, 2019
e3e4bdb
cards can be moved from board to board
adelowo Sep 30, 2019
812f256
fix migrations
adelowo Oct 1, 2019
6df65dd
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 1, 2019
9c66512
fix broken template from merge
adelowo Oct 1, 2019
c70b9a8
make sure only signed in users can make this api call
adelowo Oct 1, 2019
306ec7c
make sure only authorized users can move cards across boards
adelowo Oct 1, 2019
5c334d7
support moving back to the special uncategorized folder
adelowo Oct 1, 2019
c55d44e
allow project to be selected when creating an issue
adelowo Oct 1, 2019
9333ee0
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Oct 1, 2019
a1984a2
fix npm validation for functions
adelowo Oct 1, 2019
e123370
fix npm validation for functions
adelowo Oct 1, 2019
793a361
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Oct 2, 2019
93862b6
fix review
adelowo Oct 2, 2019
ee720f8
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Oct 3, 2019
77cbdaf
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 6, 2019
b109b46
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 13, 2019
a035bee
first step to making sure repos and individuals have project boards too
adelowo Oct 13, 2019
b734515
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 13, 2019
fbd9ba5
introduce repository projects
adelowo Oct 13, 2019
8df3693
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 13, 2019
cf5fb6e
fix form
adelowo Oct 13, 2019
0e9d983
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 14, 2019
47f1602
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 17, 2019
28874ac
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 18, 2019
3d7f94b
fix merge conflicts
adelowo Oct 18, 2019
c15c510
initial support for individual and organization projects
adelowo Oct 18, 2019
617ac26
allow search options for projects
adelowo Oct 18, 2019
20cfc64
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 19, 2019
6b8a0b1
fix search options for projects
adelowo Oct 19, 2019
0205fd7
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 20, 2019
ef92f40
fix open projects not showing up
adelowo Oct 21, 2019
aea6031
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 21, 2019
dbdc3bc
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 26, 2019
bbc4801
fix compilation
adelowo Oct 26, 2019
39e7dc0
fix compilation
adelowo Oct 26, 2019
96b9eeb
Fix css
adelowo Oct 27, 2019
301183c
Merge remote-tracking branch 'origin' into kanban_board
adelowo Oct 29, 2019
4221045
Merge remote-tracking branch 'origin' into kanban_board
adelowo Nov 7, 2019
8e81377
fix build
adelowo Nov 7, 2019
5f3cb04
fix build
adelowo Nov 7, 2019
5c50acf
fix projects link in profile view
adelowo Nov 7, 2019
a0452b8
Merge remote-tracking branch 'origin' into kanban_board
adelowo Nov 7, 2019
5da8734
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Nov 20, 2019
b46f262
Merge remote-tracking branch 'origin' into kanban_board
adelowo Nov 24, 2019
df41855
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Dec 14, 2019
bb31e4c
Merge remote-tracking branch 'origin' into kanban_board
adelowo Jan 11, 2020
11ddd03
Update templates/repo/issue/view_content/sidebar.tmpl
adelowo Jan 12, 2020
8186438
fix compilation
adelowo Jan 12, 2020
79aee02
Merge remote-tracking branch 'origin' into kanban_board
adelowo Jan 12, 2020
64430ed
fix review
adelowo Jan 12, 2020
338e8bb
Kanban board suggestions (#2)
6543 Feb 8, 2020
1b86d3d
fix dorpdown & comments (#3)
6543 Feb 8, 2020
34a1d9e
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Feb 8, 2020
4cd0b75
fix build
adelowo Feb 8, 2020
767a31e
Kanban fix2 (#4)
6543 Feb 9, 2020
2b6f4b6
update migration to add projects board unit
adelowo Feb 9, 2020
82ca8b9
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Feb 14, 2020
2be12b4
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Feb 15, 2020
e24f63b
Add sortablejs package
adelowo Feb 15, 2020
305fb3f
adapt js to new standard
adelowo Feb 16, 2020
ae99baf
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Feb 16, 2020
26695bb
update board title
adelowo Feb 16, 2020
6597f19
delete project board
adelowo Feb 16, 2020
1095eca
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Feb 16, 2020
39896f1
Merge remote-tracking branch 'origin' into kanban_board
adelowo Feb 22, 2020
f36c403
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Feb 22, 2020
885dd8f
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Feb 23, 2020
46e71fe
add a new project board via UI
adelowo Feb 23, 2020
6bbb5d3
fix lazy loading
adelowo Feb 23, 2020
6748e61
Update templates/base/head.tmpl
adelowo Feb 23, 2020
de40613
Update web_src/js/index.js
adelowo Feb 23, 2020
625206c
Update web_src/js/features/projects.js
adelowo Feb 23, 2020
4f3a02e
upodate eslint config
adelowo Feb 23, 2020
d28325f
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Feb 23, 2020
10db2ea
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Feb 23, 2020
e016c33
Merge branch 'master' into kanban_board
adelowo Mar 14, 2020
5b09686
add octicon to the projects board
adelowo Mar 15, 2020
c4690e0
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Mar 17, 2020
0940d11
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Mar 18, 2020
3b4a59a
pre merge
adelowo Apr 2, 2020
eb3a186
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Apr 12, 2020
f2eac41
fix build
adelowo Apr 12, 2020
9336664
fix bug where project gear button never shows in repo sidebar
adelowo Apr 12, 2020
d35fb3e
Make sure uncategorized board always have the projectID
adelowo Apr 13, 2020
4367f22
make sure project boards can be edited
adelowo Apr 13, 2020
7edfedc
close modal on success
adelowo Apr 13, 2020
63ea2af
reload on name change
adelowo Apr 13, 2020
41cebe6
format template properly
adelowo Apr 13, 2020
a87c8ca
delete projects
adelowo Apr 13, 2020
4ce64a1
Fix MergeConflict relicts and fronted Lint (#6)
6543 Apr 13, 2020
d7b1e8c
tiny updates
adelowo Apr 15, 2020
0d4d957
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Apr 17, 2020
93863ba
fix button translation
adelowo Apr 17, 2020
6e24ab1
add new board column to a project
adelowo Apr 17, 2020
7a04527
fix trash icon
adelowo Apr 17, 2020
e6f710a
fix merge conflict relicts
6543 Apr 17, 2020
31bc3a3
fix js lint issues
6543 Apr 17, 2020
bd2868d
remove inrelated code change
6543 Apr 17, 2020
b3ddc58
beautify
6543 Apr 17, 2020
d99c577
migrate octicons
6543 Apr 17, 2020
9b9cd05
Merge branch 'master' into kanban_board
6543 Apr 17, 2020
36c2d2d
remove <span class="badge">{{svg "octicon..."}}</span>
6543 Apr 17, 2020
3d6d0c7
Merge branch 'master' into kanban_board
6543 Apr 20, 2020
5fc69c2
fix Board Menue
6543 Apr 20, 2020
c68b70f
Merge branch master into kanban_board
6543 Apr 20, 2020
adb8405
rm deadcode (merge conflict relicts)
6543 Apr 20, 2020
4ee5212
fix some lint errors
6543 Apr 20, 2020
d3a3006
Merge branch 'master' into kanban_board
6543 Apr 20, 2020
eeee1d6
...
6543 Apr 20, 2020
2d37d70
Merge branch 'master' into kanban_board
6543 Apr 20, 2020
b024482
dont split add direct
6543 Apr 20, 2020
147dd90
remove merge conflict relicts
6543 Apr 20, 2020
c75e62f
code refactor
6543 Apr 20, 2020
55bd9e7
fix Issue Sidebar
6543 Apr 20, 2020
4fd1c22
FIX
6543 Apr 20, 2020
c4be71d
smal ui fix
6543 Apr 20, 2020
eedbd98
addopt new style
6543 Apr 21, 2020
248e030
addopt unit disable/enable ...
6543 Apr 21, 2020
4d6ca62
Update modules/setting/repository.go
6543 Apr 21, 2020
c5466c2
hide Project related Comments if Disabled
6543 Apr 21, 2020
db4d342
fix octicons
6543 Apr 21, 2020
755a178
code format
6543 Apr 21, 2020
26c96d2
reformat template
6543 Apr 21, 2020
2b4ac5c
fix only on issue on a board, refactor, move logic into models
6543 Apr 21, 2020
ea4bddf
remove template debug stuff
6543 Apr 21, 2020
b6df0dc
fix things after cleanup
6543 Apr 21, 2020
3c862f8
refactor & lints
6543 Apr 21, 2020
069983c
lint & refactor & fix
6543 Apr 21, 2020
d686a1d
name convention and split
6543 Apr 21, 2020
3068438
ChangeProjectStatus & ChangeMilestonStatus are similar but combining …
6543 Apr 21, 2020
2f660d0
typo fix & convince revive
6543 Apr 21, 2020
5822bc5
Merge branch 'master' into kanban_board
6543 Apr 21, 2020
31c2b9d
fix css
6543 Apr 21, 2020
2d5ae7b
fix lint
6543 Apr 21, 2020
3104c1b
format template
6543 Apr 21, 2020
9329913
make it look nicer and make it work
6543 Apr 21, 2020
95ebbb6
remove projects from profile page
adelowo Apr 21, 2020
c738c04
Draft ONE
6543 Apr 21, 2020
c84b888
Fix Find: Error 1066: Not unique table/alias: issue_project
6543 Apr 21, 2020
6134e77
handle edge casses
6543 Apr 21, 2020
e40d51d
GroupBy act wrong - rm
6543 Apr 21, 2020
7f9f277
remove db schema change relicts
6543 Apr 21, 2020
5a05ac8
Merge branch 'master' into kanban_board
6543 Apr 21, 2020
1319962
fix, imprufe, refactor
6543 Apr 21, 2020
3521fc6
impruve board card look
6543 Apr 22, 2020
b2fc19b
RENAME: IssueProject -> ProjectIssues
6543 Apr 22, 2020
9bac2d1
smal renames and imprufements
6543 Apr 22, 2020
8c992c8
canf find error but fix lint
6543 Apr 22, 2020
60efc5f
fix & extend migration
6543 Apr 22, 2020
d4f118b
Fix migration - creat tables outside a session
6543 Apr 22, 2020
8a20acd
fix js thanks @jaqra
6543 Apr 22, 2020
3e80ee1
import fromat ...
6543 Apr 22, 2020
ac1557a
Merge branch 'master' into kanban_board
6543 Apr 22, 2020
18113eb
fix milestone color
6543 Apr 22, 2020
2e086fa
Merge branch 'master' into kanban_board
6543 Apr 23, 2020
7b8c70e
Merge branch 'master' into kanban_board
6543 Apr 24, 2020
f2f2086
Merge branch 'master' into kanban_board
adelowo Apr 25, 2020
4a329be
Merge branch 'master' into kanban_board
adelowo Apr 26, 2020
ad0e040
Update web_src/js/features/projects.js
6543 Apr 26, 2020
1ed3636
Merge branch 'master' into kanban_board
6543 Apr 26, 2020
a228324
Add enable/disable project unit for repository and global unit check
metiftikci Apr 26, 2020
e10ba6b
Add enable/disable project unit for repository and global unit check
6543 Apr 26, 2020
589662e
Show/Hide Project section on issue view sidebar according to permission
metiftikci Apr 26, 2020
82f5740
Add modal confir for deleting a board
metiftikci Apr 26, 2020
6380431
use Upercase - looks nicer
6543 Apr 26, 2020
ad49c9e
Fix models/project_issues.go
6543 Apr 26, 2020
604119f
let project-unit enable/disable via API
6543 Apr 26, 2020
e69f38b
let Projects disabled on old Repos (migration)
6543 Apr 26, 2020
eeb0d4b
fix lint
6543 Apr 26, 2020
c44cf5b
Merge branch 'master' into kanban_board
6543 Apr 27, 2020
aceae47
Merge branch 'master' into kanban_board
adelowo Apr 27, 2020
311494d
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Apr 27, 2020
1b32f58
add tests for Projects
adelowo Apr 28, 2020
31db0fc
update copyright year
adelowo Apr 28, 2020
d745b5b
Merge branch 'master' of github.com:go-gitea/gitea into kanban_board
adelowo Apr 28, 2020
edb2602
remove debug printing
adelowo Apr 28, 2020
6c75e70
Merge branch 'master' into kanban_board
6543 Apr 28, 2020
8928a0d
dont use x.AllCols.Update
6543 Apr 28, 2020
6c4a933
update fixtures, add link checks
6543 Apr 29, 2020
f487f9b
correct fixtures & test
6543 Apr 29, 2020
5bbf647
fix
6543 Apr 29, 2020
b88499d
add files repo4
6543 Apr 29, 2020
e1effa1
Merge branch 'master' into kanban_board
6543 Apr 29, 2020
bd40920
this was no comment & translate
6543 Apr 29, 2020
36acce9
Apply suggestions from code review
6543 Apr 29, 2020
1981eb4
Merge branch 'master' into kanban_board
6543 Apr 29, 2020
4fb2106
Merge branch 'master' into kanban_board
6543 Apr 30, 2020
3a7181c
repoID can be NUL & is Inexed; Only RepoistoryType is valid
6543 May 1, 2020
0001370
Rename ProjectType Names & count functions take care of ProjectType
6543 May 1, 2020
5eba1c9
Merge branch 'master' into kanban_board
6543 May 1, 2020
e0eab4d
fix TEST
6543 May 1, 2020
15e39d0
change ProjectType names - follow convention
6543 May 1, 2020
8eed2bb
use only id and check access via repo on router functions
6543 May 1, 2020
1d06f8e
Merge branch 'master' into kanban_board
6543 May 1, 2020
d46ce37
fix tests
6543 May 1, 2020
87ed7fe
fix fixtures
6543 May 1, 2020
4a78ffc
dont forget the migrations
6543 May 1, 2020
d34c4ff
Update routers/repo/issue.go
6543 May 2, 2020
675f52f
Merge branch 'master' into kanban_board
6543 May 2, 2020
9fc9ffb
Merge branch 'master' into kanban_board
adelowo May 2, 2020
3d1570f
kanban: add a minimum height for droppable area of project boards (#9)
kevans91 May 3, 2020
61d7445
Merge branch 'master' into kanban_board
adelowo May 3, 2020
b95fb53
Merge branch 'master' into kanban_board
6543 May 4, 2020
b27c731
adds some css to cards and board-cards (see commit description for mo…
May 4, 2020
ee404ec
hide template field for project edit
6543 May 4, 2020
bda03a0
made the issue sidebar template consistent with the mew issue sidebar
DefinitelyADev May 4, 2020
b844276
Fixes error 500 when trying to create a User or na Organization project
DefinitelyADev May 4, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions custom/conf/app.ini.sample
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,16 @@ ENABLE_PUSH_CREATE_USER = false
ENABLE_PUSH_CREATE_ORG = false
; Comma separated list of globally disabled repo units. Allowed values: repo.issues, repo.ext_issues, repo.pulls, repo.wiki, repo.ext_wiki
DISABLED_REPO_UNITS =
; Comma separated list of default repo units. Allowed values: repo.code, repo.releases, repo.issues, repo.pulls, repo.wiki.
; Comma separated list of default repo units. Allowed values: repo.code, repo.releases, repo.issues, repo.pulls, repo.wiki, repo.projects.
; Note: Code and Releases can currently not be deactivated. If you specify default repo units you should still list them for future compatibility.
; External wiki and issue tracker can't be enabled by default as it requires additional settings.
; Disabled repo units will not be added to new repositories regardless if it is in the default list.
DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki
DEFAULT_REPO_UNITS = repo.code,repo.releases,repo.issues,repo.pulls,repo.wiki,repo.projects
; Prefix archive files by placing them in a directory named after the repository
PREFIX_ARCHIVE_FILES = true
; Default templates for project borards
PROJECT_BOARD_BASIC_KANBAN_TYPE = To Do, In Progress, Done
PROJECT_BOARD_BUG_TRIAGE_TYPE = Needs Triage, High priority, Low priority, Closed

[repository.editor]
; List of file extensions for which lines should be wrapped in the CodeMirror editor
Expand Down
1 change: 1 addition & 0 deletions integrations/gitea-repositories-meta/user5/repo4.git/HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ref: refs/heads/master
4 changes: 4 additions & 0 deletions integrations/gitea-repositories-meta/user5/repo4.git/config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[core]
repositoryformatversion = 0
filemode = true
bare = true
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Unnamed repository; edit this file 'description' to name the repository.
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#
# An example hook script to check the commit log message taken by
# applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit. The hook is
# allowed to edit the commit message file.
#
# To enable this hook, rename this file to "applypatch-msg".

. git-sh-setup
commitmsg="$(git rev-parse --git-path hooks/commit-msg)"
test -x "$commitmsg" && exec "$commitmsg" ${1+"$@"}
:
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh
#
# An example hook script to check the commit log message.
# Called by "git commit" with one argument, the name of the file
# that has the commit message. The hook should exit with non-zero
# status after issuing an appropriate message if it wants to stop the
# commit. The hook is allowed to edit the commit message file.
#
# To enable this hook, rename this file to "commit-msg".

# Uncomment the below to add a Signed-off-by line to the message.
# Doing this in a hook is a bad idea in general, but the prepare-commit-msg
# hook is more suited to it.
#
# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1"

# This example catches duplicate Signed-off-by lines.

test "" = "$(grep '^Signed-off-by: ' "$1" |
sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || {
echo >&2 Duplicate Signed-off-by lines.
exit 1
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,173 @@
#!/usr/bin/perl

use strict;
use warnings;
use IPC::Open2;

# An example hook script to integrate Watchman
# (https://facebook.github.io/watchman/) with git to speed up detecting
# new and modified files.
#
# The hook is passed a version (currently 2) and last update token
# formatted as a string and outputs to stdout a new update token and
# all files that have been modified since the update token. Paths must
# be relative to the root of the working tree and separated by a single NUL.
#
# To enable this hook, rename this file to "query-watchman" and set
# 'git config core.fsmonitor .git/hooks/query-watchman'
#
my ($version, $last_update_token) = @ARGV;

# Uncomment for debugging
# print STDERR "$0 $version $last_update_token\n";

# Check the hook interface version
if ($version ne 2) {
die "Unsupported query-fsmonitor hook version '$version'.\n" .
"Falling back to scanning...\n";
}

my $git_work_tree = get_working_dir();

my $retry = 1;

my $json_pkg;
eval {
require JSON::XS;
$json_pkg = "JSON::XS";
1;
} or do {
require JSON::PP;
$json_pkg = "JSON::PP";
};

launch_watchman();

sub launch_watchman {
my $o = watchman_query();
if (is_work_tree_watched($o)) {
output_result($o->{clock}, @{$o->{files}});
}
}

sub output_result {
my ($clockid, @files) = @_;

# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# binmode $fh, ":utf8";
# print $fh "$clockid\n@files\n";
# close $fh;

binmode STDOUT, ":utf8";
print $clockid;
print "\0";
local $, = "\0";
print @files;
}

sub watchman_clock {
my $response = qx/watchman clock "$git_work_tree"/;
die "Failed to get clock id on '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;

return $json_pkg->new->utf8->decode($response);
}

sub watchman_query {
my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty')
or die "open2() failed: $!\n" .
"Falling back to scanning...\n";

# In the query expression below we're asking for names of files that
# changed since $last_update_token but not from the .git folder.
#
# To accomplish this, we're using the "since" generator to use the
# recency index to select candidate nodes and "fields" to limit the
# output to file names only. Then we're using the "expression" term to
# further constrain the results.
if (substr($last_update_token, 0, 1) eq "c") {
$last_update_token = "\"$last_update_token\"";
}
my $query = <<" END";
["query", "$git_work_tree", {
"since": $last_update_token,
"fields": ["name"],
"expression": ["not", ["dirname", ".git"]]
}]
END

# Uncomment for debugging the watchman query
# open (my $fh, ">", ".git/watchman-query.json");
# print $fh $query;
# close $fh;

print CHLD_IN $query;
close CHLD_IN;
my $response = do {local $/; <CHLD_OUT>};

# Uncomment for debugging the watch response
# open ($fh, ">", ".git/watchman-response.json");
# print $fh $response;
# close $fh;

die "Watchman: command returned no output.\n" .
"Falling back to scanning...\n" if $response eq "";
die "Watchman: command returned invalid output: $response\n" .
"Falling back to scanning...\n" unless $response =~ /^\{/;

return $json_pkg->new->utf8->decode($response);
}

sub is_work_tree_watched {
my ($output) = @_;
my $error = $output->{error};
if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) {
$retry--;
my $response = qx/watchman watch "$git_work_tree"/;
die "Failed to make watchman watch '$git_work_tree'.\n" .
"Falling back to scanning...\n" if $? != 0;
$output = $json_pkg->new->utf8->decode($response);
$error = $output->{error};
die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;

# Uncomment for debugging watchman output
# open (my $fh, ">", ".git/watchman-output.out");
# close $fh;

# Watchman will always return all files on the first query so
# return the fast "everything is dirty" flag to git and do the
# Watchman query just to get it over with now so we won't pay
# the cost in git to look up each individual file.
my $o = watchman_clock();
$error = $output->{error};

die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;

output_result($o->{clock}, ("/"));
$last_update_token = $o->{clock};

eval { launch_watchman() };
return 0;
}

die "Watchman: $error.\n" .
"Falling back to scanning...\n" if $error;

return 1;
}

sub get_working_dir {
my $working_dir;
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
$working_dir = Win32::GetCwd();
$working_dir =~ tr/\\/\//;
} else {
require Cwd;
$working_dir = Cwd::cwd();
}

return $working_dir;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
#
# An example hook script to prepare a packed repository for use over
# dumb transports.
#
# To enable this hook, rename this file to "post-update".

exec git update-server-info
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed
# by applypatch from an e-mail message.
#
# The hook should exit with non-zero status after issuing an
# appropriate message if it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-applypatch".

. git-sh-setup
precommit="$(git rev-parse --git-path hooks/pre-commit)"
test -x "$precommit" && exec "$precommit" ${1+"$@"}
:
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".

if git rev-parse --verify HEAD >/dev/null 2>&1
then
against=HEAD
else
# Initial commit: diff against an empty tree object
against=$(git hash-object -t tree /dev/null)
fi

# If you want to allow non-ASCII filenames set this variable to true.
allownonascii=$(git config --type=bool hooks.allownonascii)

# Redirect output to stderr.
exec 1>&2

# Cross platform projects tend to avoid non-ASCII filenames; prevent
# them from being added to the repository. We exploit the fact that the
# printable range starts at the space character and ends with tilde.
if [ "$allownonascii" != "true" ] &&
# Note that the use of brackets around a tr range is ok here, (it's
# even required, for portability to Solaris 10's /usr/bin/tr), since
# the square bracket bytes happen to fall in the designated range.
test $(git diff --cached --name-only --diff-filter=A -z $against |
LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0
then
cat <<\EOF
Error: Attempt to add a non-ASCII file name.

This can cause problems if you want to work with people on other platforms.

To be portable it is advisable to rename the file.

If you know what you are doing you can disable this check using:

git config hooks.allownonascii true
EOF
exit 1
fi

# If there are whitespace errors, print the offending file names and fail.
exec git diff-index --check --cached $against --
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
#
# An example hook script to verify what is about to be committed.
# Called by "git merge" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message to
# stderr if it wants to stop the merge commit.
#
# To enable this hook, rename this file to "pre-merge-commit".

. git-sh-setup
test -x "$GIT_DIR/hooks/pre-commit" &&
exec "$GIT_DIR/hooks/pre-commit"
:
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/sh

# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local sha1> <remote ref> <remote sha1>
#
# This sample shows how to prevent push of commits where the log message starts
# with "WIP" (work in progress).

remote="$1"
url="$2"

z40=0000000000000000000000000000000000000000

while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
then
# Handle delete
:
else
if [ "$remote_sha" = $z40 ]
then
# New branch, examine all commits
range="$local_sha"
else
# Update to existing branch, examine new commits
range="$remote_sha..$local_sha"
fi

# Check for WIP commit
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
if [ -n "$commit" ]
then
echo >&2 "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done

exit 0
Loading