Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Adding new files referenced by gitconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
natecavanaugh committed Mar 27, 2012
1 parent 64a0408 commit 187be6f
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
14 changes: 14 additions & 0 deletions git-getm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

cur_dir=$(pwd);
branch_name="master";

if [[ $cur_dir == *-ee-* ]]; then
repo_path=$(echo $cur_dir | sed -E 's#-ee-([^/]+)/.*#-ee-\1#')
cur_dir="${cur_dir#*ee-}"
cur_dir="ee-${cur_dir%%/*}"
git show-ref --quiet "$cur_dir" && branch_name="$cur_dir"
[[ -f "$repo_path/.git/refs/heads/$cur_dir" ]] && branch_name="$cur_dir"
fi;

echo $branch_name
30 changes: 30 additions & 0 deletions git-of-interest
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/bin/bash

file_types=${2:-"*.js *.css *.jsp* *.vm *.ftl"}

ignore_folder="portal-web/test/"

to_rev=${1:-"HEAD"};
old_head=${to_rev}^;
new_head=$to_rev;

if [[ $to_rev == *..* ]]; then
old_head=${to_rev%%..*};
new_head=${to_rev#*..*};
fi

ref_spec=$old_head..$new_head;

entries=$(git log -M -C --name-only --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(cyan)<%an>%Creset' --abbrev-commit --date=relative $ref_spec -- $file_types | sed 's/^/ /')

totalstat=$(git diff --numstat --pretty='%H' --no-renames $ref_spec | grep -v "\b$ignore_folder" | xargs -0n1 echo -n | awk '{{print $3}}' | sed -e 's/^.*\.\(.*\)$/\1/' | sort | uniq -c | tr '\n' ',' | sed 's/,$//')

if [[ -z $entries ]]; then
echo "There are no changes in ${file_types// /, } across $ref_spec"
else
echo "Changes in these file types: ${file_types// /, } that you might be interested in:"

echo "$entries"
echo "---"
echo "$totalstat"
fi
27 changes: 27 additions & 0 deletions git-sync-origin
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

old_head=$(git rev-parse --short head | tr -d '\n')

msg=$(git stash save)

[[ $msg =~ ^'No local changes to save'$ ]] && stashed=0 || stashed=1

git fetch upstream && git merge upstream/$1 --ff-only && git push origin $1

new_head=$(git rev-parse --short head | tr -d '\n')

[ $old_head != $new_head ] && updated=1 || updated=0

if [[ $stashed == 1 ]]; then
git stash pop > /dev/null
fi

if [[ $updated == 1 ]]; then
echo "Updated from $old_head to $new_head ($old_head..$new_head)"
echo "---------------------------------------------------"

git of-interest $old_head..$new_head

echo "---------------------------------------------------"
echo "Updated from $old_head to $new_head ($old_head..$new_head)"
fi

0 comments on commit 187be6f

Please sign in to comment.