Compare commits
50 Commits
24b2b79a28
...
docs/readm
| Author | SHA1 | Date | |
|---|---|---|---|
| d12a1c0797 | |||
| 396c36f5a9 | |||
| d11695bcf8 | |||
| 0a7d11c6d4 | |||
| 7062581131 | |||
| c87a7417cc | |||
| ec27534656 | |||
| d9c649dfd3 | |||
| 8a5b866c8a | |||
| f60800c792 | |||
| 4df60e4992 | |||
| 12d006660d | |||
| cc8121153b | |||
| 5634254a6f | |||
| 75493e31cc | |||
| e9102fa097 | |||
| 23f8866dff | |||
| 64b9cb0e55 | |||
| accc75ce99 | |||
| 97e7fff4e3 | |||
| 6ffe4b9e55 | |||
| 5273628efb | |||
| 035412456a | |||
| 50eba65ef8 | |||
| e96224c08e | |||
| ab9398d435 | |||
| 85d1e16c0b | |||
| 7bd08705dd | |||
| 243ec8ecc0 | |||
| 47f110c1a4 | |||
| 2808949f26 | |||
| a17ecf9f57 | |||
| e6673fe76e | |||
| ef2f15f9d8 | |||
| f3c8c75edd | |||
| 528a0df7bb | |||
| 48eb38242d | |||
| ed8b59ca6f | |||
| 3c2bc4131a | |||
| 09b6e906ab | |||
| f67d923ee8 | |||
| 57aa364879 | |||
| f6179c8dd7 | |||
| 0a49d01d18 | |||
| 15e0697411 | |||
| 6b914ec916 | |||
| 49c160bf4f | |||
| ad07aec051 | |||
| 7251a2d53b | |||
| 924390287b |
@@ -1,62 +0,0 @@
|
|||||||
# This is a sample commands.py. You can add your own commands here.
|
|
||||||
#
|
|
||||||
# Please refer to commands_full.py for all the default commands and a complete
|
|
||||||
# documentation. Do NOT add them all here, or you may end up with defunct
|
|
||||||
# commands when upgrading ranger.
|
|
||||||
|
|
||||||
# A simple command for demonstration purposes follows.
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
|
|
||||||
# You can import any python module as needed.
|
|
||||||
import os
|
|
||||||
|
|
||||||
# You always need to import ranger.api.commands here to get the Command class:
|
|
||||||
from ranger.api.commands import Command
|
|
||||||
|
|
||||||
|
|
||||||
# Any class that is a subclass of "Command" will be integrated into ranger as a
|
|
||||||
# command. Try typing ":my_edit<ENTER>" in ranger!
|
|
||||||
class my_edit(Command):
|
|
||||||
# The so-called doc-string of the class will be visible in the built-in
|
|
||||||
# help that is accessible by typing "?c" inside ranger.
|
|
||||||
""":my_edit <filename>
|
|
||||||
|
|
||||||
A sample command for demonstration purposes that opens a file in an editor.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# The execute method is called when you run this command in ranger.
|
|
||||||
def execute(self):
|
|
||||||
# self.arg(1) is the first (space-separated) argument to the function.
|
|
||||||
# This way you can write ":my_edit somefilename<ENTER>".
|
|
||||||
if self.arg(1):
|
|
||||||
# self.rest(1) contains self.arg(1) and everything that follows
|
|
||||||
target_filename = self.rest(1)
|
|
||||||
else:
|
|
||||||
# self.fm is a ranger.core.filemanager.FileManager object and gives
|
|
||||||
# you access to internals of ranger.
|
|
||||||
# self.fm.thisfile is a ranger.container.file.File object and is a
|
|
||||||
# reference to the currently selected file.
|
|
||||||
target_filename = self.fm.thisfile.path
|
|
||||||
|
|
||||||
# This is a generic function to print text in ranger.
|
|
||||||
self.fm.notify("Let's edit the file " + target_filename + "!")
|
|
||||||
|
|
||||||
# Using bad=True in fm.notify allows you to print error messages:
|
|
||||||
if not os.path.exists(target_filename):
|
|
||||||
self.fm.notify("The given file does not exist!", bad=True)
|
|
||||||
return
|
|
||||||
|
|
||||||
# This executes a function from ranger.core.acitons, a module with a
|
|
||||||
# variety of subroutines that can help you construct commands.
|
|
||||||
# Check out the source, or run "pydoc ranger.core.actions" for a list.
|
|
||||||
self.fm.edit_file(target_filename)
|
|
||||||
|
|
||||||
# The tab method is called when you press tab, and should return a list of
|
|
||||||
# suggestions that the user will tab through.
|
|
||||||
# tabnum is 1 for <TAB> and -1 for <S-TAB> by default
|
|
||||||
def tab(self, tabnum):
|
|
||||||
# This is a generic tab-completion function that iterates through the
|
|
||||||
# content of the current directory.
|
|
||||||
return self._tab_directory_content()
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,659 +0,0 @@
|
|||||||
# ===================================================================
|
|
||||||
# This file contains the default startup commands for ranger.
|
|
||||||
# To change them, it is recommended to create the file
|
|
||||||
# ~/.config/ranger/rc.conf and add your custom commands there.
|
|
||||||
#
|
|
||||||
# If you copy this whole file there, you may want to set the environment
|
|
||||||
# variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice.
|
|
||||||
#
|
|
||||||
# The purpose of this file is mainly to define keybindings and settings.
|
|
||||||
# For running more complex python code, please create a plugin in "plugins/" or
|
|
||||||
# a command in "commands.py".
|
|
||||||
#
|
|
||||||
# Each line is a command that will be run before the user interface
|
|
||||||
# is initialized. As a result, you can not use commands which rely
|
|
||||||
# on the UI such as :delete or :mark.
|
|
||||||
# ===================================================================
|
|
||||||
|
|
||||||
# ===================================================================
|
|
||||||
# == Options
|
|
||||||
# ===================================================================
|
|
||||||
|
|
||||||
# Which viewmode should be used? Possible values are:
|
|
||||||
# miller: Use miller columns which show multiple levels of the hierarchy
|
|
||||||
# multipane: Midnight-commander like multipane view showing all tabs next
|
|
||||||
# to each other
|
|
||||||
set viewmode miller
|
|
||||||
#set viewmode multipane
|
|
||||||
|
|
||||||
# How many columns are there, and what are their relative widths?
|
|
||||||
set column_ratios 1,3,4
|
|
||||||
|
|
||||||
# Which files should be hidden? (regular expression)
|
|
||||||
set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$
|
|
||||||
|
|
||||||
# Show hidden files? You can toggle this by typing 'zh'
|
|
||||||
set show_hidden false
|
|
||||||
|
|
||||||
# Ask for a confirmation when running the "delete" command?
|
|
||||||
# Valid values are "always", "never", "multiple" (default)
|
|
||||||
# With "multiple", ranger will ask only if you delete multiple files at once.
|
|
||||||
set confirm_on_delete multiple
|
|
||||||
|
|
||||||
# Use non-default path for file preview script?
|
|
||||||
# ranger ships with scope.sh, a script that calls external programs (see
|
|
||||||
# README.md for dependencies) to preview images, archives, etc.
|
|
||||||
#set preview_script ~/.config/ranger/scope.sh
|
|
||||||
|
|
||||||
# Use the external preview script or display simple plain text or image previews?
|
|
||||||
set use_preview_script true
|
|
||||||
|
|
||||||
# Automatically count files in the directory, even before entering them?
|
|
||||||
set automatically_count_files true
|
|
||||||
|
|
||||||
# Open all images in this directory when running certain image viewers
|
|
||||||
# like feh or sxiv? You can still open selected files by marking them.
|
|
||||||
set open_all_images true
|
|
||||||
|
|
||||||
# Be aware of version control systems and display information.
|
|
||||||
set vcs_aware false
|
|
||||||
|
|
||||||
# State of the four backends git, hg, bzr, svn. The possible states are
|
|
||||||
# disabled, local (only show local info), enabled (show local and remote
|
|
||||||
# information).
|
|
||||||
set vcs_backend_git enabled
|
|
||||||
set vcs_backend_hg disabled
|
|
||||||
set vcs_backend_bzr disabled
|
|
||||||
set vcs_backend_svn disabled
|
|
||||||
|
|
||||||
# Use one of the supported image preview protocols
|
|
||||||
set preview_images false
|
|
||||||
|
|
||||||
# Set the preview image method. Supported methods:
|
|
||||||
#
|
|
||||||
# * w3m (default):
|
|
||||||
# Preview images in full color with the external command "w3mimgpreview"?
|
|
||||||
# This requires the console web browser "w3m" and a supported terminal.
|
|
||||||
# It has been successfully tested with "xterm" and "urxvt" without tmux.
|
|
||||||
#
|
|
||||||
# * iterm2:
|
|
||||||
# Preview images in full color using iTerm2 image previews
|
|
||||||
# (http://iterm2.com/images.html). This requires using iTerm2 compiled
|
|
||||||
# with image preview support.
|
|
||||||
#
|
|
||||||
# This feature relies on the dimensions of the terminal's font. By default, a
|
|
||||||
# width of 8 and height of 11 are used. To use other values, set the options
|
|
||||||
# iterm2_font_width and iterm2_font_height to the desired values.
|
|
||||||
#
|
|
||||||
# * urxvt:
|
|
||||||
# Preview images in full color using urxvt image backgrounds. This
|
|
||||||
# requires using urxvt compiled with pixbuf support.
|
|
||||||
#
|
|
||||||
# * urxvt-full:
|
|
||||||
# The same as urxvt but utilizing not only the preview pane but the
|
|
||||||
# whole terminal window.
|
|
||||||
set preview_images_method w3m
|
|
||||||
|
|
||||||
# Default iTerm2 font size (see: preview_images_method: iterm2)
|
|
||||||
set iterm2_font_width 8
|
|
||||||
set iterm2_font_height 11
|
|
||||||
|
|
||||||
# Use a unicode "..." character to mark cut-off filenames?
|
|
||||||
set unicode_ellipsis false
|
|
||||||
|
|
||||||
# Show dotfiles in the bookmark preview box?
|
|
||||||
set show_hidden_bookmarks true
|
|
||||||
|
|
||||||
# Which colorscheme to use? These colorschemes are available by default:
|
|
||||||
# default, jungle, snow, solarized
|
|
||||||
set colorscheme default
|
|
||||||
|
|
||||||
# Preview files on the rightmost column?
|
|
||||||
# And collapse (shrink) the last column if there is nothing to preview?
|
|
||||||
set preview_files true
|
|
||||||
set preview_directories true
|
|
||||||
set collapse_preview true
|
|
||||||
|
|
||||||
# Save the console history on exit?
|
|
||||||
set save_console_history true
|
|
||||||
|
|
||||||
# Draw the status bar on top of the browser window (default: bottom)
|
|
||||||
set status_bar_on_top false
|
|
||||||
|
|
||||||
# Draw a progress bar in the status bar which displays the average state of all
|
|
||||||
# currently running tasks which support progress bars?
|
|
||||||
set draw_progress_bar_in_status_bar true
|
|
||||||
|
|
||||||
# Draw borders around columns?
|
|
||||||
set draw_borders false
|
|
||||||
|
|
||||||
# Display the directory name in tabs?
|
|
||||||
set dirname_in_tabs false
|
|
||||||
|
|
||||||
# Enable the mouse support?
|
|
||||||
set mouse_enabled true
|
|
||||||
|
|
||||||
# Display the file size in the main column or status bar?
|
|
||||||
set display_size_in_main_column true
|
|
||||||
set display_size_in_status_bar true
|
|
||||||
|
|
||||||
# Display files tags in all columns or only in main column?
|
|
||||||
set display_tags_in_all_columns true
|
|
||||||
|
|
||||||
# Set a title for the window?
|
|
||||||
set update_title false
|
|
||||||
|
|
||||||
# Set the title to "ranger" in the tmux program?
|
|
||||||
set update_tmux_title false
|
|
||||||
|
|
||||||
# Shorten the title if it gets long? The number defines how many
|
|
||||||
# directories are displayed at once, 0 turns off this feature.
|
|
||||||
set shorten_title 3
|
|
||||||
|
|
||||||
# Show hostname in titlebar?
|
|
||||||
set hostname_in_titlebar true
|
|
||||||
|
|
||||||
# Abbreviate $HOME with ~ in the titlebar (first line) of ranger?
|
|
||||||
set tilde_in_titlebar false
|
|
||||||
|
|
||||||
# How many directory-changes or console-commands should be kept in history?
|
|
||||||
set max_history_size 20
|
|
||||||
set max_console_history_size 50
|
|
||||||
|
|
||||||
# Try to keep so much space between the top/bottom border when scrolling:
|
|
||||||
set scroll_offset 8
|
|
||||||
|
|
||||||
# Flush the input after each key hit? (Noticeable when ranger lags)
|
|
||||||
set flushinput true
|
|
||||||
|
|
||||||
# Padding on the right when there's no preview?
|
|
||||||
# This allows you to click into the space to run the file.
|
|
||||||
set padding_right true
|
|
||||||
|
|
||||||
# Save bookmarks (used with mX and `X) instantly?
|
|
||||||
# This helps to synchronize bookmarks between multiple ranger
|
|
||||||
# instances but leads to *slight* performance loss.
|
|
||||||
# When false, bookmarks are saved when ranger is exited.
|
|
||||||
set autosave_bookmarks true
|
|
||||||
|
|
||||||
# Save the "`" bookmark to disk. This can be used to switch to the last
|
|
||||||
# directory by typing "``".
|
|
||||||
set save_backtick_bookmark true
|
|
||||||
|
|
||||||
# You can display the "real" cumulative size of directories by using the
|
|
||||||
# command :get_cumulative_size or typing "dc". The size is expensive to
|
|
||||||
# calculate and will not be updated automatically. You can choose
|
|
||||||
# to update it automatically though by turning on this option:
|
|
||||||
set autoupdate_cumulative_size false
|
|
||||||
|
|
||||||
# Turning this on makes sense for screen readers:
|
|
||||||
set show_cursor false
|
|
||||||
|
|
||||||
# One of: size, natural, basename, atime, ctime, mtime, type, random
|
|
||||||
set sort natural
|
|
||||||
|
|
||||||
# Additional sorting options
|
|
||||||
set sort_reverse false
|
|
||||||
set sort_case_insensitive true
|
|
||||||
set sort_directories_first false
|
|
||||||
set sort_unicode false
|
|
||||||
|
|
||||||
# Enable this if key combinations with the Alt Key don't work for you.
|
|
||||||
# (Especially on xterm)
|
|
||||||
set xterm_alt_key false
|
|
||||||
|
|
||||||
# Whether to include bookmarks in cd command
|
|
||||||
set cd_bookmarks true
|
|
||||||
|
|
||||||
# Changes case sensitivity for the cd command tab completion
|
|
||||||
set cd_tab_case sensitive
|
|
||||||
|
|
||||||
# Use fuzzy tab completion with the "cd" command. For example,
|
|
||||||
# ":cd /u/lo/b<tab>" expands to ":cd /usr/local/bin".
|
|
||||||
set cd_tab_fuzzy false
|
|
||||||
|
|
||||||
# Avoid previewing files larger than this size, in bytes. Use a value of 0 to
|
|
||||||
# disable this feature.
|
|
||||||
set preview_max_size 0
|
|
||||||
|
|
||||||
# Add the highlighted file to the path in the titlebar
|
|
||||||
set show_selection_in_titlebar true
|
|
||||||
|
|
||||||
# The delay that ranger idly waits for user input, in milliseconds, with a
|
|
||||||
# resolution of 100ms. Lower delay reduces lag between directory updates but
|
|
||||||
# increases CPU load.
|
|
||||||
set idle_delay 2000
|
|
||||||
|
|
||||||
# When the metadata manager module looks for metadata, should it only look for
|
|
||||||
# a ".metadata.json" file in the current directory, or do a deep search and
|
|
||||||
# check all directories above the current one as well?
|
|
||||||
set metadata_deep_search false
|
|
||||||
|
|
||||||
# Clear all existing filters when leaving a directory
|
|
||||||
set clear_filters_on_dir_change false
|
|
||||||
|
|
||||||
# Disable displaying line numbers in main column
|
|
||||||
set line_numbers false
|
|
||||||
|
|
||||||
# Start line numbers from 1 instead of 0
|
|
||||||
set one_indexed false
|
|
||||||
|
|
||||||
# Save tabs on exit
|
|
||||||
set save_tabs_on_exit false
|
|
||||||
|
|
||||||
# Enable scroll wrapping - moving down while on the last item will wrap around to
|
|
||||||
# the top and vice versa.
|
|
||||||
set wrap_scroll false
|
|
||||||
|
|
||||||
# Set the global_inode_type_filter to nothing. Possible options: d, f and l for
|
|
||||||
# directories, files and symlinks respectively.
|
|
||||||
set global_inode_type_filter
|
|
||||||
|
|
||||||
# ===================================================================
|
|
||||||
# == Local Options
|
|
||||||
# ===================================================================
|
|
||||||
# You can set local options that only affect a single directory.
|
|
||||||
|
|
||||||
# Examples:
|
|
||||||
# setlocal path=~/downloads sort mtime
|
|
||||||
|
|
||||||
# ===================================================================
|
|
||||||
# == Command Aliases in the Console
|
|
||||||
# ===================================================================
|
|
||||||
|
|
||||||
alias e edit
|
|
||||||
alias q quit
|
|
||||||
alias q! quit!
|
|
||||||
alias qa quitall
|
|
||||||
alias qa! quitall!
|
|
||||||
alias qall quitall
|
|
||||||
alias qall! quitall!
|
|
||||||
alias setl setlocal
|
|
||||||
|
|
||||||
alias filter scout -prt
|
|
||||||
alias find scout -aeit
|
|
||||||
alias mark scout -mr
|
|
||||||
alias unmark scout -Mr
|
|
||||||
alias search scout -rs
|
|
||||||
alias search_inc scout -rts
|
|
||||||
alias travel scout -aefklst
|
|
||||||
|
|
||||||
# ===================================================================
|
|
||||||
# == Define keys for the browser
|
|
||||||
# ===================================================================
|
|
||||||
|
|
||||||
# Basic
|
|
||||||
map Q quitall
|
|
||||||
map q quit
|
|
||||||
copymap q ZZ ZQ
|
|
||||||
|
|
||||||
map R reload_cwd
|
|
||||||
map F set freeze_files!
|
|
||||||
map <C-r> reset
|
|
||||||
map <C-l> redraw_window
|
|
||||||
map <C-c> abort
|
|
||||||
map <esc> change_mode normal
|
|
||||||
map ~ set viewmode!
|
|
||||||
|
|
||||||
map i display_file
|
|
||||||
map ? help
|
|
||||||
map W display_log
|
|
||||||
map w taskview_open
|
|
||||||
map S shell $SHELL
|
|
||||||
|
|
||||||
map : console
|
|
||||||
map ; console
|
|
||||||
map ! console shell%space
|
|
||||||
map @ console -p9 shell -w %%s
|
|
||||||
map # console shell -p%space
|
|
||||||
map s console shell -w%space
|
|
||||||
map r chain draw_possible_programs; console open_with%%space
|
|
||||||
map f console find%space
|
|
||||||
map cd console cd%space
|
|
||||||
|
|
||||||
# Change the line mode
|
|
||||||
map Mf linemode filename
|
|
||||||
map Mi linemode fileinfo
|
|
||||||
map Mm linemode mtime
|
|
||||||
map Mp linemode permissions
|
|
||||||
map Ms linemode sizemtime
|
|
||||||
map Mt linemode metatitle
|
|
||||||
|
|
||||||
# Tagging / Marking
|
|
||||||
map t tag_toggle
|
|
||||||
map ut tag_remove
|
|
||||||
map "<any> tag_toggle tag=%any
|
|
||||||
#"
|
|
||||||
map <Space> mark_files toggle=True
|
|
||||||
map v mark_files all=True toggle=True
|
|
||||||
map uv mark_files all=True val=False
|
|
||||||
map V toggle_visual_mode
|
|
||||||
map uV toggle_visual_mode reverse=True
|
|
||||||
|
|
||||||
# For the nostalgics: Midnight Commander bindings
|
|
||||||
map <F1> help
|
|
||||||
map <F2> rename_append
|
|
||||||
map <F3> display_file
|
|
||||||
map <F4> edit
|
|
||||||
map <F5> copy
|
|
||||||
map <F6> cut
|
|
||||||
map <F7> console mkdir%space
|
|
||||||
map <F8> console delete
|
|
||||||
map <F10> exit
|
|
||||||
|
|
||||||
# In case you work on a keyboard with dvorak layout
|
|
||||||
map <UP> move up=1
|
|
||||||
map <DOWN> move down=1
|
|
||||||
map <LEFT> move left=1
|
|
||||||
map <RIGHT> move right=1
|
|
||||||
map <HOME> move to=0
|
|
||||||
map <END> move to=-1
|
|
||||||
map <PAGEDOWN> move down=1 pages=True
|
|
||||||
map <PAGEUP> move up=1 pages=True
|
|
||||||
map <CR> move right=1
|
|
||||||
#map <DELETE> console delete
|
|
||||||
map <INSERT> console touch%space
|
|
||||||
|
|
||||||
# VIM-like
|
|
||||||
copymap <UP> k
|
|
||||||
copymap <DOWN> j
|
|
||||||
copymap <LEFT> h
|
|
||||||
copymap <RIGHT> l
|
|
||||||
copymap <HOME> gg
|
|
||||||
copymap <END> G
|
|
||||||
copymap <PAGEDOWN> <C-F>
|
|
||||||
copymap <PAGEUP> <C-B>
|
|
||||||
|
|
||||||
map J move down=0.5 pages=True
|
|
||||||
map K move up=0.5 pages=True
|
|
||||||
copymap J <C-D>
|
|
||||||
copymap K <C-U>
|
|
||||||
|
|
||||||
# Jumping around
|
|
||||||
map H history_go -1
|
|
||||||
map L history_go 1
|
|
||||||
map ] move_parent 1
|
|
||||||
map [ move_parent -1
|
|
||||||
map } traverse
|
|
||||||
map ) jump_non
|
|
||||||
|
|
||||||
map gh cd ~
|
|
||||||
map ge cd /etc
|
|
||||||
map gu cd /usr
|
|
||||||
map gd cd /dev
|
|
||||||
map gl cd -r .
|
|
||||||
map gL cd -r %f
|
|
||||||
map go cd /opt
|
|
||||||
map gv cd /var
|
|
||||||
map gm cd /media
|
|
||||||
map gM cd /mnt
|
|
||||||
map gs cd /srv
|
|
||||||
map gp cd /tmp
|
|
||||||
map gr cd /
|
|
||||||
map gR eval fm.cd(ranger.RANGERDIR)
|
|
||||||
map g/ cd /
|
|
||||||
map g? cd /usr/share/doc/ranger
|
|
||||||
|
|
||||||
# External Programs
|
|
||||||
map E edit
|
|
||||||
map du shell -p du --max-depth=1 -h --apparent-size
|
|
||||||
map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh
|
|
||||||
map yp yank path
|
|
||||||
map yd yank dir
|
|
||||||
map yn yank name
|
|
||||||
|
|
||||||
# Filesystem Operations
|
|
||||||
map = chmod
|
|
||||||
|
|
||||||
map cw console rename%space
|
|
||||||
map a rename_append
|
|
||||||
map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"))
|
|
||||||
map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7)
|
|
||||||
|
|
||||||
map pp paste
|
|
||||||
map po paste overwrite=True
|
|
||||||
map pP paste append=True
|
|
||||||
map pO paste overwrite=True append=True
|
|
||||||
map pl paste_symlink relative=False
|
|
||||||
map pL paste_symlink relative=True
|
|
||||||
map phl paste_hardlink
|
|
||||||
map pht paste_hardlinked_subtree
|
|
||||||
|
|
||||||
map dD console delete
|
|
||||||
|
|
||||||
map dd cut
|
|
||||||
map ud uncut
|
|
||||||
map da cut mode=add
|
|
||||||
map dr cut mode=remove
|
|
||||||
map dt cut mode=toggle
|
|
||||||
|
|
||||||
map yy copy
|
|
||||||
map uy uncut
|
|
||||||
map ya copy mode=add
|
|
||||||
map yr copy mode=remove
|
|
||||||
map yt copy mode=toggle
|
|
||||||
|
|
||||||
# Temporary workarounds
|
|
||||||
map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier)
|
|
||||||
map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier)
|
|
||||||
map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier)
|
|
||||||
map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier)
|
|
||||||
map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier)
|
|
||||||
map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier)
|
|
||||||
map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier)
|
|
||||||
map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier)
|
|
||||||
|
|
||||||
# Searching
|
|
||||||
map / console search%space
|
|
||||||
map n search_next
|
|
||||||
map N search_next forward=False
|
|
||||||
map ct search_next order=tag
|
|
||||||
map cs search_next order=size
|
|
||||||
map ci search_next order=mimetype
|
|
||||||
map cc search_next order=ctime
|
|
||||||
map cm search_next order=mtime
|
|
||||||
map ca search_next order=atime
|
|
||||||
|
|
||||||
# Tabs
|
|
||||||
map <C-n> tab_new
|
|
||||||
map <C-w> tab_close
|
|
||||||
map <TAB> tab_move 1
|
|
||||||
map <S-TAB> tab_move -1
|
|
||||||
map <A-Right> tab_move 1
|
|
||||||
map <A-Left> tab_move -1
|
|
||||||
map gt tab_move 1
|
|
||||||
map gT tab_move -1
|
|
||||||
map gn tab_new
|
|
||||||
map gc tab_close
|
|
||||||
map uq tab_restore
|
|
||||||
map <a-1> tab_open 1
|
|
||||||
map <a-2> tab_open 2
|
|
||||||
map <a-3> tab_open 3
|
|
||||||
map <a-4> tab_open 4
|
|
||||||
map <a-5> tab_open 5
|
|
||||||
map <a-6> tab_open 6
|
|
||||||
map <a-7> tab_open 7
|
|
||||||
map <a-8> tab_open 8
|
|
||||||
map <a-9> tab_open 9
|
|
||||||
|
|
||||||
# Sorting
|
|
||||||
map or set sort_reverse!
|
|
||||||
map oz set sort=random
|
|
||||||
map os chain set sort=size; set sort_reverse=False
|
|
||||||
map ob chain set sort=basename; set sort_reverse=False
|
|
||||||
map on chain set sort=natural; set sort_reverse=False
|
|
||||||
map om chain set sort=mtime; set sort_reverse=False
|
|
||||||
map oc chain set sort=ctime; set sort_reverse=False
|
|
||||||
map oa chain set sort=atime; set sort_reverse=False
|
|
||||||
map ot chain set sort=type; set sort_reverse=False
|
|
||||||
map oe chain set sort=extension; set sort_reverse=False
|
|
||||||
|
|
||||||
map oS chain set sort=size; set sort_reverse=True
|
|
||||||
map oB chain set sort=basename; set sort_reverse=True
|
|
||||||
map oN chain set sort=natural; set sort_reverse=True
|
|
||||||
map oM chain set sort=mtime; set sort_reverse=True
|
|
||||||
map oC chain set sort=ctime; set sort_reverse=True
|
|
||||||
map oA chain set sort=atime; set sort_reverse=True
|
|
||||||
map oT chain set sort=type; set sort_reverse=True
|
|
||||||
map oE chain set sort=extension; set sort_reverse=True
|
|
||||||
|
|
||||||
map dc get_cumulative_size
|
|
||||||
|
|
||||||
# Settings
|
|
||||||
map zc set collapse_preview!
|
|
||||||
map zd set sort_directories_first!
|
|
||||||
map zh set show_hidden!
|
|
||||||
map <C-h> set show_hidden!
|
|
||||||
map zI set flushinput!
|
|
||||||
map zi set preview_images!
|
|
||||||
map zm set mouse_enabled!
|
|
||||||
map zp set preview_files!
|
|
||||||
map zP set preview_directories!
|
|
||||||
map zs set sort_case_insensitive!
|
|
||||||
map zu set autoupdate_cumulative_size!
|
|
||||||
map zv set use_preview_script!
|
|
||||||
map zf console filter%space
|
|
||||||
copymap zf zz
|
|
||||||
|
|
||||||
# Bookmarks
|
|
||||||
map `<any> enter_bookmark %any
|
|
||||||
map '<any> enter_bookmark %any
|
|
||||||
#'
|
|
||||||
map m<any> set_bookmark %any
|
|
||||||
map um<any> unset_bookmark %any
|
|
||||||
|
|
||||||
map m<bg> draw_bookmarks
|
|
||||||
copymap m<bg> um<bg> `<bg> '<bg>
|
|
||||||
#'
|
|
||||||
|
|
||||||
# Generate all the chmod bindings with some python help:
|
|
||||||
eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg))
|
|
||||||
eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg))
|
|
||||||
eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg))
|
|
||||||
eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg))
|
|
||||||
eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg))
|
|
||||||
|
|
||||||
eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg))
|
|
||||||
eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg))
|
|
||||||
eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg))
|
|
||||||
eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg))
|
|
||||||
eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg))
|
|
||||||
|
|
||||||
# ===================================================================
|
|
||||||
# == Define keys for the console
|
|
||||||
# ===================================================================
|
|
||||||
# Note: Unmapped keys are passed directly to the console.
|
|
||||||
|
|
||||||
# Basic
|
|
||||||
cmap <tab> eval fm.ui.console.tab()
|
|
||||||
cmap <s-tab> eval fm.ui.console.tab(-1)
|
|
||||||
cmap <ESC> eval fm.ui.console.close()
|
|
||||||
cmap <CR> eval fm.ui.console.execute()
|
|
||||||
cmap <C-l> redraw_window
|
|
||||||
|
|
||||||
copycmap <ESC> <C-c>
|
|
||||||
copycmap <CR> <C-j>
|
|
||||||
|
|
||||||
# Move around
|
|
||||||
cmap <up> eval fm.ui.console.history_move(-1)
|
|
||||||
cmap <down> eval fm.ui.console.history_move(1)
|
|
||||||
cmap <left> eval fm.ui.console.move(left=1)
|
|
||||||
cmap <right> eval fm.ui.console.move(right=1)
|
|
||||||
cmap <home> eval fm.ui.console.move(right=0, absolute=True)
|
|
||||||
cmap <end> eval fm.ui.console.move(right=-1, absolute=True)
|
|
||||||
cmap <a-left> eval fm.ui.console.move_word(left=1)
|
|
||||||
cmap <a-right> eval fm.ui.console.move_word(right=1)
|
|
||||||
|
|
||||||
# Line Editing
|
|
||||||
cmap <backspace> eval fm.ui.console.delete(-1)
|
|
||||||
cmap <delete> eval fm.ui.console.delete(0)
|
|
||||||
cmap <C-w> eval fm.ui.console.delete_word()
|
|
||||||
cmap <A-d> eval fm.ui.console.delete_word(backward=False)
|
|
||||||
cmap <C-k> eval fm.ui.console.delete_rest(1)
|
|
||||||
cmap <C-u> eval fm.ui.console.delete_rest(-1)
|
|
||||||
cmap <C-y> eval fm.ui.console.paste()
|
|
||||||
|
|
||||||
# And of course the emacs way
|
|
||||||
copycmap <up> <C-p>
|
|
||||||
copycmap <down> <C-n>
|
|
||||||
copycmap <left> <C-b>
|
|
||||||
copycmap <right> <C-f>
|
|
||||||
copycmap <home> <C-a>
|
|
||||||
copycmap <end> <C-e>
|
|
||||||
copycmap <delete> <C-d>
|
|
||||||
copycmap <backspace> <C-h>
|
|
||||||
|
|
||||||
# Note: There are multiple ways to express backspaces. <backspace> (code 263)
|
|
||||||
# and <backspace2> (code 127). To be sure, use both.
|
|
||||||
copycmap <backspace> <backspace2>
|
|
||||||
|
|
||||||
# This special expression allows typing in numerals:
|
|
||||||
cmap <allow_quantifiers> false
|
|
||||||
|
|
||||||
# ===================================================================
|
|
||||||
# == Pager Keybindings
|
|
||||||
# ===================================================================
|
|
||||||
|
|
||||||
# Movement
|
|
||||||
pmap <down> pager_move down=1
|
|
||||||
pmap <up> pager_move up=1
|
|
||||||
pmap <left> pager_move left=4
|
|
||||||
pmap <right> pager_move right=4
|
|
||||||
pmap <home> pager_move to=0
|
|
||||||
pmap <end> pager_move to=-1
|
|
||||||
pmap <pagedown> pager_move down=1.0 pages=True
|
|
||||||
pmap <pageup> pager_move up=1.0 pages=True
|
|
||||||
pmap <C-d> pager_move down=0.5 pages=True
|
|
||||||
pmap <C-u> pager_move up=0.5 pages=True
|
|
||||||
|
|
||||||
copypmap <UP> k <C-p>
|
|
||||||
copypmap <DOWN> j <C-n> <CR>
|
|
||||||
copypmap <LEFT> h
|
|
||||||
copypmap <RIGHT> l
|
|
||||||
copypmap <HOME> g
|
|
||||||
copypmap <END> G
|
|
||||||
copypmap <C-d> d
|
|
||||||
copypmap <C-u> u
|
|
||||||
copypmap <PAGEDOWN> n f <C-F> <Space>
|
|
||||||
copypmap <PAGEUP> p b <C-B>
|
|
||||||
|
|
||||||
# Basic
|
|
||||||
pmap <C-l> redraw_window
|
|
||||||
pmap <ESC> pager_close
|
|
||||||
copypmap <ESC> q Q i <F3>
|
|
||||||
pmap E edit_file
|
|
||||||
|
|
||||||
# ===================================================================
|
|
||||||
# == Taskview Keybindings
|
|
||||||
# ===================================================================
|
|
||||||
|
|
||||||
# Movement
|
|
||||||
tmap <up> taskview_move up=1
|
|
||||||
tmap <down> taskview_move down=1
|
|
||||||
tmap <home> taskview_move to=0
|
|
||||||
tmap <end> taskview_move to=-1
|
|
||||||
tmap <pagedown> taskview_move down=1.0 pages=True
|
|
||||||
tmap <pageup> taskview_move up=1.0 pages=True
|
|
||||||
tmap <C-d> taskview_move down=0.5 pages=True
|
|
||||||
tmap <C-u> taskview_move up=0.5 pages=True
|
|
||||||
|
|
||||||
copytmap <UP> k <C-p>
|
|
||||||
copytmap <DOWN> j <C-n> <CR>
|
|
||||||
copytmap <HOME> g
|
|
||||||
copytmap <END> G
|
|
||||||
copytmap <C-u> u
|
|
||||||
copytmap <PAGEDOWN> n f <C-F> <Space>
|
|
||||||
copytmap <PAGEUP> p b <C-B>
|
|
||||||
|
|
||||||
# Changing priority and deleting tasks
|
|
||||||
tmap J eval -q fm.ui.taskview.task_move(-1)
|
|
||||||
tmap K eval -q fm.ui.taskview.task_move(0)
|
|
||||||
tmap dd eval -q fm.ui.taskview.task_remove()
|
|
||||||
tmap <pagedown> eval -q fm.ui.taskview.task_move(-1)
|
|
||||||
tmap <pageup> eval -q fm.ui.taskview.task_move(0)
|
|
||||||
tmap <delete> eval -q fm.ui.taskview.task_remove()
|
|
||||||
|
|
||||||
# Basic
|
|
||||||
tmap <C-l> redraw_window
|
|
||||||
tmap <ESC> taskview_close
|
|
||||||
copytmap <ESC> q Q w <C-c>
|
|
||||||
@@ -1,226 +0,0 @@
|
|||||||
# vim: ft=cfg
|
|
||||||
#
|
|
||||||
# This is the configuration file of "rifle", ranger's file executor/opener.
|
|
||||||
# Each line consists of conditions and a command. For each line the conditions
|
|
||||||
# are checked and if they are met, the respective command is run.
|
|
||||||
#
|
|
||||||
# Syntax:
|
|
||||||
# <condition1> , <condition2> , ... = command
|
|
||||||
#
|
|
||||||
# The command can contain these environment variables:
|
|
||||||
# $1-$9 | The n-th selected file
|
|
||||||
# $@ | All selected files
|
|
||||||
#
|
|
||||||
# If you use the special command "ask", rifle will ask you what program to run.
|
|
||||||
#
|
|
||||||
# Prefixing a condition with "!" will negate its result.
|
|
||||||
# These conditions are currently supported:
|
|
||||||
# match <regexp> | The regexp matches $1
|
|
||||||
# ext <regexp> | The regexp matches the extension of $1
|
|
||||||
# mime <regexp> | The regexp matches the mime type of $1
|
|
||||||
# name <regexp> | The regexp matches the basename of $1
|
|
||||||
# path <regexp> | The regexp matches the absolute path of $1
|
|
||||||
# has <program> | The program is installed (i.e. located in $PATH)
|
|
||||||
# env <variable> | The environment variable "variable" is non-empty
|
|
||||||
# file | $1 is a file
|
|
||||||
# directory | $1 is a directory
|
|
||||||
# number <n> | change the number of this command to n
|
|
||||||
# terminal | stdin, stderr and stdout are connected to a terminal
|
|
||||||
# X | $DISPLAY is not empty (i.e. Xorg runs)
|
|
||||||
#
|
|
||||||
# There are also pseudo-conditions which have a "side effect":
|
|
||||||
# flag <flags> | Change how the program is run. See below.
|
|
||||||
# label <label> | Assign a label or name to the command so it can
|
|
||||||
# | be started with :open_with <label> in ranger
|
|
||||||
# | or `rifle -p <label>` in the standalone executable.
|
|
||||||
# else | Always true.
|
|
||||||
#
|
|
||||||
# Flags are single characters which slightly transform the command:
|
|
||||||
# f | Fork the program, make it run in the background.
|
|
||||||
# | New command = setsid $command >& /dev/null &
|
|
||||||
# r | Execute the command with root permissions
|
|
||||||
# | New command = sudo $command
|
|
||||||
# t | Run the program in a new terminal. If $TERMCMD is not defined,
|
|
||||||
# | rifle will attempt to extract it from $TERM.
|
|
||||||
# | New command = $TERMCMD -e $command
|
|
||||||
# Note: The "New command" serves only as an illustration, the exact
|
|
||||||
# implementation may differ.
|
|
||||||
# Note: When using rifle in ranger, there is an additional flag "c" for
|
|
||||||
# only running the current file even if you have marked multiple files.
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Websites
|
|
||||||
#-------------------------------------------
|
|
||||||
# Rarely installed browsers get higher priority; It is assumed that if you
|
|
||||||
# install a rare browser, you probably use it. Firefox/konqueror/w3m on the
|
|
||||||
# other hand are often only installed as fallback browsers.
|
|
||||||
ext x?html?, has surf, X, flag f = surf -- file://"$1"
|
|
||||||
ext x?html?, has vimprobable, X, flag f = vimprobable -- "$@"
|
|
||||||
ext x?html?, has vimprobable2, X, flag f = vimprobable2 -- "$@"
|
|
||||||
ext x?html?, has qutebrowser, X, flag f = qutebrowser -- "$@"
|
|
||||||
ext x?html?, has dwb, X, flag f = dwb -- "$@"
|
|
||||||
ext x?html?, has jumanji, X, flag f = jumanji -- "$@"
|
|
||||||
ext x?html?, has luakit, X, flag f = luakit -- "$@"
|
|
||||||
ext x?html?, has uzbl, X, flag f = uzbl -- "$@"
|
|
||||||
ext x?html?, has uzbl-tabbed, X, flag f = uzbl-tabbed -- "$@"
|
|
||||||
ext x?html?, has uzbl-browser, X, flag f = uzbl-browser -- "$@"
|
|
||||||
ext x?html?, has uzbl-core, X, flag f = uzbl-core -- "$@"
|
|
||||||
ext x?html?, has midori, X, flag f = midori -- "$@"
|
|
||||||
ext x?html?, has chromium-browser, X, flag f = chromium-browser -- "$@"
|
|
||||||
ext x?html?, has chromium, X, flag f = chromium -- "$@"
|
|
||||||
ext x?html?, has google-chrome, X, flag f = google-chrome -- "$@"
|
|
||||||
ext x?html?, has opera, X, flag f = opera -- "$@"
|
|
||||||
ext x?html?, has firefox, X, flag f = firefox -- "$@"
|
|
||||||
ext x?html?, has seamonkey, X, flag f = seamonkey -- "$@"
|
|
||||||
ext x?html?, has iceweasel, X, flag f = iceweasel -- "$@"
|
|
||||||
ext x?html?, has epiphany, X, flag f = epiphany -- "$@"
|
|
||||||
ext x?html?, has konqueror, X, flag f = konqueror -- "$@"
|
|
||||||
ext x?html?, has elinks, terminal = elinks "$@"
|
|
||||||
ext x?html?, has links2, terminal = links2 "$@"
|
|
||||||
ext x?html?, has links, terminal = links "$@"
|
|
||||||
ext x?html?, has lynx, terminal = lynx -- "$@"
|
|
||||||
ext x?html?, has w3m, terminal = w3m "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Misc
|
|
||||||
#-------------------------------------------
|
|
||||||
# Define the "editor" for text files as first action
|
|
||||||
mime ^text, label editor = ${VISUAL:-$EDITOR} -- "$@"
|
|
||||||
mime ^text, label pager = "$PAGER" -- "$@"
|
|
||||||
!mime ^text, label editor, ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
|
|
||||||
!mime ^text, label pager, ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
|
||||||
|
|
||||||
ext 1 = man "$1"
|
|
||||||
ext s[wmf]c, has zsnes, X = zsnes "$1"
|
|
||||||
ext s[wmf]c, has snes9x-gtk,X = snes9x-gtk "$1"
|
|
||||||
ext nes, has fceux, X = fceux "$1"
|
|
||||||
ext exe = wine "$1"
|
|
||||||
name ^[mM]akefile$ = make
|
|
||||||
|
|
||||||
#--------------------------------------------
|
|
||||||
# Code
|
|
||||||
#-------------------------------------------
|
|
||||||
ext py = python -- "$1"
|
|
||||||
ext pl = perl -- "$1"
|
|
||||||
ext rb = ruby -- "$1"
|
|
||||||
ext js = node -- "$1"
|
|
||||||
ext sh = sh -- "$1"
|
|
||||||
ext php = php -- "$1"
|
|
||||||
|
|
||||||
#--------------------------------------------
|
|
||||||
# Audio without X
|
|
||||||
#-------------------------------------------
|
|
||||||
mime ^audio|ogg$, terminal, has mpv = mpv -- "$@"
|
|
||||||
mime ^audio|ogg$, terminal, has mplayer2 = mplayer2 -- "$@"
|
|
||||||
mime ^audio|ogg$, terminal, has mplayer = mplayer -- "$@"
|
|
||||||
ext midi?, terminal, has wildmidi = wildmidi -- "$@"
|
|
||||||
|
|
||||||
#--------------------------------------------
|
|
||||||
# Video/Audio with a GUI
|
|
||||||
#-------------------------------------------
|
|
||||||
mime ^video|audio, has gmplayer, X, flag f = gmplayer -- "$@"
|
|
||||||
mime ^video|audio, has smplayer, X, flag f = smplayer "$@"
|
|
||||||
mime ^video, has mpv, X, flag f = mpv -- "$@"
|
|
||||||
mime ^video, has mpv, X, flag f = mpv --fs -- "$@"
|
|
||||||
mime ^video, has mplayer2, X, flag f = mplayer2 -- "$@"
|
|
||||||
mime ^video, has mplayer2, X, flag f = mplayer2 -fs -- "$@"
|
|
||||||
mime ^video, has mplayer, X, flag f = mplayer -- "$@"
|
|
||||||
mime ^video, has mplayer, X, flag f = mplayer -fs -- "$@"
|
|
||||||
mime ^video|audio, has vlc, X, flag f = vlc -- "$@"
|
|
||||||
mime ^video|audio, has totem, X, flag f = totem -- "$@"
|
|
||||||
mime ^video|audio, has totem, X, flag f = totem --fullscreen -- "$@"
|
|
||||||
|
|
||||||
#--------------------------------------------
|
|
||||||
# Video without X:
|
|
||||||
#-------------------------------------------
|
|
||||||
mime ^video, terminal, !X, has mpv = mpv -- "$@"
|
|
||||||
mime ^video, terminal, !X, has mplayer2 = mplayer2 -- "$@"
|
|
||||||
mime ^video, terminal, !X, has mplayer = mplayer -- "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Documents
|
|
||||||
#-------------------------------------------
|
|
||||||
ext pdf, has llpp, X, flag f = llpp "$@"
|
|
||||||
ext pdf, has zathura, X, flag f = zathura -- "$@"
|
|
||||||
ext pdf, has mupdf, X, flag f = mupdf "$@"
|
|
||||||
ext pdf, has mupdf-x11,X, flag f = mupdf-x11 "$@"
|
|
||||||
ext pdf, has apvlv, X, flag f = apvlv -- "$@"
|
|
||||||
ext pdf, has xpdf, X, flag f = xpdf -- "$@"
|
|
||||||
ext pdf, has evince, X, flag f = evince -- "$@"
|
|
||||||
ext pdf, has atril, X, flag f = atril -- "$@"
|
|
||||||
ext pdf, has okular, X, flag f = okular -- "$@"
|
|
||||||
ext pdf, has epdfview, X, flag f = epdfview -- "$@"
|
|
||||||
ext pdf, has qpdfview, X, flag f = qpdfview "$@"
|
|
||||||
ext pdf, has open, X, flat f = open "$@"
|
|
||||||
|
|
||||||
ext docx?, has catdoc, terminal = catdoc -- "$@" | "$PAGER"
|
|
||||||
|
|
||||||
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has gnumeric, X, flag f = gnumeric -- "$@"
|
|
||||||
ext sxc|xlsx?|xlt|xlw|gnm|gnumeric, has kspread, X, flag f = kspread -- "$@"
|
|
||||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has libreoffice, X, flag f = libreoffice "$@"
|
|
||||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has soffice, X, flag f = soffice "$@"
|
|
||||||
ext pptx?|od[dfgpst]|docx?|sxc|xlsx?|xlt|xlw|gnm|gnumeric, has ooffice, X, flag f = ooffice "$@"
|
|
||||||
|
|
||||||
ext djvu, has zathura,X, flag f = zathura -- "$@"
|
|
||||||
ext djvu, has evince, X, flag f = evince -- "$@"
|
|
||||||
ext djvu, has atril, X, flag f = atril -- "$@"
|
|
||||||
|
|
||||||
ext epub, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
|
|
||||||
ext mobi, has ebook-viewer, X, flag f = ebook-viewer -- "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Image Viewing:
|
|
||||||
#-------------------------------------------
|
|
||||||
mime ^image/svg, has inkscape, X, flag f = inkscape -- "$@"
|
|
||||||
mime ^image/svg, has display, X, flag f = display -- "$@"
|
|
||||||
|
|
||||||
mime ^image, has pqiv, X, flag f = pqiv -- "$@"
|
|
||||||
mime ^image, has sxiv, X, flag f = sxiv -- "$@"
|
|
||||||
mime ^image, has feh, X, flag f = feh -- "$@"
|
|
||||||
mime ^image, has mirage, X, flag f = mirage -- "$@"
|
|
||||||
mime ^image, has ristretto, X, flag f = ristretto "$@"
|
|
||||||
mime ^image, has eog, X, flag f = eog -- "$@"
|
|
||||||
mime ^image, has eom, X, flag f = eom -- "$@"
|
|
||||||
mime ^image, has nomacs, X, flag f = nomacs -- "$@"
|
|
||||||
mime ^image, has geeqie, X, flag f = geeqie -- "$@"
|
|
||||||
mime ^image, has gimp, X, flag f = gimp -- "$@"
|
|
||||||
ext xcf, X, flag f = gimp -- "$@"
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Archives
|
|
||||||
#-------------------------------------------
|
|
||||||
|
|
||||||
# avoid password prompt by providing empty password
|
|
||||||
ext 7z, has 7z = 7z -p l "$@" | "$PAGER"
|
|
||||||
# This requires atool
|
|
||||||
ext ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --list --each -- "$@" | "$PAGER"
|
|
||||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --list --each -- "$@" | "$PAGER"
|
|
||||||
ext 7z|ace|ar|arc|bz2?|cab|cpio|cpt|deb|dgc|dmg|gz, has atool = atool --extract --each -- "$@"
|
|
||||||
ext iso|jar|msi|pkg|rar|shar|tar|tgz|xar|xpi|xz|zip, has atool = atool --extract --each -- "$@"
|
|
||||||
|
|
||||||
# Listing and extracting archives without atool:
|
|
||||||
ext tar|gz|bz2|xz, has tar = tar vvtf "$1" | "$PAGER"
|
|
||||||
ext tar|gz|bz2|xz, has tar = for file in "$@"; do tar vvxf "$file"; done
|
|
||||||
ext bz2, has bzip2 = for file in "$@"; do bzip2 -dk "$file"; done
|
|
||||||
ext zip, has unzip = unzip -l "$1" | less
|
|
||||||
ext zip, has unzip = for file in "$@"; do unzip -d "${file%.*}" "$file"; done
|
|
||||||
ext ace, has unace = unace l "$1" | less
|
|
||||||
ext ace, has unace = for file in "$@"; do unace e "$file"; done
|
|
||||||
ext rar, has unrar = unrar l "$1" | less
|
|
||||||
ext rar, has unrar = for file in "$@"; do unrar x "$file"; done
|
|
||||||
|
|
||||||
#-------------------------------------------
|
|
||||||
# Misc
|
|
||||||
#-------------------------------------------
|
|
||||||
label wallpaper, number 11, mime ^image, has feh, X = feh --bg-scale "$1"
|
|
||||||
label wallpaper, number 12, mime ^image, has feh, X = feh --bg-tile "$1"
|
|
||||||
label wallpaper, number 13, mime ^image, has feh, X = feh --bg-center "$1"
|
|
||||||
label wallpaper, number 14, mime ^image, has feh, X = feh --bg-fill "$1"
|
|
||||||
|
|
||||||
# Define the editor for non-text files + pager as last action
|
|
||||||
!mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ask
|
|
||||||
label editor, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = ${VISUAL:-$EDITOR} -- "$@"
|
|
||||||
label pager, !mime ^text, !ext xml|json|csv|tex|py|pl|rb|js|sh|php = "$PAGER" -- "$@"
|
|
||||||
|
|
||||||
# The very last action, so that it's never triggered accidentally, is to execute a program:
|
|
||||||
mime application/x-executable = "$1"
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
set -o noclobber -o noglob -o nounset -o pipefail
|
|
||||||
IFS=$'\n'
|
|
||||||
|
|
||||||
# If the option `use_preview_script` is set to `true`,
|
|
||||||
# then this script will be called and its output will be displayed in ranger.
|
|
||||||
# ANSI color codes are supported.
|
|
||||||
# STDIN is disabled, so interactive scripts won't work properly
|
|
||||||
|
|
||||||
# This script is considered a configuration file and must be updated manually.
|
|
||||||
# It will be left untouched if you upgrade ranger.
|
|
||||||
|
|
||||||
# Meanings of exit codes:
|
|
||||||
# code | meaning | action of ranger
|
|
||||||
# -----+------------+-------------------------------------------
|
|
||||||
# 0 | success | Display stdout as preview
|
|
||||||
# 1 | no preview | Display no preview at all
|
|
||||||
# 2 | plain text | Display the plain content of the file
|
|
||||||
# 3 | fix width | Don't reload when width changes
|
|
||||||
# 4 | fix height | Don't reload when height changes
|
|
||||||
# 5 | fix both | Don't ever reload
|
|
||||||
# 6 | image | Display the image `$IMAGE_CACHE_PATH` points to as an image preview
|
|
||||||
# 7 | image | Display the file directly as an image
|
|
||||||
|
|
||||||
# Script arguments
|
|
||||||
FILE_PATH="${1}" # Full path of the highlighted file
|
|
||||||
PV_WIDTH="${2}" # Width of the preview pane (number of fitting characters)
|
|
||||||
PV_HEIGHT="${3}" # Height of the preview pane (number of fitting characters)
|
|
||||||
IMAGE_CACHE_PATH="${4}" # Full path that should be used to cache image preview
|
|
||||||
PV_IMAGE_ENABLED="${5}" # 'True' if image previews are enabled, 'False' otherwise.
|
|
||||||
|
|
||||||
FILE_EXTENSION="${FILE_PATH##*.}"
|
|
||||||
FILE_EXTENSION_LOWER=$(echo ${FILE_EXTENSION} | tr '[:upper:]' '[:lower:]')
|
|
||||||
|
|
||||||
# Settings
|
|
||||||
HIGHLIGHT_SIZE_MAX=262143 # 256KiB
|
|
||||||
HIGHLIGHT_TABWIDTH=8
|
|
||||||
HIGHLIGHT_STYLE='pablo'
|
|
||||||
PYGMENTIZE_STYLE='autumn'
|
|
||||||
|
|
||||||
|
|
||||||
handle_extension() {
|
|
||||||
case "${FILE_EXTENSION_LOWER}" in
|
|
||||||
# Archive
|
|
||||||
a|ace|alz|arc|arj|bz|bz2|cab|cpio|deb|gz|jar|lha|lz|lzh|lzma|lzo|\
|
|
||||||
rpm|rz|t7z|tar|tbz|tbz2|tgz|tlz|txz|tZ|tzo|war|xpi|xz|Z|zip)
|
|
||||||
atool --list -- "${FILE_PATH}" && exit 5
|
|
||||||
bsdtar --list --file "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
rar)
|
|
||||||
# Avoid password prompt by providing empty password
|
|
||||||
unrar lt -p- -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
7z)
|
|
||||||
# Avoid password prompt by providing empty password
|
|
||||||
7z l -p -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
# PDF
|
|
||||||
pdf)
|
|
||||||
# Preview as text conversion
|
|
||||||
pdftotext -l 10 -nopgbrk -q -- "${FILE_PATH}" - && exit 5
|
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
# BitTorrent
|
|
||||||
torrent)
|
|
||||||
transmission-show -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
# OpenDocument
|
|
||||||
odt|ods|odp|sxw)
|
|
||||||
# Preview as text conversion
|
|
||||||
odt2txt "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
# HTML
|
|
||||||
htm|html|xhtml)
|
|
||||||
# Preview as text conversion
|
|
||||||
w3m -dump "${FILE_PATH}" && exit 5
|
|
||||||
lynx -dump -- "${FILE_PATH}" && exit 5
|
|
||||||
elinks -dump "${FILE_PATH}" && exit 5
|
|
||||||
;; # Continue with next handler on failure
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_image() {
|
|
||||||
local mimetype="${1}"
|
|
||||||
case "${mimetype}" in
|
|
||||||
# SVG
|
|
||||||
# image/svg+xml)
|
|
||||||
# convert "${FILE_PATH}" "${IMAGE_CACHE_PATH}" && exit 6
|
|
||||||
# exit 1;;
|
|
||||||
|
|
||||||
# Image
|
|
||||||
image/*)
|
|
||||||
local orientation
|
|
||||||
orientation="$( identify -format '%[EXIF:Orientation]\n' -- "${FILE_PATH}" )"
|
|
||||||
# If orientation data is present and the image actually
|
|
||||||
# needs rotating ("1" means no rotation)...
|
|
||||||
if [[ -n "$orientation" && "$orientation" != 1 ]]; then
|
|
||||||
# ...auto-rotate the image according to the EXIF data.
|
|
||||||
convert -- "${FILE_PATH}" -auto-orient "${IMAGE_CACHE_PATH}" && exit 6
|
|
||||||
fi
|
|
||||||
|
|
||||||
# `w3mimgdisplay` will be called for all images (unless overriden as above),
|
|
||||||
# but might fail for unsupported types.
|
|
||||||
exit 7;;
|
|
||||||
|
|
||||||
# Video
|
|
||||||
# video/*)
|
|
||||||
# # Thumbnail
|
|
||||||
# ffmpegthumbnailer -i "${FILE_PATH}" -o "${IMAGE_CACHE_PATH}" -s 0 && exit 6
|
|
||||||
# exit 1;;
|
|
||||||
# PDF
|
|
||||||
# application/pdf)
|
|
||||||
# pdftoppm -f 1 -l 1 \
|
|
||||||
# -scale-to-x 1920 \
|
|
||||||
# -scale-to-y -1 \
|
|
||||||
# -singlefile \
|
|
||||||
# -jpeg -tiffcompression jpeg \
|
|
||||||
# -- "${FILE_PATH}" "${IMAGE_CACHE_PATH%.*}" \
|
|
||||||
# && exit 6 || exit 1;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_mime() {
|
|
||||||
local mimetype="${1}"
|
|
||||||
case "${mimetype}" in
|
|
||||||
# Text
|
|
||||||
text/* | */xml)
|
|
||||||
# Syntax highlight
|
|
||||||
if [[ "$( stat --printf='%s' -- "${FILE_PATH}" )" -gt "${HIGHLIGHT_SIZE_MAX}" ]]; then
|
|
||||||
exit 2
|
|
||||||
fi
|
|
||||||
if [[ "$( tput colors )" -ge 256 ]]; then
|
|
||||||
local pygmentize_format='terminal256'
|
|
||||||
local highlight_format='xterm256'
|
|
||||||
else
|
|
||||||
local pygmentize_format='terminal'
|
|
||||||
local highlight_format='ansi'
|
|
||||||
fi
|
|
||||||
highlight --replace-tabs="${HIGHLIGHT_TABWIDTH}" --out-format="${highlight_format}" \
|
|
||||||
--style="${HIGHLIGHT_STYLE}" --force -- "${FILE_PATH}" && exit 5
|
|
||||||
# pygmentize -f "${pygmentize_format}" -O "style=${PYGMENTIZE_STYLE}" -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 2;;
|
|
||||||
|
|
||||||
# Image
|
|
||||||
image/*)
|
|
||||||
# Preview as text conversion
|
|
||||||
# img2txt --gamma=0.6 --width="${PV_WIDTH}" -- "${FILE_PATH}" && exit 4
|
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
|
|
||||||
# Video and audio
|
|
||||||
video/* | audio/*)
|
|
||||||
mediainfo "${FILE_PATH}" && exit 5
|
|
||||||
exiftool "${FILE_PATH}" && exit 5
|
|
||||||
exit 1;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_fallback() {
|
|
||||||
echo '----- File Type Classification -----' && file --dereference --brief -- "${FILE_PATH}" && exit 5
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
MIMETYPE="$( file --dereference --brief --mime-type -- "${FILE_PATH}" )"
|
|
||||||
if [[ "${PV_IMAGE_ENABLED}" == 'True' ]]; then
|
|
||||||
handle_image "${MIMETYPE}"
|
|
||||||
fi
|
|
||||||
handle_extension
|
|
||||||
handle_mime "${MIMETYPE}"
|
|
||||||
handle_fallback
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
@@ -2,3 +2,6 @@
|
|||||||
.DS_Store
|
.DS_Store
|
||||||
|
|
||||||
.idea
|
.idea
|
||||||
|
.ipynb_checkpoints
|
||||||
|
|
||||||
|
__pycache__
|
||||||
58
.starship.toml
Normal file
58
.starship.toml
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
add_newline = false
|
||||||
|
format = """${custom.in_docker}${custom.docker_compose}$git_branch$git_status$fill$directory
|
||||||
|
$character"""
|
||||||
|
right_format = """$cmd_duration$username[@](red)$hostname $time"""
|
||||||
|
|
||||||
|
[git_branch]
|
||||||
|
format = "[$branch]($style) "
|
||||||
|
|
||||||
|
[git_status]
|
||||||
|
format = '[$all_status$ahead_behind]($style)'
|
||||||
|
|
||||||
|
[username]
|
||||||
|
show_always = true
|
||||||
|
format = "[$user]($style)"
|
||||||
|
style_user = "blue bold"
|
||||||
|
|
||||||
|
[hostname]
|
||||||
|
ssh_only = false
|
||||||
|
format = "[$hostname]($style)"
|
||||||
|
style = "blue bold"
|
||||||
|
|
||||||
|
[directory]
|
||||||
|
truncation_length = 5
|
||||||
|
truncate_to_repo = false
|
||||||
|
style = "cyan bold"
|
||||||
|
format = "[$path]($style)[$read_only]($read_only_style)"
|
||||||
|
|
||||||
|
[cmd_duration]
|
||||||
|
min_time = 5_000
|
||||||
|
format = '[$duration]($style) '
|
||||||
|
|
||||||
|
[time]
|
||||||
|
disabled = false
|
||||||
|
format = "[$time]($style)"
|
||||||
|
style = "green"
|
||||||
|
|
||||||
|
[fill]
|
||||||
|
symbol = " "
|
||||||
|
|
||||||
|
[character]
|
||||||
|
success_symbol = "[➤](green)"
|
||||||
|
error_symbol = "[➤](red)"
|
||||||
|
|
||||||
|
[custom.in_docker]
|
||||||
|
command = "echo \"🙆 $HOSTNAME\""
|
||||||
|
when = "test -f /.dockerenv"
|
||||||
|
shell = ["bash", "--noprofile", "--norc"]
|
||||||
|
style = "yellow bold"
|
||||||
|
symbol = ""
|
||||||
|
format = "[$output ]($style)"
|
||||||
|
|
||||||
|
[custom.docker_compose]
|
||||||
|
command = '''docker compose ps --format json 2>/dev/null | jq -rse 'if length == 0 then halt_error(1) else [group_by(.State) | .[] | "\(if .[0].State == "running" then "▲" else "▼" end)\(length)"] | "🐳 " + join("/") end' '''
|
||||||
|
detect_files = ["docker-compose.yml", "docker-compose.yaml", "compose.yml", "compose.yaml"]
|
||||||
|
shell = ["bash", "--noprofile", "--norc"]
|
||||||
|
style = "blue bold"
|
||||||
|
symbol = ""
|
||||||
|
format = "[$output ]($style)"
|
||||||
1150
.tmux.conf
1150
.tmux.conf
File diff suppressed because it is too large
Load Diff
267
.tmux.conf.local
267
.tmux.conf.local
@@ -1,267 +0,0 @@
|
|||||||
# https://github.com/gpakosz/.tmux
|
|
||||||
# (‑●‑●)> dual licensed under the WTFPL v2 license and the MIT license,
|
|
||||||
# without any warranty.
|
|
||||||
# Copyright 2012— Gregory Pakosz (@gpakosz).
|
|
||||||
|
|
||||||
|
|
||||||
# -- navigation ----------------------------------------------------------------
|
|
||||||
|
|
||||||
# if you're running tmux within iTerm2
|
|
||||||
# - and tmux is 1.9 or 1.9a
|
|
||||||
# - and iTerm2 is configured to let option key act as +Esc
|
|
||||||
# - and iTerm2 is configured to send [1;9A -> [1;9D for option + arrow keys
|
|
||||||
# then uncomment the following line to make Meta + arrow keys mapping work
|
|
||||||
#set -ga terminal-overrides "*:kUP3=\e[1;9A,*:kDN3=\e[1;9B,*:kRIT3=\e[1;9C,*:kLFT3=\e[1;9D"
|
|
||||||
|
|
||||||
|
|
||||||
# -- windows & pane creation ---------------------------------------------------
|
|
||||||
|
|
||||||
# new window retains current path, possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_new_window_retain_current_path=false
|
|
||||||
|
|
||||||
# new pane retains current path, possible values are:
|
|
||||||
# - true (default)
|
|
||||||
# - false
|
|
||||||
tmux_conf_new_pane_retain_current_path=true
|
|
||||||
|
|
||||||
# new pane tries to reconnect ssh sessions (experimental), possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_new_pane_reconnect_ssh=false
|
|
||||||
|
|
||||||
# prompt for session name when creating a new session, possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_new_session_prompt=false
|
|
||||||
|
|
||||||
|
|
||||||
# -- display -------------------------------------------------------------------
|
|
||||||
|
|
||||||
# RGB 24-bit colour support (tmux >= 2.2), possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_theme_24b_colour=false
|
|
||||||
|
|
||||||
# window style
|
|
||||||
tmux_conf_theme_window_fg='default'
|
|
||||||
tmux_conf_theme_window_bg='default'
|
|
||||||
|
|
||||||
# highlight focused pane (tmux >= 2.1), possible values are:
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
tmux_conf_theme_highlight_focused_pane=false
|
|
||||||
|
|
||||||
# focused pane colours:
|
|
||||||
tmux_conf_theme_focused_pane_fg='default'
|
|
||||||
tmux_conf_theme_focused_pane_bg='#0087d7' # light blue
|
|
||||||
|
|
||||||
# pane border style, possible values are:
|
|
||||||
# - thin (default)
|
|
||||||
# - fat
|
|
||||||
tmux_conf_theme_pane_border_style=thin
|
|
||||||
|
|
||||||
# pane borders colours:
|
|
||||||
tmux_conf_theme_pane_border='#444444' # gray
|
|
||||||
tmux_conf_theme_pane_active_border='#00afff' # light blue
|
|
||||||
|
|
||||||
# pane indicator colours
|
|
||||||
tmux_conf_theme_pane_indicator='#00afff' # light blue
|
|
||||||
tmux_conf_theme_pane_active_indicator='#00afff' # light blue
|
|
||||||
|
|
||||||
# status line style
|
|
||||||
tmux_conf_theme_message_fg='#000000' # black
|
|
||||||
tmux_conf_theme_message_bg='#ffff00' # yellow
|
|
||||||
tmux_conf_theme_message_attr='bold'
|
|
||||||
|
|
||||||
# status line command style (<prefix> : Escape)
|
|
||||||
tmux_conf_theme_message_command_fg='#ffff00' # yellow
|
|
||||||
tmux_conf_theme_message_command_bg='#000000' # black
|
|
||||||
tmux_conf_theme_message_command_attr='bold'
|
|
||||||
|
|
||||||
# window modes style
|
|
||||||
tmux_conf_theme_mode_fg='#000000' # black
|
|
||||||
tmux_conf_theme_mode_bg='#ffff00' # yellow
|
|
||||||
tmux_conf_theme_mode_attr='bold'
|
|
||||||
|
|
||||||
# status line style
|
|
||||||
tmux_conf_theme_status_fg='#8a8a8a' # light gray
|
|
||||||
tmux_conf_theme_status_bg='#080808' # dark gray
|
|
||||||
tmux_conf_theme_status_attr='none'
|
|
||||||
|
|
||||||
# window status style
|
|
||||||
# - built-in variables are:
|
|
||||||
# - #{circled_window_index}
|
|
||||||
tmux_conf_theme_window_status_fg='#8a8a8a' # light gray
|
|
||||||
tmux_conf_theme_window_status_bg='#080808' # dark gray
|
|
||||||
tmux_conf_theme_window_status_attr='none'
|
|
||||||
tmux_conf_theme_window_status_format='#I #W'
|
|
||||||
#tmux_conf_theme_window_status_format='#{circled_window_index} #W'
|
|
||||||
#tmux_conf_theme_window_status_format='#I #W#{?window_bell_flag,🔔,}#{?window_zoomed_flag,🔍,}'
|
|
||||||
|
|
||||||
# window current status style
|
|
||||||
# - built-in variables are:
|
|
||||||
# - #{circled_window_index}
|
|
||||||
tmux_conf_theme_window_status_current_fg='#000000' # black
|
|
||||||
tmux_conf_theme_window_status_current_bg='#00afff' # light blue
|
|
||||||
tmux_conf_theme_window_status_current_attr='bold'
|
|
||||||
tmux_conf_theme_window_status_current_format='#I #W'
|
|
||||||
#tmux_conf_theme_window_status_current_format='#{circled_window_index} #W'
|
|
||||||
#tmux_conf_theme_window_status_current_format='#I #W#{?window_zoomed_flag,🔍,}'
|
|
||||||
|
|
||||||
# window activity status style
|
|
||||||
tmux_conf_theme_window_status_activity_fg='default'
|
|
||||||
tmux_conf_theme_window_status_activity_bg='default'
|
|
||||||
tmux_conf_theme_window_status_activity_attr='underscore'
|
|
||||||
|
|
||||||
# window bell status style
|
|
||||||
tmux_conf_theme_window_status_bell_fg='#ffff00' # yellow
|
|
||||||
tmux_conf_theme_window_status_bell_bg='default'
|
|
||||||
tmux_conf_theme_window_status_bell_attr='blink,bold'
|
|
||||||
|
|
||||||
# window last status style
|
|
||||||
tmux_conf_theme_window_status_last_fg='#00afff' # light blue
|
|
||||||
tmux_conf_theme_window_status_last_bg='default'
|
|
||||||
tmux_conf_theme_window_status_last_attr='none'
|
|
||||||
|
|
||||||
# status left/right sections separators
|
|
||||||
tmux_conf_theme_left_separator_main=''
|
|
||||||
tmux_conf_theme_left_separator_sub='|'
|
|
||||||
tmux_conf_theme_right_separator_main=''
|
|
||||||
tmux_conf_theme_right_separator_sub='|'
|
|
||||||
#tmux_conf_theme_left_separator_main='' # /!\ you don't need to install Powerline
|
|
||||||
#tmux_conf_theme_left_separator_sub='' # you only need fonts patched with
|
|
||||||
#tmux_conf_theme_right_separator_main='' # Powerline symbols or the standalone
|
|
||||||
#tmux_conf_theme_right_separator_sub='' # PowerlineSymbols.otf font
|
|
||||||
|
|
||||||
# status left/right content:
|
|
||||||
# - separate main sections with '|'
|
|
||||||
# - separate subsections with ','
|
|
||||||
# - built-in variables are:
|
|
||||||
# - #{battery_bar}
|
|
||||||
# - #{battery_hbar}
|
|
||||||
# - #{battery_percentage}
|
|
||||||
# - #{battery_status}
|
|
||||||
# - #{battery_vbar}
|
|
||||||
# - #{circled_session_name}
|
|
||||||
# - #{hostname_ssh}
|
|
||||||
# - #{hostname}
|
|
||||||
# - #{loadavg}
|
|
||||||
# - #{pairing}
|
|
||||||
# - #{prefix}
|
|
||||||
# - #{root}
|
|
||||||
# - #{uptime_d}
|
|
||||||
# - #{uptime_h}
|
|
||||||
# - #{uptime_m}
|
|
||||||
# - #{uptime_s}
|
|
||||||
# - #{username}
|
|
||||||
# - #{username_ssh}
|
|
||||||
tmux_conf_theme_status_left=''
|
|
||||||
tmux_conf_theme_status_right=''
|
|
||||||
|
|
||||||
# status left style
|
|
||||||
tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4' # black, white , white
|
|
||||||
tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff' # yellow, pink, white blue
|
|
||||||
tmux_conf_theme_status_left_attr='bold,none,none'
|
|
||||||
|
|
||||||
# status right style
|
|
||||||
tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000' # light gray, white, black
|
|
||||||
tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' # dark gray, red, white
|
|
||||||
tmux_conf_theme_status_right_attr='none,none,bold'
|
|
||||||
|
|
||||||
# pairing indicator
|
|
||||||
tmux_conf_theme_pairing='👓 ' # U+1F453
|
|
||||||
tmux_conf_theme_pairing_fg='none'
|
|
||||||
tmux_conf_theme_pairing_bg='none'
|
|
||||||
tmux_conf_theme_pairing_attr='none'
|
|
||||||
|
|
||||||
# prefix indicator
|
|
||||||
tmux_conf_theme_prefix='⌨ ' # U+2328
|
|
||||||
tmux_conf_theme_prefix_fg='none'
|
|
||||||
tmux_conf_theme_prefix_bg='none'
|
|
||||||
tmux_conf_theme_prefix_attr='none'
|
|
||||||
|
|
||||||
# root indicator
|
|
||||||
tmux_conf_theme_root='!'
|
|
||||||
tmux_conf_theme_root_fg='none'
|
|
||||||
tmux_conf_theme_root_bg='none'
|
|
||||||
tmux_conf_theme_root_attr='bold,blink'
|
|
||||||
|
|
||||||
# battery bar symbols
|
|
||||||
tmux_conf_battery_bar_symbol_full='◼'
|
|
||||||
tmux_conf_battery_bar_symbol_empty='◻'
|
|
||||||
#tmux_conf_battery_bar_symbol_full='♥'
|
|
||||||
#tmux_conf_battery_bar_symbol_empty='·'
|
|
||||||
|
|
||||||
# battery bar length (in number of symbols), possible values are:
|
|
||||||
# - auto
|
|
||||||
# - a number, e.g. 5
|
|
||||||
tmux_conf_battery_bar_length='auto'
|
|
||||||
|
|
||||||
# battery bar palette, possible values are:
|
|
||||||
# - gradient (default)
|
|
||||||
# - heat
|
|
||||||
# - 'colour_full_fg,colour_empty_fg,colour_bg'
|
|
||||||
tmux_conf_battery_bar_palette='gradient'
|
|
||||||
#tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' # red, white, black
|
|
||||||
|
|
||||||
# battery hbar palette, possible values are:
|
|
||||||
# - gradient (default)
|
|
||||||
# - heat
|
|
||||||
# - 'colour_low,colour_half,colour_full'
|
|
||||||
tmux_conf_battery_hbar_palette='gradient'
|
|
||||||
#tmux_conf_battery_hbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
|
|
||||||
|
|
||||||
# battery vbar palette, possible values are:
|
|
||||||
# - gradient (default)
|
|
||||||
# - heat
|
|
||||||
# - 'colour_low,colour_half,colour_full'
|
|
||||||
tmux_conf_battery_vbar_palette='gradient'
|
|
||||||
#tmux_conf_battery_vbar_palette='#d70000,#ff5f00,#5fff00' # red, orange, green
|
|
||||||
|
|
||||||
# symbols used to indicate whether battery is charging or discharging
|
|
||||||
tmux_conf_battery_status_charging='↑' # U+2191
|
|
||||||
tmux_conf_battery_status_discharging='↓' # U+2193
|
|
||||||
#tmux_conf_battery_status_charging='⚡ ' # U+26A1
|
|
||||||
#tmux_conf_battery_status_charging='🔌 ' # U+1F50C
|
|
||||||
#tmux_conf_battery_status_discharging='🔋 ' # U+1F50B
|
|
||||||
|
|
||||||
# clock style
|
|
||||||
tmux_conf_theme_clock_colour='#00afff' # light blue
|
|
||||||
tmux_conf_theme_clock_style='24'
|
|
||||||
|
|
||||||
|
|
||||||
# -- clipboard -----------------------------------------------------------------
|
|
||||||
|
|
||||||
# in copy mode, copying selection also copies to the OS clipboard
|
|
||||||
# - true
|
|
||||||
# - false (default)
|
|
||||||
# on macOS, this requires installing reattach-to-user-namespace, see README.md
|
|
||||||
# on Linux, this requires xsel or xclip
|
|
||||||
tmux_conf_copy_to_os_clipboard=false
|
|
||||||
|
|
||||||
|
|
||||||
# -- user customizations -------------------------------------------------------
|
|
||||||
# this is the place to override or undo settings
|
|
||||||
|
|
||||||
# increase history size
|
|
||||||
set -g history-limit 10000
|
|
||||||
|
|
||||||
# start with mouse mode enabled
|
|
||||||
set -g mouse on
|
|
||||||
|
|
||||||
# force Vi mode
|
|
||||||
# really you should export VISUAL or EDITOR environment variable, see manual
|
|
||||||
#set -g status-keys vi
|
|
||||||
#set -g mode-keys vi
|
|
||||||
|
|
||||||
# replace C-b by C-a instead of using both prefixes
|
|
||||||
# set -gu prefix2
|
|
||||||
# unbind C-a
|
|
||||||
# unbind C-b
|
|
||||||
# set -g prefix C-a
|
|
||||||
# bind C-a send-prefix
|
|
||||||
|
|
||||||
# move status line to top
|
|
||||||
#set -g status-position top
|
|
||||||
10
.vimrc
10
.vimrc
@@ -7,7 +7,6 @@ syntax enable " enable syntax processing
|
|||||||
set tabstop=4 " number of visual spaces per TAB
|
set tabstop=4 " number of visual spaces per TAB
|
||||||
set softtabstop=4 " number of spaces in tab when editing
|
set softtabstop=4 " number of spaces in tab when editing
|
||||||
set expandtab " tabs are spaces
|
set expandtab " tabs are spaces
|
||||||
set number " show line numbers
|
|
||||||
set showcmd " show command in bottom bar
|
set showcmd " show command in bottom bar
|
||||||
set cursorline " highlight current line
|
set cursorline " highlight current line
|
||||||
set wildmenu " visual autocomplete for command menu
|
set wildmenu " visual autocomplete for command menu
|
||||||
@@ -15,6 +14,15 @@ set lazyredraw " redraw only when we need to.
|
|||||||
set showmatch " highlight matching [{()}]
|
set showmatch " highlight matching [{()}]
|
||||||
set incsearch " search as characters are entered
|
set incsearch " search as characters are entered
|
||||||
set hlsearch " highlight matches
|
set hlsearch " highlight matches
|
||||||
|
set hidden " switch buffers without saving
|
||||||
|
set ignorecase smartcase " smart case search
|
||||||
|
set scrolloff=8 " keep 8 lines visible above/below cursor
|
||||||
|
set undofile " persistent undo across sessions
|
||||||
|
set undodir=~/.vim/undo//
|
||||||
|
set directory=~/.vim/swap//
|
||||||
|
set backupdir=~/.vim/backup//
|
||||||
|
set nobackup
|
||||||
|
set mouse=a " mouse support
|
||||||
|
|
||||||
|
|
||||||
noremap <Up> <NOP>
|
noremap <Up> <NOP>
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
[*]
|
|
||||||
end_of_line = lf
|
|
||||||
insert_final_newline = true
|
|
||||||
indent_style = space
|
|
||||||
indent_size = 2
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
|
|
||||||
[{.gitattributes,.gitignore,.gitmodules}]
|
|
||||||
indent_style = tab
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
ref: refs/heads/master
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
[core]
|
|
||||||
repositoryformatversion = 0
|
|
||||||
filemode = true
|
|
||||||
bare = false
|
|
||||||
logallrefupdates = true
|
|
||||||
ignorecase = true
|
|
||||||
precomposeunicode = true
|
|
||||||
[submodule]
|
|
||||||
active = .
|
|
||||||
[remote "origin"]
|
|
||||||
url = https://github.com/sorin-ionescu/prezto.git
|
|
||||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
||||||
[branch "master"]
|
|
||||||
remote = origin
|
|
||||||
merge = refs/heads/master
|
|
||||||
[submodule "modules/autosuggestions/external"]
|
|
||||||
url = https://github.com/zsh-users/zsh-autosuggestions.git
|
|
||||||
[submodule "modules/completion/external"]
|
|
||||||
url = https://github.com/zsh-users/zsh-completions.git
|
|
||||||
[submodule "modules/fasd/external"]
|
|
||||||
url = https://github.com/clvv/fasd.git
|
|
||||||
[submodule "modules/history-substring-search/external"]
|
|
||||||
url = https://github.com/zsh-users/zsh-history-substring-search.git
|
|
||||||
[submodule "modules/prompt/external/agnoster"]
|
|
||||||
url = https://github.com/agnoster/agnoster-zsh-theme.git
|
|
||||||
[submodule "modules/prompt/external/async"]
|
|
||||||
url = https://github.com/mafredri/zsh-async.git
|
|
||||||
[submodule "modules/prompt/external/powerlevel9k"]
|
|
||||||
url = https://github.com/bhilburn/powerlevel9k.git
|
|
||||||
[submodule "modules/prompt/external/powerline"]
|
|
||||||
url = https://github.com/davidjrice/prezto_powerline.git
|
|
||||||
[submodule "modules/prompt/functions/pure"]
|
|
||||||
url = https://github.com/sindresorhus/pure.git
|
|
||||||
[submodule "modules/syntax-highlighting/external"]
|
|
||||||
url = https://github.com/zsh-users/zsh-syntax-highlighting.git
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Unnamed repository; edit this file 'description' to name the repository.
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/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+"$@"}
|
|
||||||
:
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/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
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
#!/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 1) and a time in nanoseconds
|
|
||||||
# formatted as a string and outputs to stdout all files that have been
|
|
||||||
# modified since the given time. 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, $time) = @ARGV;
|
|
||||||
|
|
||||||
# Check the hook interface version
|
|
||||||
|
|
||||||
if ($version == 1) {
|
|
||||||
# convert nanoseconds to seconds
|
|
||||||
$time = int $time / 1000000000;
|
|
||||||
} else {
|
|
||||||
die "Unsupported query-fsmonitor hook version '$version'.\n" .
|
|
||||||
"Falling back to scanning...\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
my $git_work_tree;
|
|
||||||
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
|
|
||||||
$git_work_tree = Win32::GetCwd();
|
|
||||||
$git_work_tree =~ tr/\\/\//;
|
|
||||||
} else {
|
|
||||||
require Cwd;
|
|
||||||
$git_work_tree = Cwd::cwd();
|
|
||||||
}
|
|
||||||
|
|
||||||
my $retry = 1;
|
|
||||||
|
|
||||||
launch_watchman();
|
|
||||||
|
|
||||||
sub launch_watchman {
|
|
||||||
|
|
||||||
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 $time but were not transient (ie created after
|
|
||||||
# $time but no longer exist).
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
# The category of transient files that we want to ignore will have a
|
|
||||||
# creation clock (cclock) newer than $time_t value and will also not
|
|
||||||
# currently exist.
|
|
||||||
|
|
||||||
my $query = <<" END";
|
|
||||||
["query", "$git_work_tree", {
|
|
||||||
"since": $time,
|
|
||||||
"fields": ["name"],
|
|
||||||
"expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]]
|
|
||||||
}]
|
|
||||||
END
|
|
||||||
|
|
||||||
print CHLD_IN $query;
|
|
||||||
close CHLD_IN;
|
|
||||||
my $response = do {local $/; <CHLD_OUT>};
|
|
||||||
|
|
||||||
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 =~ /^\{/;
|
|
||||||
|
|
||||||
my $json_pkg;
|
|
||||||
eval {
|
|
||||||
require JSON::XS;
|
|
||||||
$json_pkg = "JSON::XS";
|
|
||||||
1;
|
|
||||||
} or do {
|
|
||||||
require JSON::PP;
|
|
||||||
$json_pkg = "JSON::PP";
|
|
||||||
};
|
|
||||||
|
|
||||||
my $o = $json_pkg->new->utf8->decode($response);
|
|
||||||
|
|
||||||
if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) {
|
|
||||||
print STDERR "Adding '$git_work_tree' to watchman's watch list.\n";
|
|
||||||
$retry--;
|
|
||||||
qx/watchman watch "$git_work_tree"/;
|
|
||||||
die "Failed to make watchman watch '$git_work_tree'.\n" .
|
|
||||||
"Falling back to scanning...\n" if $? != 0;
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
print "/\0";
|
|
||||||
eval { launch_watchman() };
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
die "Watchman: $o->{error}.\n" .
|
|
||||||
"Falling back to scanning...\n" if $o->{error};
|
|
||||||
|
|
||||||
binmode STDOUT, ":utf8";
|
|
||||||
local $, = "\0";
|
|
||||||
print @{$o->{files}};
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/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+"$@"}
|
|
||||||
:
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/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 --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 --
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006, 2008 Junio C Hamano
|
|
||||||
#
|
|
||||||
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
|
||||||
# its job, and can prevent the command from running by exiting with
|
|
||||||
# non-zero status.
|
|
||||||
#
|
|
||||||
# The hook is called with the following parameters:
|
|
||||||
#
|
|
||||||
# $1 -- the upstream the series was forked from.
|
|
||||||
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
|
||||||
#
|
|
||||||
# This sample shows how to prevent topic branches that are already
|
|
||||||
# merged to 'next' branch from getting rebased, because allowing it
|
|
||||||
# would result in rebasing already published history.
|
|
||||||
|
|
||||||
publish=next
|
|
||||||
basebranch="$1"
|
|
||||||
if test "$#" = 2
|
|
||||||
then
|
|
||||||
topic="refs/heads/$2"
|
|
||||||
else
|
|
||||||
topic=`git symbolic-ref HEAD` ||
|
|
||||||
exit 0 ;# we do not interrupt rebasing detached HEAD
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$topic" in
|
|
||||||
refs/heads/??/*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit 0 ;# we do not interrupt others.
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Now we are dealing with a topic branch being rebased
|
|
||||||
# on top of master. Is it OK to rebase it?
|
|
||||||
|
|
||||||
# Does the topic really exist?
|
|
||||||
git show-ref -q "$topic" || {
|
|
||||||
echo >&2 "No such branch $topic"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Is topic fully merged to master?
|
|
||||||
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
|
||||||
if test -z "$not_in_master"
|
|
||||||
then
|
|
||||||
echo >&2 "$topic is fully merged to master; better remove it."
|
|
||||||
exit 1 ;# we could allow it, but there is no point.
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Is topic ever merged to next? If so you should not be rebasing it.
|
|
||||||
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
|
||||||
only_next_2=`git rev-list ^master ${publish} | sort`
|
|
||||||
if test "$only_next_1" = "$only_next_2"
|
|
||||||
then
|
|
||||||
not_in_topic=`git rev-list "^$topic" master`
|
|
||||||
if test -z "$not_in_topic"
|
|
||||||
then
|
|
||||||
echo >&2 "$topic is already up to date with master"
|
|
||||||
exit 1 ;# we could allow it, but there is no point.
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
|
||||||
/usr/bin/perl -e '
|
|
||||||
my $topic = $ARGV[0];
|
|
||||||
my $msg = "* $topic has commits already merged to public branch:\n";
|
|
||||||
my (%not_in_next) = map {
|
|
||||||
/^([0-9a-f]+) /;
|
|
||||||
($1 => 1);
|
|
||||||
} split(/\n/, $ARGV[1]);
|
|
||||||
for my $elem (map {
|
|
||||||
/^([0-9a-f]+) (.*)$/;
|
|
||||||
[$1 => $2];
|
|
||||||
} split(/\n/, $ARGV[2])) {
|
|
||||||
if (!exists $not_in_next{$elem->[0]}) {
|
|
||||||
if ($msg) {
|
|
||||||
print STDERR $msg;
|
|
||||||
undef $msg;
|
|
||||||
}
|
|
||||||
print STDERR " $elem->[1]\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
' "$topic" "$not_in_next" "$not_in_master"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
<<\DOC_END
|
|
||||||
|
|
||||||
This sample hook safeguards topic branches that have been
|
|
||||||
published from being rewound.
|
|
||||||
|
|
||||||
The workflow assumed here is:
|
|
||||||
|
|
||||||
* Once a topic branch forks from "master", "master" is never
|
|
||||||
merged into it again (either directly or indirectly).
|
|
||||||
|
|
||||||
* Once a topic branch is fully cooked and merged into "master",
|
|
||||||
it is deleted. If you need to build on top of it to correct
|
|
||||||
earlier mistakes, a new topic branch is created by forking at
|
|
||||||
the tip of the "master". This is not strictly necessary, but
|
|
||||||
it makes it easier to keep your history simple.
|
|
||||||
|
|
||||||
* Whenever you need to test or publish your changes to topic
|
|
||||||
branches, merge them into "next" branch.
|
|
||||||
|
|
||||||
The script, being an example, hardcodes the publish branch name
|
|
||||||
to be "next", but it is trivial to make it configurable via
|
|
||||||
$GIT_DIR/config mechanism.
|
|
||||||
|
|
||||||
With this workflow, you would want to know:
|
|
||||||
|
|
||||||
(1) ... if a topic branch has ever been merged to "next". Young
|
|
||||||
topic branches can have stupid mistakes you would rather
|
|
||||||
clean up before publishing, and things that have not been
|
|
||||||
merged into other branches can be easily rebased without
|
|
||||||
affecting other people. But once it is published, you would
|
|
||||||
not want to rewind it.
|
|
||||||
|
|
||||||
(2) ... if a topic branch has been fully merged to "master".
|
|
||||||
Then you can delete it. More importantly, you should not
|
|
||||||
build on top of it -- other people may already want to
|
|
||||||
change things related to the topic as patches against your
|
|
||||||
"master", so if you need further changes, it is better to
|
|
||||||
fork the topic (perhaps with the same name) afresh from the
|
|
||||||
tip of "master".
|
|
||||||
|
|
||||||
Let's look at this example:
|
|
||||||
|
|
||||||
o---o---o---o---o---o---o---o---o---o "next"
|
|
||||||
/ / / /
|
|
||||||
/ a---a---b A / /
|
|
||||||
/ / / /
|
|
||||||
/ / c---c---c---c B /
|
|
||||||
/ / / \ /
|
|
||||||
/ / / b---b C \ /
|
|
||||||
/ / / / \ /
|
|
||||||
---o---o---o---o---o---o---o---o---o---o---o "master"
|
|
||||||
|
|
||||||
|
|
||||||
A, B and C are topic branches.
|
|
||||||
|
|
||||||
* A has one fix since it was merged up to "next".
|
|
||||||
|
|
||||||
* B has finished. It has been fully merged up to "master" and "next",
|
|
||||||
and is ready to be deleted.
|
|
||||||
|
|
||||||
* C has not merged to "next" at all.
|
|
||||||
|
|
||||||
We would want to allow C to be rebased, refuse A, and encourage
|
|
||||||
B to be deleted.
|
|
||||||
|
|
||||||
To compute (1):
|
|
||||||
|
|
||||||
git rev-list ^master ^topic next
|
|
||||||
git rev-list ^master next
|
|
||||||
|
|
||||||
if these match, topic has not merged in next at all.
|
|
||||||
|
|
||||||
To compute (2):
|
|
||||||
|
|
||||||
git rev-list master..topic
|
|
||||||
|
|
||||||
if this is empty, it is fully merged to "master".
|
|
||||||
|
|
||||||
DOC_END
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to make use of push options.
|
|
||||||
# The example simply echoes all push options that start with 'echoback='
|
|
||||||
# and rejects all pushes when the "reject" push option is used.
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "pre-receive".
|
|
||||||
|
|
||||||
if test -n "$GIT_PUSH_OPTION_COUNT"
|
|
||||||
then
|
|
||||||
i=0
|
|
||||||
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
|
|
||||||
do
|
|
||||||
eval "value=\$GIT_PUSH_OPTION_$i"
|
|
||||||
case "$value" in
|
|
||||||
echoback=*)
|
|
||||||
echo "echo from the pre-receive-hook: ${value#*=}" >&2
|
|
||||||
;;
|
|
||||||
reject)
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to prepare the commit log message.
|
|
||||||
# Called by "git commit" with the name of the file that has the
|
|
||||||
# commit message, followed by the description of the commit
|
|
||||||
# message's source. The hook's purpose is to edit the commit
|
|
||||||
# message file. If the hook fails with a non-zero status,
|
|
||||||
# the commit is aborted.
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "prepare-commit-msg".
|
|
||||||
|
|
||||||
# This hook includes three examples. The first one removes the
|
|
||||||
# "# Please enter the commit message..." help message.
|
|
||||||
#
|
|
||||||
# The second includes the output of "git diff --name-status -r"
|
|
||||||
# into the message, just before the "git status" output. It is
|
|
||||||
# commented because it doesn't cope with --amend or with squashed
|
|
||||||
# commits.
|
|
||||||
#
|
|
||||||
# The third example adds a Signed-off-by line to the message, that can
|
|
||||||
# still be edited. This is rarely a good idea.
|
|
||||||
|
|
||||||
COMMIT_MSG_FILE=$1
|
|
||||||
COMMIT_SOURCE=$2
|
|
||||||
SHA1=$3
|
|
||||||
|
|
||||||
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
|
|
||||||
|
|
||||||
# case "$COMMIT_SOURCE,$SHA1" in
|
|
||||||
# ,|template,)
|
|
||||||
# /usr/bin/perl -i.bak -pe '
|
|
||||||
# print "\n" . `git diff --cached --name-status -r`
|
|
||||||
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
|
|
||||||
# *) ;;
|
|
||||||
# esac
|
|
||||||
|
|
||||||
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
|
||||||
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
|
|
||||||
# if test -z "$COMMIT_SOURCE"
|
|
||||||
# then
|
|
||||||
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
|
|
||||||
# fi
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to block unannotated tags from entering.
|
|
||||||
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "update".
|
|
||||||
#
|
|
||||||
# Config
|
|
||||||
# ------
|
|
||||||
# hooks.allowunannotated
|
|
||||||
# This boolean sets whether unannotated tags will be allowed into the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.allowdeletetag
|
|
||||||
# This boolean sets whether deleting tags will be allowed in the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.allowmodifytag
|
|
||||||
# This boolean sets whether a tag may be modified after creation. By default
|
|
||||||
# it won't be.
|
|
||||||
# hooks.allowdeletebranch
|
|
||||||
# This boolean sets whether deleting branches will be allowed in the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.denycreatebranch
|
|
||||||
# This boolean sets whether remotely creating branches will be denied
|
|
||||||
# in the repository. By default this is allowed.
|
|
||||||
#
|
|
||||||
|
|
||||||
# --- Command line
|
|
||||||
refname="$1"
|
|
||||||
oldrev="$2"
|
|
||||||
newrev="$3"
|
|
||||||
|
|
||||||
# --- Safety check
|
|
||||||
if [ -z "$GIT_DIR" ]; then
|
|
||||||
echo "Don't run this script from the command line." >&2
|
|
||||||
echo " (if you want, you could supply GIT_DIR then run" >&2
|
|
||||||
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
|
||||||
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- Config
|
|
||||||
allowunannotated=$(git config --bool hooks.allowunannotated)
|
|
||||||
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
|
||||||
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
|
||||||
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
|
||||||
allowmodifytag=$(git config --bool hooks.allowmodifytag)
|
|
||||||
|
|
||||||
# check for no description
|
|
||||||
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
|
||||||
case "$projectdesc" in
|
|
||||||
"Unnamed repository"* | "")
|
|
||||||
echo "*** Project description file hasn't been set" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# --- Check types
|
|
||||||
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
|
||||||
zero="0000000000000000000000000000000000000000"
|
|
||||||
if [ "$newrev" = "$zero" ]; then
|
|
||||||
newrev_type=delete
|
|
||||||
else
|
|
||||||
newrev_type=$(git cat-file -t $newrev)
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$refname","$newrev_type" in
|
|
||||||
refs/tags/*,commit)
|
|
||||||
# un-annotated tag
|
|
||||||
short_refname=${refname##refs/tags/}
|
|
||||||
if [ "$allowunannotated" != "true" ]; then
|
|
||||||
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
|
||||||
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/tags/*,delete)
|
|
||||||
# delete tag
|
|
||||||
if [ "$allowdeletetag" != "true" ]; then
|
|
||||||
echo "*** Deleting a tag is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/tags/*,tag)
|
|
||||||
# annotated tag
|
|
||||||
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
echo "*** Tag '$refname' already exists." >&2
|
|
||||||
echo "*** Modifying a tag is not allowed in this repository." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/heads/*,commit)
|
|
||||||
# branch
|
|
||||||
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
|
||||||
echo "*** Creating a branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/heads/*,delete)
|
|
||||||
# delete branch
|
|
||||||
if [ "$allowdeletebranch" != "true" ]; then
|
|
||||||
echo "*** Deleting a branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/remotes/*,commit)
|
|
||||||
# tracking branch
|
|
||||||
;;
|
|
||||||
refs/remotes/*,delete)
|
|
||||||
# delete tracking branch
|
|
||||||
if [ "$allowdeletebranch" != "true" ]; then
|
|
||||||
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Anything else (is there anything else?)
|
|
||||||
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# --- Finished
|
|
||||||
exit 0
|
|
||||||
Binary file not shown.
@@ -1,6 +0,0 @@
|
|||||||
# git ls-files --others --exclude-from=.git/info/exclude
|
|
||||||
# Lines that start with '#' are comments.
|
|
||||||
# For a project mostly in C, the following would be a good set of
|
|
||||||
# exclude patterns (uncomment them if you want to use them):
|
|
||||||
# *.[oa]
|
|
||||||
# *~
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 f2042a29cc7613e8f797044948b0238916b2a234 Andrey Anurin <svxf@yandex-team.ru> 1534073683 +0300 clone: from https://github.com/sorin-ionescu/prezto.git
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 f2042a29cc7613e8f797044948b0238916b2a234 Andrey Anurin <svxf@yandex-team.ru> 1534073683 +0300 clone: from https://github.com/sorin-ionescu/prezto.git
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 f2042a29cc7613e8f797044948b0238916b2a234 Andrey Anurin <svxf@yandex-team.ru> 1534073683 +0300 clone: from https://github.com/sorin-ionescu/prezto.git
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
d7c796719e6352666f7a9c94da9ddaed10f3217d
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[core]
|
|
||||||
repositoryformatversion = 0
|
|
||||||
filemode = true
|
|
||||||
bare = false
|
|
||||||
logallrefupdates = true
|
|
||||||
ignorecase = true
|
|
||||||
precomposeunicode = true
|
|
||||||
worktree = ../../../../../modules/autosuggestions/external
|
|
||||||
[remote "origin"]
|
|
||||||
url = https://github.com/zsh-users/zsh-autosuggestions.git
|
|
||||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
||||||
[branch "master"]
|
|
||||||
remote = origin
|
|
||||||
merge = refs/heads/master
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Unnamed repository; edit this file 'description' to name the repository.
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/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+"$@"}
|
|
||||||
:
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/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
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
#!/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 1) and a time in nanoseconds
|
|
||||||
# formatted as a string and outputs to stdout all files that have been
|
|
||||||
# modified since the given time. 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, $time) = @ARGV;
|
|
||||||
|
|
||||||
# Check the hook interface version
|
|
||||||
|
|
||||||
if ($version == 1) {
|
|
||||||
# convert nanoseconds to seconds
|
|
||||||
$time = int $time / 1000000000;
|
|
||||||
} else {
|
|
||||||
die "Unsupported query-fsmonitor hook version '$version'.\n" .
|
|
||||||
"Falling back to scanning...\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
my $git_work_tree;
|
|
||||||
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
|
|
||||||
$git_work_tree = Win32::GetCwd();
|
|
||||||
$git_work_tree =~ tr/\\/\//;
|
|
||||||
} else {
|
|
||||||
require Cwd;
|
|
||||||
$git_work_tree = Cwd::cwd();
|
|
||||||
}
|
|
||||||
|
|
||||||
my $retry = 1;
|
|
||||||
|
|
||||||
launch_watchman();
|
|
||||||
|
|
||||||
sub launch_watchman {
|
|
||||||
|
|
||||||
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 $time but were not transient (ie created after
|
|
||||||
# $time but no longer exist).
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
# The category of transient files that we want to ignore will have a
|
|
||||||
# creation clock (cclock) newer than $time_t value and will also not
|
|
||||||
# currently exist.
|
|
||||||
|
|
||||||
my $query = <<" END";
|
|
||||||
["query", "$git_work_tree", {
|
|
||||||
"since": $time,
|
|
||||||
"fields": ["name"],
|
|
||||||
"expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]]
|
|
||||||
}]
|
|
||||||
END
|
|
||||||
|
|
||||||
print CHLD_IN $query;
|
|
||||||
close CHLD_IN;
|
|
||||||
my $response = do {local $/; <CHLD_OUT>};
|
|
||||||
|
|
||||||
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 =~ /^\{/;
|
|
||||||
|
|
||||||
my $json_pkg;
|
|
||||||
eval {
|
|
||||||
require JSON::XS;
|
|
||||||
$json_pkg = "JSON::XS";
|
|
||||||
1;
|
|
||||||
} or do {
|
|
||||||
require JSON::PP;
|
|
||||||
$json_pkg = "JSON::PP";
|
|
||||||
};
|
|
||||||
|
|
||||||
my $o = $json_pkg->new->utf8->decode($response);
|
|
||||||
|
|
||||||
if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) {
|
|
||||||
print STDERR "Adding '$git_work_tree' to watchman's watch list.\n";
|
|
||||||
$retry--;
|
|
||||||
qx/watchman watch "$git_work_tree"/;
|
|
||||||
die "Failed to make watchman watch '$git_work_tree'.\n" .
|
|
||||||
"Falling back to scanning...\n" if $? != 0;
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
print "/\0";
|
|
||||||
eval { launch_watchman() };
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
die "Watchman: $o->{error}.\n" .
|
|
||||||
"Falling back to scanning...\n" if $o->{error};
|
|
||||||
|
|
||||||
binmode STDOUT, ":utf8";
|
|
||||||
local $, = "\0";
|
|
||||||
print @{$o->{files}};
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/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+"$@"}
|
|
||||||
:
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/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 --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 --
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006, 2008 Junio C Hamano
|
|
||||||
#
|
|
||||||
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
|
||||||
# its job, and can prevent the command from running by exiting with
|
|
||||||
# non-zero status.
|
|
||||||
#
|
|
||||||
# The hook is called with the following parameters:
|
|
||||||
#
|
|
||||||
# $1 -- the upstream the series was forked from.
|
|
||||||
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
|
||||||
#
|
|
||||||
# This sample shows how to prevent topic branches that are already
|
|
||||||
# merged to 'next' branch from getting rebased, because allowing it
|
|
||||||
# would result in rebasing already published history.
|
|
||||||
|
|
||||||
publish=next
|
|
||||||
basebranch="$1"
|
|
||||||
if test "$#" = 2
|
|
||||||
then
|
|
||||||
topic="refs/heads/$2"
|
|
||||||
else
|
|
||||||
topic=`git symbolic-ref HEAD` ||
|
|
||||||
exit 0 ;# we do not interrupt rebasing detached HEAD
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$topic" in
|
|
||||||
refs/heads/??/*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit 0 ;# we do not interrupt others.
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Now we are dealing with a topic branch being rebased
|
|
||||||
# on top of master. Is it OK to rebase it?
|
|
||||||
|
|
||||||
# Does the topic really exist?
|
|
||||||
git show-ref -q "$topic" || {
|
|
||||||
echo >&2 "No such branch $topic"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Is topic fully merged to master?
|
|
||||||
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
|
||||||
if test -z "$not_in_master"
|
|
||||||
then
|
|
||||||
echo >&2 "$topic is fully merged to master; better remove it."
|
|
||||||
exit 1 ;# we could allow it, but there is no point.
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Is topic ever merged to next? If so you should not be rebasing it.
|
|
||||||
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
|
||||||
only_next_2=`git rev-list ^master ${publish} | sort`
|
|
||||||
if test "$only_next_1" = "$only_next_2"
|
|
||||||
then
|
|
||||||
not_in_topic=`git rev-list "^$topic" master`
|
|
||||||
if test -z "$not_in_topic"
|
|
||||||
then
|
|
||||||
echo >&2 "$topic is already up to date with master"
|
|
||||||
exit 1 ;# we could allow it, but there is no point.
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
|
||||||
/usr/bin/perl -e '
|
|
||||||
my $topic = $ARGV[0];
|
|
||||||
my $msg = "* $topic has commits already merged to public branch:\n";
|
|
||||||
my (%not_in_next) = map {
|
|
||||||
/^([0-9a-f]+) /;
|
|
||||||
($1 => 1);
|
|
||||||
} split(/\n/, $ARGV[1]);
|
|
||||||
for my $elem (map {
|
|
||||||
/^([0-9a-f]+) (.*)$/;
|
|
||||||
[$1 => $2];
|
|
||||||
} split(/\n/, $ARGV[2])) {
|
|
||||||
if (!exists $not_in_next{$elem->[0]}) {
|
|
||||||
if ($msg) {
|
|
||||||
print STDERR $msg;
|
|
||||||
undef $msg;
|
|
||||||
}
|
|
||||||
print STDERR " $elem->[1]\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
' "$topic" "$not_in_next" "$not_in_master"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
<<\DOC_END
|
|
||||||
|
|
||||||
This sample hook safeguards topic branches that have been
|
|
||||||
published from being rewound.
|
|
||||||
|
|
||||||
The workflow assumed here is:
|
|
||||||
|
|
||||||
* Once a topic branch forks from "master", "master" is never
|
|
||||||
merged into it again (either directly or indirectly).
|
|
||||||
|
|
||||||
* Once a topic branch is fully cooked and merged into "master",
|
|
||||||
it is deleted. If you need to build on top of it to correct
|
|
||||||
earlier mistakes, a new topic branch is created by forking at
|
|
||||||
the tip of the "master". This is not strictly necessary, but
|
|
||||||
it makes it easier to keep your history simple.
|
|
||||||
|
|
||||||
* Whenever you need to test or publish your changes to topic
|
|
||||||
branches, merge them into "next" branch.
|
|
||||||
|
|
||||||
The script, being an example, hardcodes the publish branch name
|
|
||||||
to be "next", but it is trivial to make it configurable via
|
|
||||||
$GIT_DIR/config mechanism.
|
|
||||||
|
|
||||||
With this workflow, you would want to know:
|
|
||||||
|
|
||||||
(1) ... if a topic branch has ever been merged to "next". Young
|
|
||||||
topic branches can have stupid mistakes you would rather
|
|
||||||
clean up before publishing, and things that have not been
|
|
||||||
merged into other branches can be easily rebased without
|
|
||||||
affecting other people. But once it is published, you would
|
|
||||||
not want to rewind it.
|
|
||||||
|
|
||||||
(2) ... if a topic branch has been fully merged to "master".
|
|
||||||
Then you can delete it. More importantly, you should not
|
|
||||||
build on top of it -- other people may already want to
|
|
||||||
change things related to the topic as patches against your
|
|
||||||
"master", so if you need further changes, it is better to
|
|
||||||
fork the topic (perhaps with the same name) afresh from the
|
|
||||||
tip of "master".
|
|
||||||
|
|
||||||
Let's look at this example:
|
|
||||||
|
|
||||||
o---o---o---o---o---o---o---o---o---o "next"
|
|
||||||
/ / / /
|
|
||||||
/ a---a---b A / /
|
|
||||||
/ / / /
|
|
||||||
/ / c---c---c---c B /
|
|
||||||
/ / / \ /
|
|
||||||
/ / / b---b C \ /
|
|
||||||
/ / / / \ /
|
|
||||||
---o---o---o---o---o---o---o---o---o---o---o "master"
|
|
||||||
|
|
||||||
|
|
||||||
A, B and C are topic branches.
|
|
||||||
|
|
||||||
* A has one fix since it was merged up to "next".
|
|
||||||
|
|
||||||
* B has finished. It has been fully merged up to "master" and "next",
|
|
||||||
and is ready to be deleted.
|
|
||||||
|
|
||||||
* C has not merged to "next" at all.
|
|
||||||
|
|
||||||
We would want to allow C to be rebased, refuse A, and encourage
|
|
||||||
B to be deleted.
|
|
||||||
|
|
||||||
To compute (1):
|
|
||||||
|
|
||||||
git rev-list ^master ^topic next
|
|
||||||
git rev-list ^master next
|
|
||||||
|
|
||||||
if these match, topic has not merged in next at all.
|
|
||||||
|
|
||||||
To compute (2):
|
|
||||||
|
|
||||||
git rev-list master..topic
|
|
||||||
|
|
||||||
if this is empty, it is fully merged to "master".
|
|
||||||
|
|
||||||
DOC_END
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to make use of push options.
|
|
||||||
# The example simply echoes all push options that start with 'echoback='
|
|
||||||
# and rejects all pushes when the "reject" push option is used.
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "pre-receive".
|
|
||||||
|
|
||||||
if test -n "$GIT_PUSH_OPTION_COUNT"
|
|
||||||
then
|
|
||||||
i=0
|
|
||||||
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
|
|
||||||
do
|
|
||||||
eval "value=\$GIT_PUSH_OPTION_$i"
|
|
||||||
case "$value" in
|
|
||||||
echoback=*)
|
|
||||||
echo "echo from the pre-receive-hook: ${value#*=}" >&2
|
|
||||||
;;
|
|
||||||
reject)
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to prepare the commit log message.
|
|
||||||
# Called by "git commit" with the name of the file that has the
|
|
||||||
# commit message, followed by the description of the commit
|
|
||||||
# message's source. The hook's purpose is to edit the commit
|
|
||||||
# message file. If the hook fails with a non-zero status,
|
|
||||||
# the commit is aborted.
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "prepare-commit-msg".
|
|
||||||
|
|
||||||
# This hook includes three examples. The first one removes the
|
|
||||||
# "# Please enter the commit message..." help message.
|
|
||||||
#
|
|
||||||
# The second includes the output of "git diff --name-status -r"
|
|
||||||
# into the message, just before the "git status" output. It is
|
|
||||||
# commented because it doesn't cope with --amend or with squashed
|
|
||||||
# commits.
|
|
||||||
#
|
|
||||||
# The third example adds a Signed-off-by line to the message, that can
|
|
||||||
# still be edited. This is rarely a good idea.
|
|
||||||
|
|
||||||
COMMIT_MSG_FILE=$1
|
|
||||||
COMMIT_SOURCE=$2
|
|
||||||
SHA1=$3
|
|
||||||
|
|
||||||
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
|
|
||||||
|
|
||||||
# case "$COMMIT_SOURCE,$SHA1" in
|
|
||||||
# ,|template,)
|
|
||||||
# /usr/bin/perl -i.bak -pe '
|
|
||||||
# print "\n" . `git diff --cached --name-status -r`
|
|
||||||
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
|
|
||||||
# *) ;;
|
|
||||||
# esac
|
|
||||||
|
|
||||||
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
|
||||||
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
|
|
||||||
# if test -z "$COMMIT_SOURCE"
|
|
||||||
# then
|
|
||||||
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
|
|
||||||
# fi
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to block unannotated tags from entering.
|
|
||||||
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "update".
|
|
||||||
#
|
|
||||||
# Config
|
|
||||||
# ------
|
|
||||||
# hooks.allowunannotated
|
|
||||||
# This boolean sets whether unannotated tags will be allowed into the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.allowdeletetag
|
|
||||||
# This boolean sets whether deleting tags will be allowed in the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.allowmodifytag
|
|
||||||
# This boolean sets whether a tag may be modified after creation. By default
|
|
||||||
# it won't be.
|
|
||||||
# hooks.allowdeletebranch
|
|
||||||
# This boolean sets whether deleting branches will be allowed in the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.denycreatebranch
|
|
||||||
# This boolean sets whether remotely creating branches will be denied
|
|
||||||
# in the repository. By default this is allowed.
|
|
||||||
#
|
|
||||||
|
|
||||||
# --- Command line
|
|
||||||
refname="$1"
|
|
||||||
oldrev="$2"
|
|
||||||
newrev="$3"
|
|
||||||
|
|
||||||
# --- Safety check
|
|
||||||
if [ -z "$GIT_DIR" ]; then
|
|
||||||
echo "Don't run this script from the command line." >&2
|
|
||||||
echo " (if you want, you could supply GIT_DIR then run" >&2
|
|
||||||
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
|
||||||
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- Config
|
|
||||||
allowunannotated=$(git config --bool hooks.allowunannotated)
|
|
||||||
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
|
||||||
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
|
||||||
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
|
||||||
allowmodifytag=$(git config --bool hooks.allowmodifytag)
|
|
||||||
|
|
||||||
# check for no description
|
|
||||||
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
|
||||||
case "$projectdesc" in
|
|
||||||
"Unnamed repository"* | "")
|
|
||||||
echo "*** Project description file hasn't been set" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# --- Check types
|
|
||||||
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
|
||||||
zero="0000000000000000000000000000000000000000"
|
|
||||||
if [ "$newrev" = "$zero" ]; then
|
|
||||||
newrev_type=delete
|
|
||||||
else
|
|
||||||
newrev_type=$(git cat-file -t $newrev)
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$refname","$newrev_type" in
|
|
||||||
refs/tags/*,commit)
|
|
||||||
# un-annotated tag
|
|
||||||
short_refname=${refname##refs/tags/}
|
|
||||||
if [ "$allowunannotated" != "true" ]; then
|
|
||||||
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
|
||||||
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/tags/*,delete)
|
|
||||||
# delete tag
|
|
||||||
if [ "$allowdeletetag" != "true" ]; then
|
|
||||||
echo "*** Deleting a tag is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/tags/*,tag)
|
|
||||||
# annotated tag
|
|
||||||
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
echo "*** Tag '$refname' already exists." >&2
|
|
||||||
echo "*** Modifying a tag is not allowed in this repository." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/heads/*,commit)
|
|
||||||
# branch
|
|
||||||
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
|
||||||
echo "*** Creating a branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/heads/*,delete)
|
|
||||||
# delete branch
|
|
||||||
if [ "$allowdeletebranch" != "true" ]; then
|
|
||||||
echo "*** Deleting a branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/remotes/*,commit)
|
|
||||||
# tracking branch
|
|
||||||
;;
|
|
||||||
refs/remotes/*,delete)
|
|
||||||
# delete tracking branch
|
|
||||||
if [ "$allowdeletebranch" != "true" ]; then
|
|
||||||
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Anything else (is there anything else?)
|
|
||||||
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# --- Finished
|
|
||||||
exit 0
|
|
||||||
Binary file not shown.
@@ -1,6 +0,0 @@
|
|||||||
# git ls-files --others --exclude-from=.git/info/exclude
|
|
||||||
# Lines that start with '#' are comments.
|
|
||||||
# For a project mostly in C, the following would be a good set of
|
|
||||||
# exclude patterns (uncomment them if you want to use them):
|
|
||||||
# *.[oa]
|
|
||||||
# *~
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 ebaf409002be498a681267a75f5efcaf45cd0ccc Andrey Anurin <svxf@yandex-team.ru> 1534073685 +0300 clone: from https://github.com/zsh-users/zsh-autosuggestions.git
|
|
||||||
ebaf409002be498a681267a75f5efcaf45cd0ccc d7c796719e6352666f7a9c94da9ddaed10f3217d Andrey Anurin <svxf@yandex-team.ru> 1534073716 +0300 checkout: moving from master to d7c796719e6352666f7a9c94da9ddaed10f3217d
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 ebaf409002be498a681267a75f5efcaf45cd0ccc Andrey Anurin <svxf@yandex-team.ru> 1534073685 +0300 clone: from https://github.com/zsh-users/zsh-autosuggestions.git
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 ebaf409002be498a681267a75f5efcaf45cd0ccc Andrey Anurin <svxf@yandex-team.ru> 1534073685 +0300 clone: from https://github.com/zsh-users/zsh-autosuggestions.git
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,37 +0,0 @@
|
|||||||
# pack-refs with: peeled fully-peeled sorted
|
|
||||||
fa5d9c0ff5fb202545e12c98dae086d91d70ba50 refs/remotes/origin/develop
|
|
||||||
1ec43c7291db3327391360e466907329b36c6770 refs/remotes/origin/features/completion-suggestions
|
|
||||||
9fb96753069b919deaaacb6f659be2339dfeb4d2 refs/remotes/origin/fixes/slow_bracketed_paste_magic
|
|
||||||
df0f27b3a1404ba7e4210d6038c48194faf992e5 refs/remotes/origin/fixes/vi-delete
|
|
||||||
ebaf409002be498a681267a75f5efcaf45cd0ccc refs/remotes/origin/master
|
|
||||||
20c0ea841bafa78d8fb75c767e780248bfdf11a4 refs/remotes/origin/no-server
|
|
||||||
5f13490bae58bc42045b2a19fc3e446df75417a5 refs/tags/0.0.1
|
|
||||||
7dc9e0f92631d03d289bdcf67530c84e72b18aa3 refs/tags/pre-v0.1.0
|
|
||||||
6a4b2b386534461d479155c7f9503b1063800398 refs/tags/v0.1.0
|
|
||||||
f154d25fb3b734235bff7d508d885e7db851c4ca refs/tags/v0.1.1
|
|
||||||
0ae590729428a0b6aea682a04d74404a124cb909 refs/tags/v0.2.0
|
|
||||||
31452887d20069d882e31eafaf46890e6500b4af refs/tags/v0.2.1
|
|
||||||
2b449a62f8b6fc69e44db3eaf46c5c36c1853bfa refs/tags/v0.2.10
|
|
||||||
ba029e83d0aa2d859d7ac46299462fa5b5a43a68 refs/tags/v0.2.11
|
|
||||||
aa859a282dddf97cadce45255fad95930fc3f503 refs/tags/v0.2.12
|
|
||||||
2a5791710a9038ad21b9f528e6923f33fe3b8edd refs/tags/v0.2.13
|
|
||||||
9d100f4f321000b80b73638a6406e8486c35ce16 refs/tags/v0.2.14
|
|
||||||
c761dc81509b137748190d254e8beb6845dedf21 refs/tags/v0.2.15
|
|
||||||
0a42f872b84ecdd17b2d4d4e4422f3af8bf8959b refs/tags/v0.2.16
|
|
||||||
f0a745576ff69fa608421ee7214d4cd77b43e62f refs/tags/v0.2.17
|
|
||||||
011f5420fcc61d1c8fdd7510c4b560b0ca7f6412 refs/tags/v0.2.2
|
|
||||||
266437c98a7e3d9b24fa82e6a35d8dc54946f1d2 refs/tags/v0.2.3
|
|
||||||
cd71081303287498f940e6158cfce13583d4293f refs/tags/v0.2.4
|
|
||||||
76f415bf4360705a819c92787b188ddd813d374c refs/tags/v0.2.5
|
|
||||||
3ce1adb55dfb558c7f9b60056356fdb7d3567403 refs/tags/v0.2.6
|
|
||||||
45ab49d1f2024f9422ab9eb41178e4d9edf2e91c refs/tags/v0.2.7
|
|
||||||
dd9a8789a758966eed6943adad5338b2213df4a2 refs/tags/v0.2.8
|
|
||||||
0faa2b6584928a17fef8904e8439d1268729f37a refs/tags/v0.2.9
|
|
||||||
1ed9155f89956310eb0cfce59f95e6f3e2ecbcd2 refs/tags/v0.3.0
|
|
||||||
87facd9b85630f288433aa0a20a963cffc612ee5 refs/tags/v0.3.1
|
|
||||||
cce68de46d37697f561a23c51db629ee2bbd18db refs/tags/v0.3.2
|
|
||||||
9cfaf5d3424ceb5fedd2c7e3253f823faae74383 refs/tags/v0.3.3
|
|
||||||
2cb6eb6e29852e64a146b0284275ecdc0661b082 refs/tags/v0.4.0
|
|
||||||
9f9237ab8a530eeff389161202bbc7283ad6af3e refs/tags/v0.4.1
|
|
||||||
15931f04ffac91a2f9a1a044b6b3ee4050751064 refs/tags/v0.4.2
|
|
||||||
d7c796719e6352666f7a9c94da9ddaed10f3217d refs/tags/v0.4.3
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
ebaf409002be498a681267a75f5efcaf45cd0ccc
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
ref: refs/remotes/origin/master
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
7ec52769d3a0dd505d33d857511866d2b90d0eec
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[core]
|
|
||||||
repositoryformatversion = 0
|
|
||||||
filemode = true
|
|
||||||
bare = false
|
|
||||||
logallrefupdates = true
|
|
||||||
ignorecase = true
|
|
||||||
precomposeunicode = true
|
|
||||||
worktree = ../../../../../modules/completion/external
|
|
||||||
[remote "origin"]
|
|
||||||
url = https://github.com/zsh-users/zsh-completions.git
|
|
||||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
||||||
[branch "master"]
|
|
||||||
remote = origin
|
|
||||||
merge = refs/heads/master
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Unnamed repository; edit this file 'description' to name the repository.
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/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+"$@"}
|
|
||||||
:
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/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
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
#!/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 1) and a time in nanoseconds
|
|
||||||
# formatted as a string and outputs to stdout all files that have been
|
|
||||||
# modified since the given time. 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, $time) = @ARGV;
|
|
||||||
|
|
||||||
# Check the hook interface version
|
|
||||||
|
|
||||||
if ($version == 1) {
|
|
||||||
# convert nanoseconds to seconds
|
|
||||||
$time = int $time / 1000000000;
|
|
||||||
} else {
|
|
||||||
die "Unsupported query-fsmonitor hook version '$version'.\n" .
|
|
||||||
"Falling back to scanning...\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
my $git_work_tree;
|
|
||||||
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
|
|
||||||
$git_work_tree = Win32::GetCwd();
|
|
||||||
$git_work_tree =~ tr/\\/\//;
|
|
||||||
} else {
|
|
||||||
require Cwd;
|
|
||||||
$git_work_tree = Cwd::cwd();
|
|
||||||
}
|
|
||||||
|
|
||||||
my $retry = 1;
|
|
||||||
|
|
||||||
launch_watchman();
|
|
||||||
|
|
||||||
sub launch_watchman {
|
|
||||||
|
|
||||||
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 $time but were not transient (ie created after
|
|
||||||
# $time but no longer exist).
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
# The category of transient files that we want to ignore will have a
|
|
||||||
# creation clock (cclock) newer than $time_t value and will also not
|
|
||||||
# currently exist.
|
|
||||||
|
|
||||||
my $query = <<" END";
|
|
||||||
["query", "$git_work_tree", {
|
|
||||||
"since": $time,
|
|
||||||
"fields": ["name"],
|
|
||||||
"expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]]
|
|
||||||
}]
|
|
||||||
END
|
|
||||||
|
|
||||||
print CHLD_IN $query;
|
|
||||||
close CHLD_IN;
|
|
||||||
my $response = do {local $/; <CHLD_OUT>};
|
|
||||||
|
|
||||||
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 =~ /^\{/;
|
|
||||||
|
|
||||||
my $json_pkg;
|
|
||||||
eval {
|
|
||||||
require JSON::XS;
|
|
||||||
$json_pkg = "JSON::XS";
|
|
||||||
1;
|
|
||||||
} or do {
|
|
||||||
require JSON::PP;
|
|
||||||
$json_pkg = "JSON::PP";
|
|
||||||
};
|
|
||||||
|
|
||||||
my $o = $json_pkg->new->utf8->decode($response);
|
|
||||||
|
|
||||||
if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) {
|
|
||||||
print STDERR "Adding '$git_work_tree' to watchman's watch list.\n";
|
|
||||||
$retry--;
|
|
||||||
qx/watchman watch "$git_work_tree"/;
|
|
||||||
die "Failed to make watchman watch '$git_work_tree'.\n" .
|
|
||||||
"Falling back to scanning...\n" if $? != 0;
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
print "/\0";
|
|
||||||
eval { launch_watchman() };
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
die "Watchman: $o->{error}.\n" .
|
|
||||||
"Falling back to scanning...\n" if $o->{error};
|
|
||||||
|
|
||||||
binmode STDOUT, ":utf8";
|
|
||||||
local $, = "\0";
|
|
||||||
print @{$o->{files}};
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/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+"$@"}
|
|
||||||
:
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/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 --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 --
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006, 2008 Junio C Hamano
|
|
||||||
#
|
|
||||||
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
|
||||||
# its job, and can prevent the command from running by exiting with
|
|
||||||
# non-zero status.
|
|
||||||
#
|
|
||||||
# The hook is called with the following parameters:
|
|
||||||
#
|
|
||||||
# $1 -- the upstream the series was forked from.
|
|
||||||
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
|
||||||
#
|
|
||||||
# This sample shows how to prevent topic branches that are already
|
|
||||||
# merged to 'next' branch from getting rebased, because allowing it
|
|
||||||
# would result in rebasing already published history.
|
|
||||||
|
|
||||||
publish=next
|
|
||||||
basebranch="$1"
|
|
||||||
if test "$#" = 2
|
|
||||||
then
|
|
||||||
topic="refs/heads/$2"
|
|
||||||
else
|
|
||||||
topic=`git symbolic-ref HEAD` ||
|
|
||||||
exit 0 ;# we do not interrupt rebasing detached HEAD
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$topic" in
|
|
||||||
refs/heads/??/*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit 0 ;# we do not interrupt others.
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Now we are dealing with a topic branch being rebased
|
|
||||||
# on top of master. Is it OK to rebase it?
|
|
||||||
|
|
||||||
# Does the topic really exist?
|
|
||||||
git show-ref -q "$topic" || {
|
|
||||||
echo >&2 "No such branch $topic"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Is topic fully merged to master?
|
|
||||||
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
|
||||||
if test -z "$not_in_master"
|
|
||||||
then
|
|
||||||
echo >&2 "$topic is fully merged to master; better remove it."
|
|
||||||
exit 1 ;# we could allow it, but there is no point.
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Is topic ever merged to next? If so you should not be rebasing it.
|
|
||||||
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
|
||||||
only_next_2=`git rev-list ^master ${publish} | sort`
|
|
||||||
if test "$only_next_1" = "$only_next_2"
|
|
||||||
then
|
|
||||||
not_in_topic=`git rev-list "^$topic" master`
|
|
||||||
if test -z "$not_in_topic"
|
|
||||||
then
|
|
||||||
echo >&2 "$topic is already up to date with master"
|
|
||||||
exit 1 ;# we could allow it, but there is no point.
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
|
||||||
/usr/bin/perl -e '
|
|
||||||
my $topic = $ARGV[0];
|
|
||||||
my $msg = "* $topic has commits already merged to public branch:\n";
|
|
||||||
my (%not_in_next) = map {
|
|
||||||
/^([0-9a-f]+) /;
|
|
||||||
($1 => 1);
|
|
||||||
} split(/\n/, $ARGV[1]);
|
|
||||||
for my $elem (map {
|
|
||||||
/^([0-9a-f]+) (.*)$/;
|
|
||||||
[$1 => $2];
|
|
||||||
} split(/\n/, $ARGV[2])) {
|
|
||||||
if (!exists $not_in_next{$elem->[0]}) {
|
|
||||||
if ($msg) {
|
|
||||||
print STDERR $msg;
|
|
||||||
undef $msg;
|
|
||||||
}
|
|
||||||
print STDERR " $elem->[1]\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
' "$topic" "$not_in_next" "$not_in_master"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
<<\DOC_END
|
|
||||||
|
|
||||||
This sample hook safeguards topic branches that have been
|
|
||||||
published from being rewound.
|
|
||||||
|
|
||||||
The workflow assumed here is:
|
|
||||||
|
|
||||||
* Once a topic branch forks from "master", "master" is never
|
|
||||||
merged into it again (either directly or indirectly).
|
|
||||||
|
|
||||||
* Once a topic branch is fully cooked and merged into "master",
|
|
||||||
it is deleted. If you need to build on top of it to correct
|
|
||||||
earlier mistakes, a new topic branch is created by forking at
|
|
||||||
the tip of the "master". This is not strictly necessary, but
|
|
||||||
it makes it easier to keep your history simple.
|
|
||||||
|
|
||||||
* Whenever you need to test or publish your changes to topic
|
|
||||||
branches, merge them into "next" branch.
|
|
||||||
|
|
||||||
The script, being an example, hardcodes the publish branch name
|
|
||||||
to be "next", but it is trivial to make it configurable via
|
|
||||||
$GIT_DIR/config mechanism.
|
|
||||||
|
|
||||||
With this workflow, you would want to know:
|
|
||||||
|
|
||||||
(1) ... if a topic branch has ever been merged to "next". Young
|
|
||||||
topic branches can have stupid mistakes you would rather
|
|
||||||
clean up before publishing, and things that have not been
|
|
||||||
merged into other branches can be easily rebased without
|
|
||||||
affecting other people. But once it is published, you would
|
|
||||||
not want to rewind it.
|
|
||||||
|
|
||||||
(2) ... if a topic branch has been fully merged to "master".
|
|
||||||
Then you can delete it. More importantly, you should not
|
|
||||||
build on top of it -- other people may already want to
|
|
||||||
change things related to the topic as patches against your
|
|
||||||
"master", so if you need further changes, it is better to
|
|
||||||
fork the topic (perhaps with the same name) afresh from the
|
|
||||||
tip of "master".
|
|
||||||
|
|
||||||
Let's look at this example:
|
|
||||||
|
|
||||||
o---o---o---o---o---o---o---o---o---o "next"
|
|
||||||
/ / / /
|
|
||||||
/ a---a---b A / /
|
|
||||||
/ / / /
|
|
||||||
/ / c---c---c---c B /
|
|
||||||
/ / / \ /
|
|
||||||
/ / / b---b C \ /
|
|
||||||
/ / / / \ /
|
|
||||||
---o---o---o---o---o---o---o---o---o---o---o "master"
|
|
||||||
|
|
||||||
|
|
||||||
A, B and C are topic branches.
|
|
||||||
|
|
||||||
* A has one fix since it was merged up to "next".
|
|
||||||
|
|
||||||
* B has finished. It has been fully merged up to "master" and "next",
|
|
||||||
and is ready to be deleted.
|
|
||||||
|
|
||||||
* C has not merged to "next" at all.
|
|
||||||
|
|
||||||
We would want to allow C to be rebased, refuse A, and encourage
|
|
||||||
B to be deleted.
|
|
||||||
|
|
||||||
To compute (1):
|
|
||||||
|
|
||||||
git rev-list ^master ^topic next
|
|
||||||
git rev-list ^master next
|
|
||||||
|
|
||||||
if these match, topic has not merged in next at all.
|
|
||||||
|
|
||||||
To compute (2):
|
|
||||||
|
|
||||||
git rev-list master..topic
|
|
||||||
|
|
||||||
if this is empty, it is fully merged to "master".
|
|
||||||
|
|
||||||
DOC_END
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to make use of push options.
|
|
||||||
# The example simply echoes all push options that start with 'echoback='
|
|
||||||
# and rejects all pushes when the "reject" push option is used.
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "pre-receive".
|
|
||||||
|
|
||||||
if test -n "$GIT_PUSH_OPTION_COUNT"
|
|
||||||
then
|
|
||||||
i=0
|
|
||||||
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
|
|
||||||
do
|
|
||||||
eval "value=\$GIT_PUSH_OPTION_$i"
|
|
||||||
case "$value" in
|
|
||||||
echoback=*)
|
|
||||||
echo "echo from the pre-receive-hook: ${value#*=}" >&2
|
|
||||||
;;
|
|
||||||
reject)
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to prepare the commit log message.
|
|
||||||
# Called by "git commit" with the name of the file that has the
|
|
||||||
# commit message, followed by the description of the commit
|
|
||||||
# message's source. The hook's purpose is to edit the commit
|
|
||||||
# message file. If the hook fails with a non-zero status,
|
|
||||||
# the commit is aborted.
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "prepare-commit-msg".
|
|
||||||
|
|
||||||
# This hook includes three examples. The first one removes the
|
|
||||||
# "# Please enter the commit message..." help message.
|
|
||||||
#
|
|
||||||
# The second includes the output of "git diff --name-status -r"
|
|
||||||
# into the message, just before the "git status" output. It is
|
|
||||||
# commented because it doesn't cope with --amend or with squashed
|
|
||||||
# commits.
|
|
||||||
#
|
|
||||||
# The third example adds a Signed-off-by line to the message, that can
|
|
||||||
# still be edited. This is rarely a good idea.
|
|
||||||
|
|
||||||
COMMIT_MSG_FILE=$1
|
|
||||||
COMMIT_SOURCE=$2
|
|
||||||
SHA1=$3
|
|
||||||
|
|
||||||
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
|
|
||||||
|
|
||||||
# case "$COMMIT_SOURCE,$SHA1" in
|
|
||||||
# ,|template,)
|
|
||||||
# /usr/bin/perl -i.bak -pe '
|
|
||||||
# print "\n" . `git diff --cached --name-status -r`
|
|
||||||
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
|
|
||||||
# *) ;;
|
|
||||||
# esac
|
|
||||||
|
|
||||||
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
|
||||||
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
|
|
||||||
# if test -z "$COMMIT_SOURCE"
|
|
||||||
# then
|
|
||||||
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
|
|
||||||
# fi
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to block unannotated tags from entering.
|
|
||||||
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "update".
|
|
||||||
#
|
|
||||||
# Config
|
|
||||||
# ------
|
|
||||||
# hooks.allowunannotated
|
|
||||||
# This boolean sets whether unannotated tags will be allowed into the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.allowdeletetag
|
|
||||||
# This boolean sets whether deleting tags will be allowed in the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.allowmodifytag
|
|
||||||
# This boolean sets whether a tag may be modified after creation. By default
|
|
||||||
# it won't be.
|
|
||||||
# hooks.allowdeletebranch
|
|
||||||
# This boolean sets whether deleting branches will be allowed in the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.denycreatebranch
|
|
||||||
# This boolean sets whether remotely creating branches will be denied
|
|
||||||
# in the repository. By default this is allowed.
|
|
||||||
#
|
|
||||||
|
|
||||||
# --- Command line
|
|
||||||
refname="$1"
|
|
||||||
oldrev="$2"
|
|
||||||
newrev="$3"
|
|
||||||
|
|
||||||
# --- Safety check
|
|
||||||
if [ -z "$GIT_DIR" ]; then
|
|
||||||
echo "Don't run this script from the command line." >&2
|
|
||||||
echo " (if you want, you could supply GIT_DIR then run" >&2
|
|
||||||
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
|
||||||
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- Config
|
|
||||||
allowunannotated=$(git config --bool hooks.allowunannotated)
|
|
||||||
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
|
||||||
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
|
||||||
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
|
||||||
allowmodifytag=$(git config --bool hooks.allowmodifytag)
|
|
||||||
|
|
||||||
# check for no description
|
|
||||||
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
|
||||||
case "$projectdesc" in
|
|
||||||
"Unnamed repository"* | "")
|
|
||||||
echo "*** Project description file hasn't been set" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# --- Check types
|
|
||||||
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
|
||||||
zero="0000000000000000000000000000000000000000"
|
|
||||||
if [ "$newrev" = "$zero" ]; then
|
|
||||||
newrev_type=delete
|
|
||||||
else
|
|
||||||
newrev_type=$(git cat-file -t $newrev)
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$refname","$newrev_type" in
|
|
||||||
refs/tags/*,commit)
|
|
||||||
# un-annotated tag
|
|
||||||
short_refname=${refname##refs/tags/}
|
|
||||||
if [ "$allowunannotated" != "true" ]; then
|
|
||||||
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
|
||||||
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/tags/*,delete)
|
|
||||||
# delete tag
|
|
||||||
if [ "$allowdeletetag" != "true" ]; then
|
|
||||||
echo "*** Deleting a tag is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/tags/*,tag)
|
|
||||||
# annotated tag
|
|
||||||
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
echo "*** Tag '$refname' already exists." >&2
|
|
||||||
echo "*** Modifying a tag is not allowed in this repository." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/heads/*,commit)
|
|
||||||
# branch
|
|
||||||
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
|
||||||
echo "*** Creating a branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/heads/*,delete)
|
|
||||||
# delete branch
|
|
||||||
if [ "$allowdeletebranch" != "true" ]; then
|
|
||||||
echo "*** Deleting a branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/remotes/*,commit)
|
|
||||||
# tracking branch
|
|
||||||
;;
|
|
||||||
refs/remotes/*,delete)
|
|
||||||
# delete tracking branch
|
|
||||||
if [ "$allowdeletebranch" != "true" ]; then
|
|
||||||
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Anything else (is there anything else?)
|
|
||||||
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# --- Finished
|
|
||||||
exit 0
|
|
||||||
Binary file not shown.
@@ -1,6 +0,0 @@
|
|||||||
# git ls-files --others --exclude-from=.git/info/exclude
|
|
||||||
# Lines that start with '#' are comments.
|
|
||||||
# For a project mostly in C, the following would be a good set of
|
|
||||||
# exclude patterns (uncomment them if you want to use them):
|
|
||||||
# *.[oa]
|
|
||||||
# *~
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 df7e44c685c9a60d83a3760aa373d3864779aeeb Andrey Anurin <svxf@yandex-team.ru> 1534073689 +0300 clone: from https://github.com/zsh-users/zsh-completions.git
|
|
||||||
df7e44c685c9a60d83a3760aa373d3864779aeeb 7ec52769d3a0dd505d33d857511866d2b90d0eec Andrey Anurin <svxf@yandex-team.ru> 1534073716 +0300 checkout: moving from master to 7ec52769d3a0dd505d33d857511866d2b90d0eec
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 df7e44c685c9a60d83a3760aa373d3864779aeeb Andrey Anurin <svxf@yandex-team.ru> 1534073689 +0300 clone: from https://github.com/zsh-users/zsh-completions.git
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 df7e44c685c9a60d83a3760aa373d3864779aeeb Andrey Anurin <svxf@yandex-team.ru> 1534073689 +0300 clone: from https://github.com/zsh-users/zsh-completions.git
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -1,34 +0,0 @@
|
|||||||
# pack-refs with: peeled fully-peeled sorted
|
|
||||||
df7e44c685c9a60d83a3760aa373d3864779aeeb refs/remotes/origin/master
|
|
||||||
1f8a0c9d92efb2da0c476e395d5ed5050f06399b refs/tags/0.1.0
|
|
||||||
662229f6f0ce391ef7c1a41c398e28a31e847182 refs/tags/0.10.0
|
|
||||||
c75296de9cafeb360066065acbf2935964d70431 refs/tags/0.11.0
|
|
||||||
5e3151d03a91954102e8a4d661d65f9604aabbfa refs/tags/0.12.0
|
|
||||||
0e525e909316fb8e0f2a7bbb05d7bfc6fddbcfd1 refs/tags/0.13.0
|
|
||||||
173ae7249a6ab4a5b70bebb283f3f156eb79f908 refs/tags/0.14.0
|
|
||||||
6953a4f892df1095e48d43751ccaf9e3ece02190 refs/tags/0.15.0
|
|
||||||
3a2bb8781d32d05d1bf05deeeb476beb651e8272 refs/tags/0.16.0
|
|
||||||
2082c7573fc1cd393ea0b2948aff6f0bdf3798cd refs/tags/0.17.0
|
|
||||||
17743e1e174830693026d3adbba265922440f48c refs/tags/0.18.0
|
|
||||||
4195d4f6ee8f68f231766fa33285d8cfce9c1164 refs/tags/0.19.0
|
|
||||||
649c6cea337b71bd85f7b7a223bc21f810239775 refs/tags/0.2.0
|
|
||||||
9e443566686ee574b9d66e445d73fd74c3e88c5d refs/tags/0.2.1
|
|
||||||
0713143ec8ffc55da4c9f81e475cd5e21f2771f4 refs/tags/0.20.0
|
|
||||||
2d1f793d9473d1b572fe43136422a3dcc9851765 refs/tags/0.21.0
|
|
||||||
7a24a5e561a086c430ed4774cc194b3c91b3b31c refs/tags/0.22.0
|
|
||||||
72af5d08f1c07507d74103af039e98a2791fccb5 refs/tags/0.23.0
|
|
||||||
fa1c72058439015e74b914325f43cfca94866f1f refs/tags/0.24.0
|
|
||||||
89dcaeb5624eeceabf41cfc00e79cce35cfd722b refs/tags/0.25.0
|
|
||||||
2a30b05a5cf724a2d1c4c140c302dbf93f6aa6f6 refs/tags/0.26.0
|
|
||||||
7ec52769d3a0dd505d33d857511866d2b90d0eec refs/tags/0.27.0
|
|
||||||
acf27d00448ef62ae6901b59afc5718c829c337e refs/tags/0.3.0
|
|
||||||
^62436acb8acbc3db4993142e84b4e851ab744213
|
|
||||||
b5d080b9eefa456c7cd1ab1d61f4350fe1b23cd0 refs/tags/0.4.0
|
|
||||||
f6108b8c4250565611a08b164cfdc85e6c76ee88 refs/tags/0.5.0
|
|
||||||
3497b4841cb961e7db04e2a3bfe69b2dbec66427 refs/tags/0.5.1
|
|
||||||
d54358a43ccec2323d012192aa213a189d877156 refs/tags/0.5.2
|
|
||||||
f09394f71c27c76788785d851ab093ded1593705 refs/tags/0.6.0
|
|
||||||
b0e171924ee20e38e2ecc2dc0f3ec7edf700f2c9 refs/tags/0.6.1
|
|
||||||
9cca892132219e89299750d501d4693a98f5f5ee refs/tags/0.7.0
|
|
||||||
13715a7e50f67458b2eb2d9b4125810c3102ad94 refs/tags/0.8.0
|
|
||||||
53dd086f56f4d947be3a4b97c57f6c1f8a61900d refs/tags/0.9.0
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
df7e44c685c9a60d83a3760aa373d3864779aeeb
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
ref: refs/remotes/origin/master
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
90b531a5daaa545c74c7d98974b54cbdb92659fc
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
[core]
|
|
||||||
repositoryformatversion = 0
|
|
||||||
filemode = true
|
|
||||||
bare = false
|
|
||||||
logallrefupdates = true
|
|
||||||
ignorecase = true
|
|
||||||
precomposeunicode = true
|
|
||||||
worktree = ../../../../../modules/fasd/external
|
|
||||||
[remote "origin"]
|
|
||||||
url = https://github.com/clvv/fasd.git
|
|
||||||
fetch = +refs/heads/*:refs/remotes/origin/*
|
|
||||||
[branch "master"]
|
|
||||||
remote = origin
|
|
||||||
merge = refs/heads/master
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
Unnamed repository; edit this file 'description' to name the repository.
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/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+"$@"}
|
|
||||||
:
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/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
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
#!/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 1) and a time in nanoseconds
|
|
||||||
# formatted as a string and outputs to stdout all files that have been
|
|
||||||
# modified since the given time. 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, $time) = @ARGV;
|
|
||||||
|
|
||||||
# Check the hook interface version
|
|
||||||
|
|
||||||
if ($version == 1) {
|
|
||||||
# convert nanoseconds to seconds
|
|
||||||
$time = int $time / 1000000000;
|
|
||||||
} else {
|
|
||||||
die "Unsupported query-fsmonitor hook version '$version'.\n" .
|
|
||||||
"Falling back to scanning...\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
my $git_work_tree;
|
|
||||||
if ($^O =~ 'msys' || $^O =~ 'cygwin') {
|
|
||||||
$git_work_tree = Win32::GetCwd();
|
|
||||||
$git_work_tree =~ tr/\\/\//;
|
|
||||||
} else {
|
|
||||||
require Cwd;
|
|
||||||
$git_work_tree = Cwd::cwd();
|
|
||||||
}
|
|
||||||
|
|
||||||
my $retry = 1;
|
|
||||||
|
|
||||||
launch_watchman();
|
|
||||||
|
|
||||||
sub launch_watchman {
|
|
||||||
|
|
||||||
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 $time but were not transient (ie created after
|
|
||||||
# $time but no longer exist).
|
|
||||||
#
|
|
||||||
# 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.
|
|
||||||
#
|
|
||||||
# The category of transient files that we want to ignore will have a
|
|
||||||
# creation clock (cclock) newer than $time_t value and will also not
|
|
||||||
# currently exist.
|
|
||||||
|
|
||||||
my $query = <<" END";
|
|
||||||
["query", "$git_work_tree", {
|
|
||||||
"since": $time,
|
|
||||||
"fields": ["name"],
|
|
||||||
"expression": ["not", ["allof", ["since", $time, "cclock"], ["not", "exists"]]]
|
|
||||||
}]
|
|
||||||
END
|
|
||||||
|
|
||||||
print CHLD_IN $query;
|
|
||||||
close CHLD_IN;
|
|
||||||
my $response = do {local $/; <CHLD_OUT>};
|
|
||||||
|
|
||||||
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 =~ /^\{/;
|
|
||||||
|
|
||||||
my $json_pkg;
|
|
||||||
eval {
|
|
||||||
require JSON::XS;
|
|
||||||
$json_pkg = "JSON::XS";
|
|
||||||
1;
|
|
||||||
} or do {
|
|
||||||
require JSON::PP;
|
|
||||||
$json_pkg = "JSON::PP";
|
|
||||||
};
|
|
||||||
|
|
||||||
my $o = $json_pkg->new->utf8->decode($response);
|
|
||||||
|
|
||||||
if ($retry > 0 and $o->{error} and $o->{error} =~ m/unable to resolve root .* directory (.*) is not watched/) {
|
|
||||||
print STDERR "Adding '$git_work_tree' to watchman's watch list.\n";
|
|
||||||
$retry--;
|
|
||||||
qx/watchman watch "$git_work_tree"/;
|
|
||||||
die "Failed to make watchman watch '$git_work_tree'.\n" .
|
|
||||||
"Falling back to scanning...\n" if $? != 0;
|
|
||||||
|
|
||||||
# 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.
|
|
||||||
print "/\0";
|
|
||||||
eval { launch_watchman() };
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
die "Watchman: $o->{error}.\n" .
|
|
||||||
"Falling back to scanning...\n" if $o->{error};
|
|
||||||
|
|
||||||
binmode STDOUT, ":utf8";
|
|
||||||
local $, = "\0";
|
|
||||||
print @{$o->{files}};
|
|
||||||
}
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/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+"$@"}
|
|
||||||
:
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/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 --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 --
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
#!/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
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# Copyright (c) 2006, 2008 Junio C Hamano
|
|
||||||
#
|
|
||||||
# The "pre-rebase" hook is run just before "git rebase" starts doing
|
|
||||||
# its job, and can prevent the command from running by exiting with
|
|
||||||
# non-zero status.
|
|
||||||
#
|
|
||||||
# The hook is called with the following parameters:
|
|
||||||
#
|
|
||||||
# $1 -- the upstream the series was forked from.
|
|
||||||
# $2 -- the branch being rebased (or empty when rebasing the current branch).
|
|
||||||
#
|
|
||||||
# This sample shows how to prevent topic branches that are already
|
|
||||||
# merged to 'next' branch from getting rebased, because allowing it
|
|
||||||
# would result in rebasing already published history.
|
|
||||||
|
|
||||||
publish=next
|
|
||||||
basebranch="$1"
|
|
||||||
if test "$#" = 2
|
|
||||||
then
|
|
||||||
topic="refs/heads/$2"
|
|
||||||
else
|
|
||||||
topic=`git symbolic-ref HEAD` ||
|
|
||||||
exit 0 ;# we do not interrupt rebasing detached HEAD
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$topic" in
|
|
||||||
refs/heads/??/*)
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
exit 0 ;# we do not interrupt others.
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# Now we are dealing with a topic branch being rebased
|
|
||||||
# on top of master. Is it OK to rebase it?
|
|
||||||
|
|
||||||
# Does the topic really exist?
|
|
||||||
git show-ref -q "$topic" || {
|
|
||||||
echo >&2 "No such branch $topic"
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Is topic fully merged to master?
|
|
||||||
not_in_master=`git rev-list --pretty=oneline ^master "$topic"`
|
|
||||||
if test -z "$not_in_master"
|
|
||||||
then
|
|
||||||
echo >&2 "$topic is fully merged to master; better remove it."
|
|
||||||
exit 1 ;# we could allow it, but there is no point.
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Is topic ever merged to next? If so you should not be rebasing it.
|
|
||||||
only_next_1=`git rev-list ^master "^$topic" ${publish} | sort`
|
|
||||||
only_next_2=`git rev-list ^master ${publish} | sort`
|
|
||||||
if test "$only_next_1" = "$only_next_2"
|
|
||||||
then
|
|
||||||
not_in_topic=`git rev-list "^$topic" master`
|
|
||||||
if test -z "$not_in_topic"
|
|
||||||
then
|
|
||||||
echo >&2 "$topic is already up to date with master"
|
|
||||||
exit 1 ;# we could allow it, but there is no point.
|
|
||||||
else
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"`
|
|
||||||
/usr/bin/perl -e '
|
|
||||||
my $topic = $ARGV[0];
|
|
||||||
my $msg = "* $topic has commits already merged to public branch:\n";
|
|
||||||
my (%not_in_next) = map {
|
|
||||||
/^([0-9a-f]+) /;
|
|
||||||
($1 => 1);
|
|
||||||
} split(/\n/, $ARGV[1]);
|
|
||||||
for my $elem (map {
|
|
||||||
/^([0-9a-f]+) (.*)$/;
|
|
||||||
[$1 => $2];
|
|
||||||
} split(/\n/, $ARGV[2])) {
|
|
||||||
if (!exists $not_in_next{$elem->[0]}) {
|
|
||||||
if ($msg) {
|
|
||||||
print STDERR $msg;
|
|
||||||
undef $msg;
|
|
||||||
}
|
|
||||||
print STDERR " $elem->[1]\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
' "$topic" "$not_in_next" "$not_in_master"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
<<\DOC_END
|
|
||||||
|
|
||||||
This sample hook safeguards topic branches that have been
|
|
||||||
published from being rewound.
|
|
||||||
|
|
||||||
The workflow assumed here is:
|
|
||||||
|
|
||||||
* Once a topic branch forks from "master", "master" is never
|
|
||||||
merged into it again (either directly or indirectly).
|
|
||||||
|
|
||||||
* Once a topic branch is fully cooked and merged into "master",
|
|
||||||
it is deleted. If you need to build on top of it to correct
|
|
||||||
earlier mistakes, a new topic branch is created by forking at
|
|
||||||
the tip of the "master". This is not strictly necessary, but
|
|
||||||
it makes it easier to keep your history simple.
|
|
||||||
|
|
||||||
* Whenever you need to test or publish your changes to topic
|
|
||||||
branches, merge them into "next" branch.
|
|
||||||
|
|
||||||
The script, being an example, hardcodes the publish branch name
|
|
||||||
to be "next", but it is trivial to make it configurable via
|
|
||||||
$GIT_DIR/config mechanism.
|
|
||||||
|
|
||||||
With this workflow, you would want to know:
|
|
||||||
|
|
||||||
(1) ... if a topic branch has ever been merged to "next". Young
|
|
||||||
topic branches can have stupid mistakes you would rather
|
|
||||||
clean up before publishing, and things that have not been
|
|
||||||
merged into other branches can be easily rebased without
|
|
||||||
affecting other people. But once it is published, you would
|
|
||||||
not want to rewind it.
|
|
||||||
|
|
||||||
(2) ... if a topic branch has been fully merged to "master".
|
|
||||||
Then you can delete it. More importantly, you should not
|
|
||||||
build on top of it -- other people may already want to
|
|
||||||
change things related to the topic as patches against your
|
|
||||||
"master", so if you need further changes, it is better to
|
|
||||||
fork the topic (perhaps with the same name) afresh from the
|
|
||||||
tip of "master".
|
|
||||||
|
|
||||||
Let's look at this example:
|
|
||||||
|
|
||||||
o---o---o---o---o---o---o---o---o---o "next"
|
|
||||||
/ / / /
|
|
||||||
/ a---a---b A / /
|
|
||||||
/ / / /
|
|
||||||
/ / c---c---c---c B /
|
|
||||||
/ / / \ /
|
|
||||||
/ / / b---b C \ /
|
|
||||||
/ / / / \ /
|
|
||||||
---o---o---o---o---o---o---o---o---o---o---o "master"
|
|
||||||
|
|
||||||
|
|
||||||
A, B and C are topic branches.
|
|
||||||
|
|
||||||
* A has one fix since it was merged up to "next".
|
|
||||||
|
|
||||||
* B has finished. It has been fully merged up to "master" and "next",
|
|
||||||
and is ready to be deleted.
|
|
||||||
|
|
||||||
* C has not merged to "next" at all.
|
|
||||||
|
|
||||||
We would want to allow C to be rebased, refuse A, and encourage
|
|
||||||
B to be deleted.
|
|
||||||
|
|
||||||
To compute (1):
|
|
||||||
|
|
||||||
git rev-list ^master ^topic next
|
|
||||||
git rev-list ^master next
|
|
||||||
|
|
||||||
if these match, topic has not merged in next at all.
|
|
||||||
|
|
||||||
To compute (2):
|
|
||||||
|
|
||||||
git rev-list master..topic
|
|
||||||
|
|
||||||
if this is empty, it is fully merged to "master".
|
|
||||||
|
|
||||||
DOC_END
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to make use of push options.
|
|
||||||
# The example simply echoes all push options that start with 'echoback='
|
|
||||||
# and rejects all pushes when the "reject" push option is used.
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "pre-receive".
|
|
||||||
|
|
||||||
if test -n "$GIT_PUSH_OPTION_COUNT"
|
|
||||||
then
|
|
||||||
i=0
|
|
||||||
while test "$i" -lt "$GIT_PUSH_OPTION_COUNT"
|
|
||||||
do
|
|
||||||
eval "value=\$GIT_PUSH_OPTION_$i"
|
|
||||||
case "$value" in
|
|
||||||
echoback=*)
|
|
||||||
echo "echo from the pre-receive-hook: ${value#*=}" >&2
|
|
||||||
;;
|
|
||||||
reject)
|
|
||||||
exit 1
|
|
||||||
esac
|
|
||||||
i=$((i + 1))
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to prepare the commit log message.
|
|
||||||
# Called by "git commit" with the name of the file that has the
|
|
||||||
# commit message, followed by the description of the commit
|
|
||||||
# message's source. The hook's purpose is to edit the commit
|
|
||||||
# message file. If the hook fails with a non-zero status,
|
|
||||||
# the commit is aborted.
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "prepare-commit-msg".
|
|
||||||
|
|
||||||
# This hook includes three examples. The first one removes the
|
|
||||||
# "# Please enter the commit message..." help message.
|
|
||||||
#
|
|
||||||
# The second includes the output of "git diff --name-status -r"
|
|
||||||
# into the message, just before the "git status" output. It is
|
|
||||||
# commented because it doesn't cope with --amend or with squashed
|
|
||||||
# commits.
|
|
||||||
#
|
|
||||||
# The third example adds a Signed-off-by line to the message, that can
|
|
||||||
# still be edited. This is rarely a good idea.
|
|
||||||
|
|
||||||
COMMIT_MSG_FILE=$1
|
|
||||||
COMMIT_SOURCE=$2
|
|
||||||
SHA1=$3
|
|
||||||
|
|
||||||
/usr/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE"
|
|
||||||
|
|
||||||
# case "$COMMIT_SOURCE,$SHA1" in
|
|
||||||
# ,|template,)
|
|
||||||
# /usr/bin/perl -i.bak -pe '
|
|
||||||
# print "\n" . `git diff --cached --name-status -r`
|
|
||||||
# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;;
|
|
||||||
# *) ;;
|
|
||||||
# esac
|
|
||||||
|
|
||||||
# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p')
|
|
||||||
# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE"
|
|
||||||
# if test -z "$COMMIT_SOURCE"
|
|
||||||
# then
|
|
||||||
# /usr/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE"
|
|
||||||
# fi
|
|
||||||
@@ -1,128 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# An example hook script to block unannotated tags from entering.
|
|
||||||
# Called by "git receive-pack" with arguments: refname sha1-old sha1-new
|
|
||||||
#
|
|
||||||
# To enable this hook, rename this file to "update".
|
|
||||||
#
|
|
||||||
# Config
|
|
||||||
# ------
|
|
||||||
# hooks.allowunannotated
|
|
||||||
# This boolean sets whether unannotated tags will be allowed into the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.allowdeletetag
|
|
||||||
# This boolean sets whether deleting tags will be allowed in the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.allowmodifytag
|
|
||||||
# This boolean sets whether a tag may be modified after creation. By default
|
|
||||||
# it won't be.
|
|
||||||
# hooks.allowdeletebranch
|
|
||||||
# This boolean sets whether deleting branches will be allowed in the
|
|
||||||
# repository. By default they won't be.
|
|
||||||
# hooks.denycreatebranch
|
|
||||||
# This boolean sets whether remotely creating branches will be denied
|
|
||||||
# in the repository. By default this is allowed.
|
|
||||||
#
|
|
||||||
|
|
||||||
# --- Command line
|
|
||||||
refname="$1"
|
|
||||||
oldrev="$2"
|
|
||||||
newrev="$3"
|
|
||||||
|
|
||||||
# --- Safety check
|
|
||||||
if [ -z "$GIT_DIR" ]; then
|
|
||||||
echo "Don't run this script from the command line." >&2
|
|
||||||
echo " (if you want, you could supply GIT_DIR then run" >&2
|
|
||||||
echo " $0 <ref> <oldrev> <newrev>)" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then
|
|
||||||
echo "usage: $0 <ref> <oldrev> <newrev>" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# --- Config
|
|
||||||
allowunannotated=$(git config --bool hooks.allowunannotated)
|
|
||||||
allowdeletebranch=$(git config --bool hooks.allowdeletebranch)
|
|
||||||
denycreatebranch=$(git config --bool hooks.denycreatebranch)
|
|
||||||
allowdeletetag=$(git config --bool hooks.allowdeletetag)
|
|
||||||
allowmodifytag=$(git config --bool hooks.allowmodifytag)
|
|
||||||
|
|
||||||
# check for no description
|
|
||||||
projectdesc=$(sed -e '1q' "$GIT_DIR/description")
|
|
||||||
case "$projectdesc" in
|
|
||||||
"Unnamed repository"* | "")
|
|
||||||
echo "*** Project description file hasn't been set" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# --- Check types
|
|
||||||
# if $newrev is 0000...0000, it's a commit to delete a ref.
|
|
||||||
zero="0000000000000000000000000000000000000000"
|
|
||||||
if [ "$newrev" = "$zero" ]; then
|
|
||||||
newrev_type=delete
|
|
||||||
else
|
|
||||||
newrev_type=$(git cat-file -t $newrev)
|
|
||||||
fi
|
|
||||||
|
|
||||||
case "$refname","$newrev_type" in
|
|
||||||
refs/tags/*,commit)
|
|
||||||
# un-annotated tag
|
|
||||||
short_refname=${refname##refs/tags/}
|
|
||||||
if [ "$allowunannotated" != "true" ]; then
|
|
||||||
echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2
|
|
||||||
echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/tags/*,delete)
|
|
||||||
# delete tag
|
|
||||||
if [ "$allowdeletetag" != "true" ]; then
|
|
||||||
echo "*** Deleting a tag is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/tags/*,tag)
|
|
||||||
# annotated tag
|
|
||||||
if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1
|
|
||||||
then
|
|
||||||
echo "*** Tag '$refname' already exists." >&2
|
|
||||||
echo "*** Modifying a tag is not allowed in this repository." >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/heads/*,commit)
|
|
||||||
# branch
|
|
||||||
if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then
|
|
||||||
echo "*** Creating a branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/heads/*,delete)
|
|
||||||
# delete branch
|
|
||||||
if [ "$allowdeletebranch" != "true" ]; then
|
|
||||||
echo "*** Deleting a branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
refs/remotes/*,commit)
|
|
||||||
# tracking branch
|
|
||||||
;;
|
|
||||||
refs/remotes/*,delete)
|
|
||||||
# delete tracking branch
|
|
||||||
if [ "$allowdeletebranch" != "true" ]; then
|
|
||||||
echo "*** Deleting a tracking branch is not allowed in this repository" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
# Anything else (is there anything else?)
|
|
||||||
echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# --- Finished
|
|
||||||
exit 0
|
|
||||||
Binary file not shown.
@@ -1,6 +0,0 @@
|
|||||||
# git ls-files --others --exclude-from=.git/info/exclude
|
|
||||||
# Lines that start with '#' are comments.
|
|
||||||
# For a project mostly in C, the following would be a good set of
|
|
||||||
# exclude patterns (uncomment them if you want to use them):
|
|
||||||
# *.[oa]
|
|
||||||
# *~
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 90b531a5daaa545c74c7d98974b54cbdb92659fc Andrey Anurin <svxf@yandex-team.ru> 1534073691 +0300 clone: from https://github.com/clvv/fasd.git
|
|
||||||
90b531a5daaa545c74c7d98974b54cbdb92659fc 90b531a5daaa545c74c7d98974b54cbdb92659fc Andrey Anurin <svxf@yandex-team.ru> 1534073716 +0300 checkout: moving from master to 90b531a5daaa545c74c7d98974b54cbdb92659fc
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 90b531a5daaa545c74c7d98974b54cbdb92659fc Andrey Anurin <svxf@yandex-team.ru> 1534073691 +0300 clone: from https://github.com/clvv/fasd.git
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
0000000000000000000000000000000000000000 90b531a5daaa545c74c7d98974b54cbdb92659fc Andrey Anurin <svxf@yandex-team.ru> 1534073691 +0300 clone: from https://github.com/clvv/fasd.git
|
|
||||||
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user