Skip to content

Commit

Permalink
Use 'git <cmd>' instead of 'git-cmd'
Browse files Browse the repository at this point in the history
The only remaining user of the dash version is the '. git-sh-setup' line.

Signed-off-by: Josef 'Jeff' Sipek <[email protected]>
  • Loading branch information
jeffpc committed Feb 25, 2008
1 parent b2bf0e2 commit 703eee1
Show file tree
Hide file tree
Showing 16 changed files with 66 additions and 65 deletions.
42 changes: 21 additions & 21 deletions guilt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
# Copyright (c) Josef "Jeff" Sipek, 2006-2008
#

GUILT_VERSION="0.28"
Expand Down Expand Up @@ -30,7 +30,7 @@ SUBDIRECTORY_OK=1
#
gitver=`git --version | cut -d' ' -f3`
case "$gitver" in
1.5.*) ;; # git-config
1.5.*) ;; # git config
*) die "Unsupported version of git ($gitver)" ;;
esac

Expand Down Expand Up @@ -135,7 +135,7 @@ valid_patchname()

get_branch()
{
git-symbolic-ref HEAD | sed -e 's,^refs/heads/,,'
git symbolic-ref HEAD | sed -e 's,^refs/heads/,,'
}

verify_branch()
Expand Down Expand Up @@ -185,13 +185,13 @@ get_series()
do_make_header()
{
# we should try to work with commit objects only
if [ `git-cat-file -t "$1"` != "commit" ]; then
if [ `git cat-file -t "$1"` != "commit" ]; then
echo "Hash $1 is not a commit object" >&2
echo "Aborting..." >&2
exit 2
fi

git-cat-file -p "$1" | awk '
git cat-file -p "$1" | awk '
BEGIN{headers=1; firstline=1}
/^author / && headers {
sub(/^author +/, "");
Expand Down Expand Up @@ -329,7 +329,7 @@ pop_many_patches()
(
cd "$TOP_DIR"

git-reset --hard "$1" > /dev/null
git reset --hard "$1" > /dev/null
head -n "-$2" < "$applied" > "$applied.tmp"
mv "$applied.tmp" "$applied"
)
Expand Down Expand Up @@ -359,9 +359,9 @@ update_stack_tags()
# bottom and base hashes, and update the tags

mkdir -p `dirname "$GIT_DIR/refs/tags/${branch}_top"`
git-rev-parse HEAD > "$GIT_DIR/refs/tags/${branch}_top"
git rev-parse HEAD > "$GIT_DIR/refs/tags/${branch}_top"
head -1 < $applied | cut -d: -f1 > "$GIT_DIR/refs/tags/${branch}_bottom"
git-rev-parse $(head -1 < $applied | cut -d: -f1)^ > "$GIT_DIR/refs/tags/${branch}_base"
git rev-parse $(head -1 < $applied | cut -d: -f1)^ > "$GIT_DIR/refs/tags/${branch}_base"
else
# there are no patches applied, therefore we must remove the
# tags to old top, bottom, and base
Expand Down Expand Up @@ -390,11 +390,11 @@ push_patch()
cd "$TOP_DIR"

# apply the patch if and only if there is something to apply
if [ `git-apply --numstat "$p" | wc -l` -gt 0 ]; then
if [ `git apply --numstat "$p" | wc -l` -gt 0 ]; then
if [ "$bail_action" = abort ]; then
reject=""
fi
git-apply -C$guilt_push_diff_context --index \
git apply -C$guilt_push_diff_context --index \
$reject "$p" > /dev/null 2> "$TMP_LOG"
__push_patch_bail=$?

Expand Down Expand Up @@ -431,9 +431,9 @@ s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\(
export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"

# commit
treeish=`git-write-tree`
commitish=`git-commit-tree $treeish -p HEAD < "$TMP_MSG"`
echo $commitish > $GIT_DIR/`git-symbolic-ref HEAD`
treeish=`git write-tree`
commitish=`git commit-tree $treeish -p HEAD < "$TMP_MSG"`
echo $commitish > $GIT_DIR/`git symbolic-ref HEAD`

# mark patch as applied
echo "$commitish:$pname" >> $applied
Expand All @@ -453,7 +453,7 @@ s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\(
# usage: must_commit_first
must_commit_first()
{
[ `git-diff-files | wc -l` -eq 0 ]
[ `git diff-files | wc -l` -eq 0 ]
return $?
}

Expand Down Expand Up @@ -489,7 +489,7 @@ __refresh_patch()
cd "$TOP_DIR"
p="$GUILT_DIR/$branch/$1"

git-diff-files --name-only | (while read n; do git-update-index "$n" ; done)
git diff-files --name-only | (while read n; do git update-index "$n" ; done)

# get the patch header
do_get_full_header "$p" > "$TMP_DIFF"
Expand All @@ -499,13 +499,13 @@ __refresh_patch()
if [ ! -z "$5" ]; then
(
echo "---"
git-diff --stat $diffopts "$2"
git diff --stat $diffopts "$2"
echo ""
) >> "$TMP_DIFF"
fi

# get the new patch
git-diff $diffopts "$2" >> "$TMP_DIFF"
git diff $diffopts "$2" >> "$TMP_DIFF"

# move the new patch in
mv "$p" "$p~"
Expand All @@ -528,7 +528,7 @@ __refresh_patch()
# ..<hash> - until hash (includes hash)
# <hash1>..<hash2> - from hash to hash (inclusive)
#
# The output of this function is suitable to be passed to git-rev-list
# The output of this function is suitable to be passed to "git rev-list"
munge_hash_range()
{
case "$1" in
Expand Down Expand Up @@ -579,22 +579,22 @@ guilt_hook()
# Some constants
#

# used for: git-apply -C <val>
# used for: git apply -C <val>
guilt_push_diff_context=1

#
# Parse any part of .git/config that belongs to us
#

# autotag?
autotag=`git-config guilt.autotag`
autotag=`git config guilt.autotag`
[ -z "$autotag" ] && autotag=1

#
# The following gets run every time this file is source'd
#

TOP_DIR=`git-rev-parse --show-cdup`
TOP_DIR=`git rev-parse --show-cdup`
if [ -z "$TOP_DIR" ]; then
TOP_DIR="./"
fi
Expand Down
2 changes: 1 addition & 1 deletion guilt-add
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ if [ $# -lt 1 ]; then
usage
fi

exec git-add -- "$@"
exec git add -- "$@"
4 changes: 2 additions & 2 deletions guilt-branch
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ if [ -e "$GUILT_DIR/$newbranch" ]; then
die "Patch directory for branch \"$newbranch\" already exists."
fi

git-branch "$newbranch"
git-checkout "$newbranch"
git branch "$newbranch"
git checkout "$newbranch"

mkdir -p "$GUILT_DIR/`dirname $newbranch`"

Expand Down
4 changes: 2 additions & 2 deletions guilt-diff
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ while [ $# -ne 0 ]; do
done

if [ ! -z "$working_tree" ] ; then
git-diff
git diff
else
git-diff HEAD^
git diff HEAD^
fi
2 changes: 1 addition & 1 deletion guilt-files
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fi | while read obj patch; do
fi

IFS=' '
git-diff-tree -r $obj^ $obj | tr '\t' ' '|
git diff-tree -r $obj^ $obj | tr '\t' ' '|
while read omode nmode osha1 nsha1 st file; do
if [ -n "$opt_labels" ]; then
if [ -n "$opt_verbose" ]; then
Expand Down
8 changes: 4 additions & 4 deletions guilt-graph
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ fi
patchname="$1"

bottom=`head -1 < "$applied" | cut -d: -f1`
base=`git-rev-parse $bottom^`
base=`git rev-parse $bottom^`

if [ -z "$patchname" ]; then
top=`git-rev-parse HEAD`
top=`git rev-parse HEAD`
else
top=`grep "^[0-9a-f]\{40\}:$patchname" "$applied" | cut -d: -f1`
if [ -z "$top" ]; then
Expand All @@ -26,7 +26,7 @@ fi

getfiles()
{
git-diff-tree -r "$1^" "$1" | tr '\t' ' ' | cut -d' ' -f6
git diff-tree -r "$1^" "$1" | tr '\t' ' ' | cut -d' ' -f6
}

cache="$GUILT_DIR/$branch/.graphcache.$$"
Expand Down Expand Up @@ -58,7 +58,7 @@ while [ "$current" != "$base" ]; do
echo " \"${h:0:8}\" -> \"${current:0:8}\"; // ?"
done

current=`git-rev-parse $current^`
current=`git rev-parse $current^`
done

echo "}"
13 changes: 7 additions & 6 deletions guilt-import-commit
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ fi
echo "About to begin conversion..." >&2
echo "Current head: `cat $GIT_DIR/refs/heads/$branch`" >&2

for rev in `git-rev-list $rhash`; do
s=`git-log --pretty=oneline -1 $rev | cut -c 42-`
for rev in `git rev-list $rhash`; do
s=`git log --pretty=oneline -1 $rev | cut -c 42-`

fname=`echo $s | sed -e "s/&/and/g" -e "s/[ :]/_/g" -e "s,[/\\],-,g" \
-e "s/['\\[{}]//g" -e 's/]//g' | tr A-Z a-z`
Expand All @@ -39,7 +39,7 @@ for rev in `git-rev-list $rhash`; do
(
do_make_header $rev
echo ""
git-diff $rev^..$rev
git diff $rev^..$rev
) > $GUILT_DIR/$branch/$fname

# FIXME: grab the GIT_AUTHOR_DATE from the commit object and set the
Expand All @@ -50,9 +50,10 @@ for rev in `git-rev-list $rhash`; do

# Only reset if the commit was on this branch
if head_check $rev 2> /dev/null; then
# BEWARE: git-reset ahead! Is there a way to verify that we really
# created a patch? - We don't want to lose any history.
git-reset --hard $rev^ > /dev/null
# BEWARE: "git reset" ahead! Is there a way to verify that
# we really created a patch? - We don't want to lose any
# history.
git reset --hard $rev^ > /dev/null
elif [ -z "$warned" ]; then
echo "Warning: commit $rev is not the HEAD...preserving commit" >&2
echo "Warning: (this message is displayed only once)" >&2
Expand Down
2 changes: 1 addition & 1 deletion guilt-init
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,4 @@ cat > "$GIT_DIR/hooks/guilt/delete" <<EOF
echo "Removing patch '\$1'..."
EOF

git-config --int --replace-all guilt.autotag $autotag
git config --int --replace-all guilt.autotag $autotag
6 changes: 3 additions & 3 deletions guilt-new
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mkdir_dir=`dirname "$GUILT_DIR/$branch/$patch"`
[ ! -z "$msg" ] && printf "$msg\n\n"

# add a sign-off-by (-s)
[ "$signoff" = "t" ] && printf "Signed-off-by: `git-var GIT_COMMITTER_IDENT | sed -e 's/>.*/>/'`\n\n"
[ "$signoff" = "t" ] && printf "Signed-off-by: `git var GIT_COMMITTER_IDENT | sed -e 's/>.*/>/'`\n\n"
) >> "$GUILT_DIR/$branch/$patch"

# edit -e ?
Expand All @@ -82,8 +82,8 @@ mkdir_dir=`dirname "$GUILT_DIR/$branch/$patch"`
if [ ! -z "$force" ]; then
(
cd "$TOP_DIR"
git-diff HEAD >> "$GUILT_DIR/$branch/$patch"
git-reset --hard HEAD > /dev/null
git diff HEAD >> "$GUILT_DIR/$branch/$patch"
git reset --hard HEAD > /dev/null
)
fi

Expand Down
10 changes: 5 additions & 5 deletions guilt-patchbomb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if [ $? -ne 0 ]; then
fi

# display the list of commits to be sent as patches
git-log --pretty=oneline "$r" | cut -c 1-8,41- | $pager
git log --pretty=oneline "$r" | cut -c 1-8,41- | $pager

echo -n "Are these what you want to send? [Y/n] "
read n
Expand All @@ -46,7 +46,7 @@ if [ -e $dir ]; then
fi
echo "Using '$dir' as temporary directory"

git-format-patch -o $dir -n -s "$r"
git format-patch -o $dir -n -s "$r"

# get the to/cc addresses
echo -n "Enter all the To: email addresses (separated by space): "
Expand All @@ -66,7 +66,7 @@ done
opts=""

# more than 1 commit
if [ `git-rev-list "$r" | wc -l` -gt 1 ]; then
if [ `git rev-list "$r" | wc -l` -gt 1 ]; then
opts="$opts --no-chain-reply-to --compose"
fi
opts="$opts $to_opts"
Expand All @@ -79,10 +79,10 @@ if [ "$n" != "y" ] && [ "$n" != "Y" ]; then
fi

# ...and off they go.
cmd="git-send-email"
cmd="git send-email"
if [ ! -z "$do_not_send" ]; then
echo "-n passed: not sending, command that would be executed:" >&2
cmd="echo git-send-email"
cmd="echo git send-email"
fi

if [ -z "$reply_to" ]; then
Expand Down
2 changes: 1 addition & 1 deletion guilt-pop
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ fi
# if we are forcing the pop, reset first
if [ ! -z "$force" ]; then
cd "$TOP_DIR" >&2 >/dev/null
git-reset --hard
git reset --hard
cd - >&2 >/dev/null
elif ! must_commit_first; then
die "Uncommited changes detected. Refresh first."
Expand Down
18 changes: 9 additions & 9 deletions guilt-rebase
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ fi

case "$#" in
1)
upstream=`git-rev-parse --verify "$1"` &&
ours=`git-rev-parse --verify HEAD` || usage
upstream=`git rev-parse --verify "$1"` &&
ours=`git rev-parse --verify HEAD` || usage
limit="$upstream"
;;
*)
Expand All @@ -37,8 +37,8 @@ fi

# Note that these list commits in reverse order;
# not that the order in inup matters...
inup=`git-rev-list ^$ours $upstream` &&
ours=`git-rev-list $ours ^$limit` || exit
inup=`git rev-list ^$ours $upstream` &&
ours=`git rev-list $ours ^$limit` || exit

rebase_dir="$GUILT_DIR/$branch/.rebase.$$"
mkdir "$rebase_dir"
Expand All @@ -47,8 +47,8 @@ mkdir "$rebase_dir"
# calculate the patch ids for all the commits in upstream
#
for c in $inup ; do
git-diff-tree -p $c
done | git-patch-id | while read id name ; do
git diff-tree -p $c
done | git patch-id | while read id name ; do
echo "$name" >> "$rebase_dir/$id"
done

Expand All @@ -58,10 +58,10 @@ cp "$applied" "$rebase_dir/status"

echo "First, poping all patches..."
pop_all_patches
git-merge --no-commit $upstream > /dev/null 2> /dev/null
git merge --no-commit $upstream > /dev/null 2> /dev/null

echo ""
log=`git-log -1 --pretty=oneline`
log=`git log -1 --pretty=oneline`
echo "HEAD is now at `echo $log | cut -c 1-7`... `echo "$log" | cut -c 41-`"

#
Expand All @@ -76,7 +76,7 @@ IFS=":"
cat "$rebase_dir/status" | while read hash name; do
echo ""
IFS=" "
cat "$GUILT_DIR/$branch/$name" | git-patch-id |
cat "$GUILT_DIR/$branch/$name" | git patch-id |
while read patchid commitid ; do
echo "Applying '$name'"
if [ -f "$rebase_dir/$patchid" ]; then
Expand Down
Loading

0 comments on commit 703eee1

Please sign in to comment.