| #!/bin/bash |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| function git_commitRepoChanges { |
| |
| local -a FILES |
| local -a INFO |
| local -a FILESNUM |
| local COUNT=0 |
| local STATUSOUT='' |
| local PREDICATE='' |
| local CHNGTOTAL=0 |
| local LOCATION=$(cli_checkRepoDirSource "${1}") |
| |
| |
| |
| |
| cli_checkFiles ${LOCATION} -e |
| |
| |
| cli_printMessage "`gettext "Checking changes in the working copy"`" --as-banner-line |
| |
| |
| |
| |
| |
| |
| |
| STATUSOUT="$(${COMMAND} status --porcelain ${LOCATION})" |
| |
| |
| |
| |
| |
| |
| |
| FILES[0]=$(echo "$STATUSOUT" | egrep "^[[:space:]]M") |
| FILES[1]=$(echo "$STATUSOUT" | egrep "^\?\?") |
| FILES[2]=$(echo "$STATUSOUT" | egrep "^[[:space:]]D") |
| FILES[3]=$(echo "$STATUSOUT" | egrep "^[[:space:]]A") |
| FILES[4]=$(echo "$STATUSOUT" | egrep "^(A|M|R|C)( |M|D)") |
| |
| |
| |
| INFO[0]="`gettext "Modified"`" |
| INFO[1]="`gettext "Untracked"`" |
| INFO[2]="`gettext "Deleted"`" |
| INFO[3]="`gettext "Added"`" |
| INFO[4]="`gettext "Staged"`" |
| |
| while [[ $COUNT -ne ${#FILES[*]} ]];do |
| |
| |
| if [[ "${FILES[$COUNT]}" == '' ]];then |
| FILESNUM[$COUNT]=0 |
| else |
| FILESNUM[$COUNT]=$(echo "${FILES[$COUNT]}" | wc -l) |
| fi |
| |
| |
| CHNGTOTAL=$(($CHNGTOTAL + ${FILESNUM[$COUNT]})) |
| |
| |
| |
| |
| |
| |
| |
| PREDICATE[$COUNT]=`ngettext "file in the working copy" \ |
| "files in the working copy" $((${FILESNUM[$COUNT]} + 1))` |
| |
| |
| cli_printMessage "${INFO[$COUNT]}: ${FILESNUM[$COUNT]} ${PREDICATE[$COUNT]}" --as-stdout-line |
| |
| |
| COUNT=$(($COUNT + 1)) |
| |
| done |
| |
| |
| cli_printMessage "`gettext "Do you want to stage files?"`" --as-yesornorequest-line |
| ${COMMAND} add ${LOCATION} |
| |
| |
| cli_printMessage "`gettext "Do you want to see staged files differences?"`" --as-yesornorequest-line |
| ${COMMAND} diff --staged ${LOCATION} | less |
| |
| |
| cli_printMessage "`gettext "Do you want to commit staged files differences?"`" --as-yesornorequest-line |
| ${COMMAND} commit ${LOCATION} |
| |
| |
| cli_printMessage "`gettext "Do you want to push committed files?"`" --as-yesornorequest-line |
| ${COMMAND} push |
| |
| } |