From 51241bee5dc8ca8a59813fb38758e4e3746bf3ad Mon Sep 17 00:00:00 2001 From: vbspam Date: Sun, 13 May 2018 18:49:57 +0200 Subject: [PATCH 1/2] Forked from gitfs+ in order to add couple of feature proposals --- src/vfs/extfs/helpers/git+ | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100755 src/vfs/extfs/helpers/git+ diff --git a/src/vfs/extfs/helpers/git+ b/src/vfs/extfs/helpers/git+ new file mode 100755 index 0000000000..66861fbf85 --- /dev/null +++ b/src/vfs/extfs/helpers/git+ @@ -0,0 +1,39 @@ +#!/bin/sh + +LANG=C +export LANG +LC_TIME=C +export LC_TIME + +umask 077 +prefix='[git]' + +gitfs_list() +{ + DATE=`date +"%b %d %H:%M"` + GIT_DIR="$2/.git" + user=`whoami` + git ls-files -v -c -m -d | sort -k 2 | uniq -f 1 | while read status fname + do + [ "$status" = "H" ] && status=" " + [ "$status" = "C" ] && status="*" + echo "-r--r--r-- 1 $user 0 0 $DATE `dirname $fname`/$prefix$status`basename $fname`" + done +} + +gitfs_copyout() +{ + printf "%s\n" "$2" > "$4" + b=`echo "$prefix"| wc -c` + b=`expr "$b" + 1` + # remove prefix from file name + echo "`dirname "$3"`/`basename "$3" | tail -c+"$b"`" >> "$4" + echo "git" >> "$4" +} + +case "$1" in + list) gitfs_list "$@" ;; + copyout) gitfs_copyout "$@" ;; + *) exit 1 ;; +esac +exit 0 From 4189c76447da0a43e3b328016a36759237bfe14c Mon Sep 17 00:00:00 2001 From: vbspam Date: Sun, 13 May 2018 18:54:55 +0200 Subject: [PATCH 2/2] Add two proposed features as Fix #1,#2 private issues. This commit is just for proposal purposes. Based on: original gitfs+ Motivation: The original MC gitfs+ browse only the local repository and shows (for me) boring stuff when file openned. Description: This modification adds two new features someone may like: - posibility to browse all commits - shows real file content instead of the 'boring stuff' Todo: - Incorporate commit comments somehow. - Browse branches - Browse remotes/branches License: MIT --- src/vfs/extfs/helpers/git+ | 61 ++++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 12 deletions(-) diff --git a/src/vfs/extfs/helpers/git+ b/src/vfs/extfs/helpers/git+ index 66861fbf85..dbca695f58 100755 --- a/src/vfs/extfs/helpers/git+ +++ b/src/vfs/extfs/helpers/git+ @@ -1,34 +1,71 @@ #!/bin/sh +#License MIT +#Author: vbspam at centrum do t cz +#Based on: original gitfs+ +#Description: The original MC gitfs+ browse only the local repository and shows (for me) boring stuff when file openned. +# This modification adds two new features someone may like: +# - posibility to browse all commits +# - shows real file content instead of the 'boring stuff' +#Todo: +# - Incorporate commit comments somehow. +# - Browse branches +# - Browse remotes/branches +# ..? +#Contains: bugs and bashisms :-) + LANG=C export LANG LC_TIME=C export LC_TIME umask 077 -prefix='[git]' +prefix='[]' + gitfs_list() { - DATE=`date +"%b %d %H:%M"` +# cd $2 + commit_date=`date +"%b %d %H:%M"` GIT_DIR="$2/.git" user=`whoami` - git ls-files -v -c -m -d | sort -k 2 | uniq -f 1 | while read status fname + git log --oneline | while read hash commit_comment do - [ "$status" = "H" ] && status=" " - [ "$status" = "C" ] && status="*" - echo "-r--r--r-- 1 $user 0 0 $DATE `dirname $fname`/$prefix$status`basename $fname`" + #echo $hash + #echo $commit_comment + git show -s --pretty="%cd" --date=format:"%b %d %H:%M" -r $hash |read commit_date + git show --no-commit-id --name-only --pretty="" -r $hash | while read commit_file + do + final_file=$hash/$commit_file +# echo $commit_date +# echo $commit_file +# echo $final_file + prefix="[$hash]" + echo "-r--r--r-- 1 $user 0 0 $commit_date `dirname $final_file`/$prefix$status`basename $final_file`" + done done + +# git ls-files -v -c -m -d | sort -k 2 | uniq -f 1 | while read status fname +# do +# [ "$status" = "H" ] && status=" " +# [ "$status" = "C" ] && status="*" +# echo "-r--r--r-- 1 $user 0 0 $DATE `dirname $fname`/$prefix$status`basename $fname`" +# done } gitfs_copyout() { - printf "%s\n" "$2" > "$4" - b=`echo "$prefix"| wc -c` - b=`expr "$b" + 1` - # remove prefix from file name - echo "`dirname "$3"`/`basename "$3" | tail -c+"$b"`" >> "$4" - echo "git" >> "$4" +# printf "$2\n" > "$4" +# b=`echo "$prefix"| wc -c` +# b=`expr "$b" + 1` +# # remove prefix from file name +# echo "`dirname "$3"`/`basename "$3" | tail -c+"$b"`" >> "$4" +# echo "git" >> "$4" + hash=`echo $3 |sed -e "s/\/.*//"` + filename=`echo $3 |sed -e "s/\[$hash\]//"|sed -e "s/$hash\///"` +# echo hash=$hash >>$4 +# echo filename=$filename >>$4 + git show $hash:$filename >>$4 } case "$1" in